Skip to content

Instantly share code, notes, and snippets.

@dblandin
Created August 15, 2013 17:45
Show Gist options
  • Save dblandin/6242941 to your computer and use it in GitHub Desktop.
Save dblandin/6242941 to your computer and use it in GitHub Desktop.
Storing secure data with RubyMotion
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
source 'https://rubygems.org'
gem 'cocoapods', '~> 0.23.0'
gem 'motion-cocoapods', '~> 1.3.6'
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