Inside my app the user can purchase a non-consumable product. My problem right now is that I don't quite know how to store the information correctly wether or not a user has bought the product or not. I read the User Defaults is not the most secure way, so I tried it with Keychain. For that I am using this helper lib.
Now this is how I tried implementing it:
keychain["isPremium"] = "true" // set the state
let token = try? keychain.get("isPremium") // get the state to check if it worked
print(token as Any)
This is printing "true". However if I logout the user, and login with another account and I only call this:
let token = try? keychain.get("isPremium")
it still prints out "true" even though the second user hasn't purchased the item. How can I store the state of the IAP in my app then ?