motion-keychain 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +47 -0
- data/lib/motion-keychain.rb +18 -0
- data/lib/project/motion-keychain.rb +26 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 24ea9929537077ed07b72c9a8275cc155b00ee26
|
4
|
+
data.tar.gz: 71724587bf0270c53268e9e4b4e5372f2de3d431
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2cef5b957bf16e209219de1d83760e80d1c6586cac2b1e2f0863f884cf912e77cb89f1f7c15888388fa55e9c9e4639df795deb851babad303298812e4d25bfb
|
7
|
+
data.tar.gz: 2c85af05a4784b13fab444142406188183ee255cbdc6c9e856ec49c5d866bfac701a141dfc171f77f16c0b2bac31a7f997112cd6080f9737643930a19448a743
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
![motion-keychain-explain](./_art/motion-keychain.png)
|
2
|
+
|
3
|
+
#### Securely store data in RubyMotion.
|
4
|
+
|
5
|
+
The motion-keychain gem is a simple wrapper for Keychain on iOS and OS X. Makes using Keychain APIs as easy as NSUserDefaults.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'motion-keychain'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install motion-keychain
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Store secure data:
|
24
|
+
```ruby
|
25
|
+
# Storing securely under key 'password'
|
26
|
+
MotionKeychain.set('password', @password.text)
|
27
|
+
```
|
28
|
+
|
29
|
+
Retrieve secure data:
|
30
|
+
```ruby
|
31
|
+
# Retreiving 'password' content from keychain
|
32
|
+
@password.text = MotionKeychain.get('password')
|
33
|
+
```
|
34
|
+
|
35
|
+
Wipe secure data:
|
36
|
+
```ruby
|
37
|
+
# User is logging out
|
38
|
+
MotionKeychain.remove('password')
|
39
|
+
```
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
unless defined?(Motion::Project::Config)
|
4
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
5
|
+
end
|
6
|
+
|
7
|
+
lib_dir_path = File.dirname(File.expand_path(__FILE__))
|
8
|
+
Motion::Project::App.setup do |app|
|
9
|
+
app.files.unshift(Dir.glob(File.join(lib_dir_path, "project/**/*.rb")))
|
10
|
+
|
11
|
+
# Add needed security Framework
|
12
|
+
app.frameworks += ['Security']
|
13
|
+
|
14
|
+
# For now depending on pod
|
15
|
+
app.pods do
|
16
|
+
pod 'UICKeyChainStore'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class MotionKeychain
|
2
|
+
class << self
|
3
|
+
SERVICE = NSBundle.mainBundle.bundleIdentifier
|
4
|
+
STORE = UICKeyChainStore.keyChainStoreWithService(SERVICE)
|
5
|
+
|
6
|
+
def store
|
7
|
+
STORE
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(key)
|
11
|
+
STORE.stringForKey(key.to_s)
|
12
|
+
end
|
13
|
+
|
14
|
+
def set(key, value)
|
15
|
+
STORE.setString(value, forKey: key.to_s)
|
16
|
+
STORE.synchronize
|
17
|
+
{key: value}
|
18
|
+
end
|
19
|
+
|
20
|
+
def remove(key)
|
21
|
+
STORE.removeItemForKey(key.to_s)
|
22
|
+
STORE.synchronize
|
23
|
+
true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-keychain
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gant
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: motion-cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.4.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Simple wrapper for Keychain on iOS and OS X.
|
42
|
+
email:
|
43
|
+
- Gant@iconoclastlabs.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- README.md
|
49
|
+
- lib/motion-keychain.rb
|
50
|
+
- lib/project/motion-keychain.rb
|
51
|
+
homepage: https://github.com/IconoclastLabs/motion-keychain
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.2.2
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: The motion-keychain gem is a simple wrapper for Keychain on iOS and OS X.
|
75
|
+
Makes using Keychain APIs as easy as NSUserDefaults.
|
76
|
+
test_files: []
|
77
|
+
has_rdoc:
|