passbook 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +2 -0
- data/README.md +50 -4
- data/VERSION +1 -1
- data/lib/passbook/pkpass.rb +6 -31
- data/lib/passbook/signer.rb +40 -0
- data/lib/passbook.rb +2 -1
- data/passbook.gemspec +7 -5
- data/spec/lib/passbook/pkpass_spec.rb +3 -42
- data/spec/lib/passbook/signer_spec.rb +84 -0
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Yzk2Mzk1NzA5OTEzYTNkZTI2ZWM3YTZiYWZkMjBiNjE5ZDhiMzJkZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 97ea4c5ca0af4acfa45765aeaf6e0b25f178ccff
|
4
|
+
data.tar.gz: 6b4956c66a4adab083bc56931720c98388d44a7e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ODdhMzkzNGYyOGRhM2VkNGJlNDg3YzBhNTY5NDhlMmM2YjI3ZGNkMWJmYWEy
|
11
|
-
OGJhN2E2ZjU4ZTU1YTNlOWUyMzcxYTQ1MDRiNmFhNzk0NjgyNmI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODY0NDc4NWNhZWNhMjFiN2M0NjQwNjA3ODM0ZDlmNzRkYTIzZjdiYmRiNWY5
|
14
|
-
NjAyNDE1NGZhMzcxMmQ2OWJiZDk4OGIxNmRjMDdhMzZiMGNlNzk2ZjEzNjM2
|
15
|
-
YmE3YjM2OWQxYzM3MDA2MzFjNWJmYzE5YTIwNGY0NjFiYzQ0YmU=
|
6
|
+
metadata.gz: 0c4c3cc667cd81ff7909fd9693696d46c802ee706f31f0401abcbb8dd0d9c4482086a40ab80ed8f20f4af82bf206d0605aefd4511eaa45ac166ae488d885cf9b
|
7
|
+
data.tar.gz: 0aaa787aaad3dc34a6937c3a98f74bae8f3932becf14dce0aed930baab25fe075d44ac30d41fd7a13bd55c485988ad9e06aa05725ff1a179bbda5c3fb011f744
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -13,6 +13,38 @@ IE: In your Gemfile
|
|
13
13
|
gem 'passbook'
|
14
14
|
```
|
15
15
|
|
16
|
+
## Quick Start
|
17
|
+
|
18
|
+
If you want to jump in without having to integrate this into your code you can use the command line options to get started. Start by installing the gem
|
19
|
+
|
20
|
+
```
|
21
|
+
gem install passbook
|
22
|
+
```
|
23
|
+
|
24
|
+
Then go to a directory that you want to generate your pass under and use the "pk generate command". (note: do not use spaces in your passname or else strange things will happen.)
|
25
|
+
|
26
|
+
```
|
27
|
+
pk generate your_pass_name
|
28
|
+
```
|
29
|
+
|
30
|
+
This will generate a directory called your_pass_name. Edit your pass.json file in the your_pass_directory to have a valid team identifier and passTypeIdentifier and create your cerificates if you haven't yet. [See this article for information on how to do this.](http://www.raywenderlich.com/20734/beginning-passbook-part-1#more-20734)
|
31
|
+
|
32
|
+
Assuming that you have put your cerificate files etc. in your working directory.
|
33
|
+
|
34
|
+
```
|
35
|
+
pk build your_pass_name -w ./wwdc.pem -c ./your_pass_name.p12 -p ''
|
36
|
+
```
|
37
|
+
The wwdc.pem file is the exported Apple World Wide Develoler Relations Certification Authority certifiate file from your key manager and the your_pass_name.p12 is the exported p12 file from your pass certificate.
|
38
|
+
|
39
|
+
If you are not building your passes on a mac or just prefer to use the pass certificate and key pem file.
|
40
|
+
|
41
|
+
```
|
42
|
+
pk build passbook_gem_name -w ./wwdc.pem -c ./your_pass_name_certificate.pem -k your_pass_name_key.pem -p '12345'
|
43
|
+
```
|
44
|
+
|
45
|
+
Now you can drag the file over to a simulator or send it to your i-phone via e-mail to view your pass.
|
46
|
+
|
47
|
+
|
16
48
|
## Configuration
|
17
49
|
|
18
50
|
Create initializer
|
@@ -26,7 +58,7 @@ Configure your config/initializers/passbook.rb
|
|
26
58
|
```
|
27
59
|
Passbook.configure do |passbook|
|
28
60
|
passbook.wwdc_cert = Rails.root.join('wwdc_cert.pem')
|
29
|
-
passbook.
|
61
|
+
passbook.p12_certificate = Rails.root.join('cert.p12')
|
30
62
|
passbook.p12_password = 'cert password'
|
31
63
|
end
|
32
64
|
```
|
@@ -113,9 +145,20 @@ end
|
|
113
145
|
|
114
146
|
We will try to make this cleaner in subsequent releases.
|
115
147
|
|
116
|
-
###
|
148
|
+
### Using Different Certificates For Different Passes
|
117
149
|
|
118
|
-
|
150
|
+
Sometime you might want to be able to use different certificates for different passes. This can be done by passing in a Signer class into your PKPass initializer like so
|
151
|
+
|
152
|
+
```
|
153
|
+
signer = Passbook::Signer.new {certificate: some_cert, password: some_password, key: some_key, wwdc_cert: some_wwdc_cert}
|
154
|
+
pk_pass = Passbook::PKPass.new your_json_data, signer
|
155
|
+
|
156
|
+
....
|
157
|
+
```
|
158
|
+
|
159
|
+
### Push Notifications
|
160
|
+
|
161
|
+
If you want to support passbook push notification updates you will need to configure the appropriate bits above.
|
119
162
|
|
120
163
|
In order to support push notifications you will need to have a basic understanding of the way that push notifications work and how the data is passed back and forth. See [this](http://developer.apple.com/library/ios/#Documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html) for basic information about passes and [this](http://developer.apple.com/library/ios/#Documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1) to understand the information that needs to be exchanged between each device and your application to support the update service.
|
121
164
|
|
@@ -217,7 +260,7 @@ Apple will send out a notification to your phone (usually within 15 minutes or l
|
|
217
260
|
|
218
261
|
To launch tests :
|
219
262
|
```
|
220
|
-
bundle exec
|
263
|
+
bundle exec rake spec
|
221
264
|
```
|
222
265
|
|
223
266
|
## Contributing
|
@@ -236,6 +279,9 @@ Allow passbook gem to return a ZipOutputStream (needed when garbage collector de
|
|
236
279
|
### 0.2.0
|
237
280
|
Adding support for push notification updates for passes.
|
238
281
|
|
282
|
+
### 0.4.0
|
283
|
+
Adding support for using multiple signatures per gem configuration and introducing command line helpers.
|
284
|
+
|
239
285
|
License
|
240
286
|
-------
|
241
287
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/passbook/pkpass.rb
CHANGED
@@ -5,13 +5,14 @@ require 'base64'
|
|
5
5
|
|
6
6
|
module Passbook
|
7
7
|
class PKPass
|
8
|
-
attr_accessor :pass, :manifest_files
|
8
|
+
attr_accessor :pass, :manifest_files, :signer
|
9
9
|
|
10
10
|
TYPES = ['boarding-pass', 'coupon', 'event-ticket', 'store-card', 'generic']
|
11
11
|
|
12
|
-
def initialize pass
|
13
|
-
@pass
|
14
|
-
@manifest_files
|
12
|
+
def initialize pass, init_signer = Passbook::Signer.new
|
13
|
+
@pass = pass
|
14
|
+
@manifest_files = []
|
15
|
+
@signer = init_signer
|
15
16
|
end
|
16
17
|
|
17
18
|
def addFile file
|
@@ -34,7 +35,7 @@ module Passbook
|
|
34
35
|
checkPass manifest
|
35
36
|
|
36
37
|
# Create pass signature
|
37
|
-
signature =
|
38
|
+
signature = @signer.sign manifest
|
38
39
|
|
39
40
|
return [manifest, signature]
|
40
41
|
end
|
@@ -62,32 +63,6 @@ module Passbook
|
|
62
63
|
outputZip manifest, signature
|
63
64
|
end
|
64
65
|
|
65
|
-
def get_p12_cert_and_key
|
66
|
-
key_hash = {}
|
67
|
-
if Passbook.p12_key
|
68
|
-
key_hash[:key] = OpenSSL::PKey::RSA.new File.read(Passbook.p12_key), Passbook.p12_password
|
69
|
-
key_hash[:cert] = OpenSSL::X509::Certificate.new File.read(Passbook.p12_certificate)
|
70
|
-
else
|
71
|
-
p12 = OpenSSL::PKCS12.new File.read(Passbook.p12_cert), Passbook.p12_password
|
72
|
-
key_hash[:key], key_hash[:cert] = p12.key, p12.certificate
|
73
|
-
end
|
74
|
-
key_hash
|
75
|
-
end
|
76
|
-
|
77
|
-
def createSignature manifest
|
78
|
-
p12 = get_p12_cert_and_key
|
79
|
-
wwdc = OpenSSL::X509::Certificate.new File.read(Passbook.wwdc_cert)
|
80
|
-
pk7 = OpenSSL::PKCS7.sign p12[:cert], p12[:key], manifest.to_s, [wwdc], OpenSSL::PKCS7::BINARY | OpenSSL::PKCS7::DETACHED
|
81
|
-
data = OpenSSL::PKCS7.write_smime pk7
|
82
|
-
|
83
|
-
str_debut = "filename=\"smime.p7s\"\n\n"
|
84
|
-
data = data[data.index(str_debut)+str_debut.length..data.length-1]
|
85
|
-
str_end = "\n\n------"
|
86
|
-
data = data[0..data.index(str_end)-1]
|
87
|
-
|
88
|
-
return Base64.decode64(data)
|
89
|
-
end
|
90
|
-
|
91
66
|
private
|
92
67
|
|
93
68
|
def checkPass manifest
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
module Passbook
|
5
|
+
class Signer
|
6
|
+
attr_accessor :certificate, :password, :key, :wwdc_cert, :key_hash, :p12_cert
|
7
|
+
|
8
|
+
def initialize params = {}
|
9
|
+
@certificate = params[:certificate] || Passbook.p12_certificate
|
10
|
+
@password = params[:password] || Passbook.p12_password
|
11
|
+
@key = params[:key] || (params.empty? ? Passbook.p12_key : nil)
|
12
|
+
@wwdc_cert = params[:wwdc_cert] || Passbook.wwdc_cert
|
13
|
+
compute_cert
|
14
|
+
end
|
15
|
+
|
16
|
+
def sign data
|
17
|
+
wwdc = OpenSSL::X509::Certificate.new File.read(wwdc_cert)
|
18
|
+
pk7 = OpenSSL::PKCS7.sign key_hash[:cert], key_hash[:key], data.to_s, [wwdc], OpenSSL::PKCS7::BINARY | OpenSSL::PKCS7::DETACHED
|
19
|
+
data = OpenSSL::PKCS7.write_smime pk7
|
20
|
+
|
21
|
+
str_debut = "filename=\"smime.p7s\"\n\n"
|
22
|
+
data = data[data.index(str_debut)+str_debut.length..data.length-1]
|
23
|
+
str_end = "\n\n------"
|
24
|
+
data = data[0..data.index(str_end)-1]
|
25
|
+
|
26
|
+
return Base64.decode64(data)
|
27
|
+
end
|
28
|
+
|
29
|
+
def compute_cert
|
30
|
+
@key_hash = {}
|
31
|
+
if key
|
32
|
+
@key_hash[:key] = OpenSSL::PKey::RSA.new File.read(key), password
|
33
|
+
@key_hash[:cert] = OpenSSL::X509::Certificate.new File.read(certificate)
|
34
|
+
else
|
35
|
+
p12 = OpenSSL::PKCS12.new File.read(certificate), password
|
36
|
+
@key_hash[:key], @key_hash[:cert] = p12.key, p12.certificate
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/passbook.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require "passbook/version"
|
2
2
|
require "passbook/pkpass"
|
3
|
+
require "passbook/signer"
|
3
4
|
require 'active_support/core_ext/module/attribute_accessors'
|
4
5
|
require 'passbook/push_notification'
|
5
6
|
require 'grocer/passbook_notification'
|
6
7
|
require 'rack/passbook_rack'
|
7
8
|
|
8
9
|
module Passbook
|
9
|
-
mattr_accessor :
|
10
|
+
mattr_accessor :p12_certificate, :p12_password, :wwdc_cert, :p12_key, :notification_cert, :notification_gateway
|
10
11
|
|
11
12
|
def self.configure
|
12
13
|
yield self
|
data/passbook.gemspec
CHANGED
@@ -2,15 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: passbook 0.
|
5
|
+
# stub: passbook 0.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "passbook"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
12
13
|
s.authors = ["Thomas Lauro", "Lance Gleason"]
|
13
|
-
s.date = "
|
14
|
+
s.date = "2014-06-22"
|
14
15
|
s.description = "This gem allows you to create IOS Passbooks. Unlike some, this works with Rails but does not require it."
|
15
16
|
s.email = ["thomas@lauro.fr", "lgleason@polyglotprogramminginc.com"]
|
16
17
|
s.executables = ["pk"]
|
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
"lib/passbook.rb",
|
39
40
|
"lib/passbook/pkpass.rb",
|
40
41
|
"lib/passbook/push_notification.rb",
|
42
|
+
"lib/passbook/signer.rb",
|
41
43
|
"lib/passbook/version.rb",
|
42
44
|
"lib/rack/passbook_rack.rb",
|
43
45
|
"lib/rails/generators/passbook/config/config_generator.rb",
|
@@ -54,13 +56,13 @@ Gem::Specification.new do |s|
|
|
54
56
|
"spec/lib/commands/generate_spec.rb",
|
55
57
|
"spec/lib/passbook/pkpass_spec.rb",
|
56
58
|
"spec/lib/passbook/push_notification_spec.rb",
|
59
|
+
"spec/lib/passbook/signer_spec.rb",
|
57
60
|
"spec/lib/rack/passbook_rack_spec.rb",
|
58
61
|
"spec/spec_helper.rb"
|
59
62
|
]
|
60
63
|
s.homepage = "http://github.com/frozon/passbook"
|
61
64
|
s.licenses = ["MIT"]
|
62
|
-
s.
|
63
|
-
s.rubygems_version = "2.1.10"
|
65
|
+
s.rubygems_version = "2.2.2"
|
64
66
|
s.summary = "A IOS Passbook generator."
|
65
67
|
|
66
68
|
if s.respond_to? :specification_version then
|
@@ -42,47 +42,8 @@ describe Passbook do
|
|
42
42
|
}
|
43
43
|
}}
|
44
44
|
|
45
|
-
let (:
|
46
|
-
|
47
|
-
context 'signatures' do
|
48
|
-
before do
|
49
|
-
Passbook.should_receive(:p12_password).and_return 'password'
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'p12_cert_and_key' do
|
53
|
-
context 'pem p12 certs' do
|
54
|
-
before do
|
55
|
-
Passbook.should_receive(:p12_key).twice.and_return 'my_p12_key'
|
56
|
-
Passbook.should_receive(:p12_certificate).and_return 'my_p12_certificate'
|
57
|
-
File.should_receive(:read).with('my_p12_key').and_return 'my_p12_key_file'
|
58
|
-
File.should_receive(:read).with('my_p12_certificate').and_return 'my_p12_certificate_file'
|
59
|
-
OpenSSL::PKey::RSA.should_receive(:new).with('my_p12_key_file', 'password').and_return 'my_rsa_key'
|
60
|
-
OpenSSL::X509::Certificate.should_receive(:new).with('my_p12_certificate_file').and_return 'my_ssl_p12_cert'
|
61
|
-
end
|
62
|
-
|
63
|
-
subject {pass.get_p12_cert_and_key}
|
64
|
-
its([:key]) {should eq 'my_rsa_key'}
|
65
|
-
its([:cert]) {should eq 'my_ssl_p12_cert'}
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'p12 files' do
|
69
|
-
let (:p12) { double('OpenSSL::PKCS12') }
|
70
|
-
let (:final_hash) {{:key => 'my_final_p12_key', :cert => 'my_final_p12_cert'}}
|
71
|
-
before do
|
72
|
-
p12.should_receive(:key).and_return final_hash[:key]
|
73
|
-
p12.should_receive(:certificate).and_return final_hash[:cert]
|
74
|
-
Passbook.should_receive(:p12_key).and_return nil
|
75
|
-
Passbook.should_receive(:p12_cert).and_return 'my_p12_cert'
|
76
|
-
File.should_receive(:read).with('my_p12_cert').and_return 'my_p12_cert_file'
|
77
|
-
OpenSSL::PKCS12.should_receive(:new).with('my_p12_cert_file', 'password').and_return p12
|
78
|
-
end
|
79
|
-
|
80
|
-
subject {pass.get_p12_cert_and_key}
|
81
|
-
its([:key]) {should eq final_hash[:key]}
|
82
|
-
its([:cert]) {should eq final_hash[:cert]}
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
45
|
+
let (:signer) {double 'signer'}
|
46
|
+
let (:pass) {Passbook::PKPass.new content.to_json, signer}
|
86
47
|
|
87
48
|
context 'outputs' do
|
88
49
|
let (:base_path) {'spec/data'}
|
@@ -90,7 +51,7 @@ describe Passbook do
|
|
90
51
|
|
91
52
|
before :each do
|
92
53
|
pass.addFiles ["#{base_path}/icon.png","#{base_path}/icon@2x.png","#{base_path}/logo.png","#{base_path}/logo@2x.png"]
|
93
|
-
|
54
|
+
signer.should_receive(:sign).and_return('Signed by the Honey Badger')
|
94
55
|
@file_entries = []
|
95
56
|
Zip::InputStream::open(zip_path) {|io|
|
96
57
|
while (entry = io.get_next_entry)
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Signer' do
|
4
|
+
context 'signatures' do
|
5
|
+
|
6
|
+
context 'p12_cert_and_key' do
|
7
|
+
context 'pem p12 certs' do
|
8
|
+
context 'using config file certificates' do
|
9
|
+
before do
|
10
|
+
Passbook.should_receive(:p12_password).and_return 'password'
|
11
|
+
Passbook.should_receive(:p12_key).and_return 'my_p12_key'
|
12
|
+
Passbook.should_receive(:p12_certificate).and_return 'my_p12_certificate'
|
13
|
+
Passbook.should_receive(:wwdc_cert).and_return 'i_love_robots'
|
14
|
+
File.should_receive(:read).with('my_p12_key').and_return 'my_p12_key_file'
|
15
|
+
File.should_receive(:read).with('my_p12_certificate').and_return 'my_p12_certificate_file'
|
16
|
+
OpenSSL::PKey::RSA.should_receive(:new).with('my_p12_key_file', 'password').and_return 'my_rsa_key'
|
17
|
+
OpenSSL::X509::Certificate.should_receive(:new).with('my_p12_certificate_file').and_return 'my_ssl_p12_cert'
|
18
|
+
end
|
19
|
+
|
20
|
+
subject {Passbook::Signer.new.key_hash}
|
21
|
+
its([:key]) {should eq 'my_rsa_key'}
|
22
|
+
its([:cert]) {should eq 'my_ssl_p12_cert'}
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'using passed in certificates' do
|
26
|
+
before do
|
27
|
+
Passbook.should_receive(:p12_password).never
|
28
|
+
Passbook.should_receive(:p12_key).never
|
29
|
+
Passbook.should_receive(:p12_certificate).never
|
30
|
+
Passbook.should_receive(:wwdc_cert).never
|
31
|
+
File.should_receive(:read).with('my_p12_key').and_return 'my_p12_key_file'
|
32
|
+
File.should_receive(:read).with('my_p12_certificate').and_return 'my_p12_certificate_file'
|
33
|
+
OpenSSL::PKey::RSA.should_receive(:new).with('my_p12_key_file', 'password').and_return 'my_rsa_key'
|
34
|
+
OpenSSL::X509::Certificate.should_receive(:new).with('my_p12_certificate_file').and_return 'my_ssl_p12_cert'
|
35
|
+
end
|
36
|
+
|
37
|
+
subject {Passbook::Signer.new(certificate: 'my_p12_certificate', password: 'password',
|
38
|
+
key: 'my_p12_key', wwdc_cert: 'i_love_robots').key_hash}
|
39
|
+
its([:key]) {should eq 'my_rsa_key'}
|
40
|
+
its([:cert]) {should eq 'my_ssl_p12_cert'}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'p12 files' do
|
45
|
+
let (:p12) { double('OpenSSL::PKCS12') }
|
46
|
+
let (:final_hash) {{:key => 'my_final_p12_key', :cert => 'my_final_p12_cert'}}
|
47
|
+
context 'using config file certificates' do
|
48
|
+
before do
|
49
|
+
p12.should_receive(:key).and_return final_hash[:key]
|
50
|
+
p12.should_receive(:certificate).and_return final_hash[:cert]
|
51
|
+
Passbook.should_receive(:p12_password).and_return 'password'
|
52
|
+
Passbook.should_receive(:wwdc_cert).and_return 'i_love_robots'
|
53
|
+
Passbook.should_receive(:p12_certificate).and_return 'my_p12_cert'
|
54
|
+
Passbook.should_receive(:p12_key).and_return nil
|
55
|
+
File.should_receive(:read).with('my_p12_cert').and_return 'my_p12_cert_file'
|
56
|
+
OpenSSL::PKCS12.should_receive(:new).with('my_p12_cert_file', 'password').and_return p12
|
57
|
+
end
|
58
|
+
|
59
|
+
subject {Passbook::Signer.new.key_hash}
|
60
|
+
its([:key]) {should eq final_hash[:key]}
|
61
|
+
its([:cert]) {should eq final_hash[:cert]}
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'using passed in certificates' do
|
65
|
+
before do
|
66
|
+
p12.should_receive(:key).and_return final_hash[:key]
|
67
|
+
p12.should_receive(:certificate).and_return final_hash[:cert]
|
68
|
+
Passbook.should_receive(:p12_password).never
|
69
|
+
Passbook.should_receive(:p12_key).never
|
70
|
+
Passbook.should_receive(:p12_certificate).never
|
71
|
+
Passbook.should_receive(:wwdc_cert).never
|
72
|
+
File.should_receive(:read).with('my_p12_cert').and_return 'my_p12_cert_file'
|
73
|
+
OpenSSL::PKCS12.should_receive(:new).with('my_p12_cert_file', 'password').and_return p12
|
74
|
+
end
|
75
|
+
|
76
|
+
subject {Passbook::Signer.new(certificate: 'my_p12_cert', password: 'password',
|
77
|
+
wwdc_cert: 'i_love_robots').key_hash}
|
78
|
+
its([:key]) {should eq final_hash[:key]}
|
79
|
+
its([:cert]) {should eq final_hash[:cert]}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Lauro
|
@@ -9,160 +9,160 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubyzip
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 1.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.0.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: grocer
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: commander
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: terminal-table
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rack-test
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: activesupport
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: jeweler
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: simplecov
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rspec
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: rake
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- -
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: yard
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- -
|
158
|
+
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- -
|
165
|
+
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
description: This gem allows you to create IOS Passbooks. Unlike some, this works
|
@@ -177,7 +177,7 @@ extra_rdoc_files:
|
|
177
177
|
- LICENSE
|
178
178
|
- README.md
|
179
179
|
files:
|
180
|
-
- .travis.yml
|
180
|
+
- ".travis.yml"
|
181
181
|
- Gemfile
|
182
182
|
- Gemfile.lock
|
183
183
|
- LICENSE
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- lib/passbook.rb
|
197
197
|
- lib/passbook/pkpass.rb
|
198
198
|
- lib/passbook/push_notification.rb
|
199
|
+
- lib/passbook/signer.rb
|
199
200
|
- lib/passbook/version.rb
|
200
201
|
- lib/rack/passbook_rack.rb
|
201
202
|
- lib/rails/generators/passbook/config/config_generator.rb
|
@@ -212,6 +213,7 @@ files:
|
|
212
213
|
- spec/lib/commands/generate_spec.rb
|
213
214
|
- spec/lib/passbook/pkpass_spec.rb
|
214
215
|
- spec/lib/passbook/push_notification_spec.rb
|
216
|
+
- spec/lib/passbook/signer_spec.rb
|
215
217
|
- spec/lib/rack/passbook_rack_spec.rb
|
216
218
|
- spec/spec_helper.rb
|
217
219
|
homepage: http://github.com/frozon/passbook
|
@@ -224,19 +226,18 @@ require_paths:
|
|
224
226
|
- lib
|
225
227
|
required_ruby_version: !ruby/object:Gem::Requirement
|
226
228
|
requirements:
|
227
|
-
- -
|
229
|
+
- - ">="
|
228
230
|
- !ruby/object:Gem::Version
|
229
231
|
version: '0'
|
230
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
233
|
requirements:
|
232
|
-
- -
|
234
|
+
- - ">="
|
233
235
|
- !ruby/object:Gem::Version
|
234
236
|
version: '0'
|
235
237
|
requirements: []
|
236
238
|
rubyforge_project:
|
237
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.2.2
|
238
240
|
signing_key:
|
239
241
|
specification_version: 4
|
240
242
|
summary: A IOS Passbook generator.
|
241
243
|
test_files: []
|
242
|
-
has_rdoc:
|