I use KeychainSwift to save my data on keychain, my problem is, when the I backup and restore my app, from Device A
to Device B
, those data from Keychain was included on the transfer.
The question is, how can I prevent it from happening and make my keychain stay only on Device A
?
This is my code on Saving data into the keychain
import KeychainSwift
class ExampleViewController: UIViewController {
let keychain = KeychainSwift(keyPrefix: "some_key")
override func viewDidLoad() {
keychain.set("some_data", forKey: "thisDeviceOnly")
}
}
You have to use withAccess parameter for set method
Possible values you can look on officialKeychainSwift github here https://github.com/evgenyneu/keychain-swift/blob/master/Sources/KeychainSwiftAccessOptions.swift
You need some access value with ThisDeviceOnly ending to it not be synced over devices.