Created
August 15, 2013 17:45
-
-
Save dblandin/6242941 to your computer and use it in GitHub Desktop.
Storing secure data with RubyMotion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CredentialStore | |
SERVICE = 'YOUR_APP_NAME' | |
def set_secure_value(value, for_key: key) | |
if value | |
SSKeychain.setPassword(value, forService: SERVICE, account: key) | |
else | |
SSKeychain.deletePasswordForService(SERVICE, account: key) | |
end | |
end | |
def secure_value_for_key(key) | |
SSKeychain.passwordForService(SERVICE, account: key) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'cocoapods', '~> 0.23.0' | |
gem 'motion-cocoapods', '~> 1.3.6' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Motion::Project::App.setup do |app| | |
... | |
# To access the keychain | |
app.entitlements['keychain-access-groups'] = [ app.seed_id + '.' + app.identifier ] | |
... | |
app.pods do | |
pod 'SSKeychain', '~> 1.2.0' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment