Store credit card info
vitbulio opened this issue · 4 comments
Hello. How can I save credit card info into Keychain? From apple docs: "You can store other secrets that the user explicitly cares about, such as credit card information or even short notes" but there's no info how can do this.
Hi, you can store a password like any other text in Keychain:
let keychain = KeychainSwift()
keychain.set("password123", forKey: "my strong password")
print(keychain.get("my strong password"))
Hi, you can store a password like any other text in Keychain:
let keychain = KeychainSwift() keychain.set("password123", forKey: "my strong password") print(keychain.get("my strong password"))
If i store internet password, then key is password from textfield. It's ok. So, if i want to store credit card info, then can I store like this?
let keychain = KeychainSwift()
let cardNumber = "1111 1111 1111 1111"
let cardHolder = "Name Surname"
let expireDate = "12/22"
let cvv = "111"
let storeData = cardNumber + "." cardHolder + "." + expireDate + "." + cvv
keychain.set(storeData, forKey: randomPassword)
print(keychain.get("randomPassword"))
There is no need to make a key a random password, since keychain stores the text securely, no other apps can read it. I would just call it something simple:
keychain.set(storeData, forKey: "credit card")
Also, would store number, holder, date, cvv as separate keys for simplicity.
There is no need to make a key a random password, since keychain stores the text securely, no other apps can read it. I would just call it something simple:
keychain.set(storeData, forKey: "credit card")
Also, would store number, holder, date, cvv as separate keys for simplicity.
Thanks a lot Evgenii!