不知道什么本质区别?反正都可以用户保持keychain数据。
关于SAMKeychain
1. return SAMKeychain.password(forService: Keys.service, account: Keys.account)
2. SAMKeychain.deletePassword(forService: Keys.service, account: Keys.account)
关于CryptoSwift
Swift - 第三方加密库CryptoSwift使用详解1(数据类型转换、MD5、SHA)
https://www.hangge.com/blog/cache/detail_1865.html
Swift - 第三方加密库CryptoSwift使用详解2(CRC、MAC、PBKDF2)
https://www.hangge.com/blog/cache/detail_1867.html
例子:
1. keychain.set(timeString, forKey: autoLockTime)
keychain.set(String(type.rawValue), forKey: autoLockType)
2. let timeString = keychain.get(autoLockTime)
3. keychain.delete(passcodeAttempts)
4. func save(cookies: [HTTPCookie]) {
let data = NSKeyedArchiver.archivedData(withRootObject: cookies)
keychain.set(data, forKey: cookiesKey)
}
let encodedData = keychain.getData(cookiesKey)
网友评论