From f68153ddafe567ff77b94de780f6ae0253defeb2 Mon Sep 17 00:00:00 2001 From: Ben Ubois Date: Thu, 24 Oct 2013 10:51:33 -0700 Subject: [PATCH 1/2] Usage updates. Added a section on obtaining a certificate. --- README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 03686c8..33736df 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,8 @@ Or install it yourself as: ## Usage ```ruby -test_icon = File.open('icon.png') -@pair = { - key: OpenSSL::PKey::RSA.new(File.read('rsa.pem'), 'my pass phrase'), - certificate: OpenSSL::X509::Certificate.new(File.read('apple-dev.cer')) -} -``` +p12 = OpenSSL::PKCS12.new(File.read('certificate.p12'), 'PASSWORD') -```ruby builder = Grocer::Pushpackager::Package.new({ websiteName: "Bay Airlines", websitePushID: "web.com.example.domain", @@ -38,21 +32,29 @@ builder = Grocer::Pushpackager::Package.new({ urlFormatString: "http://domain.example.com/%@/?flight=%@", authenticationToken: "19f8d7a6e9fb8a7f6d9330dabe", webServiceURL: "https://example.com/push", - certificate: @pair[:certificate], - key: @pair[:key], + certificate: p12.certificate, + key: p12.certificate, iconSet: { - :'16x16' => test_icon, - :'16x16@2x' => test_icon, - :'32x32' => test_icon, - :'32x32@2x' => test_icon, - :'128x128' => test_icon, - :'128x128@2x' => test_icon + :'16x16' => File.open('icon.png'), + :'16x16@2x' => File.open('icon.png'), + :'32x32' => File.open('icon.png'), + :'32x32@2x' => File.open('icon.png'), + :'128x128' => File.open('icon.png'), + :'128x128@2x' => File.open('icon.png') } }) builder.file # A closed Tempfile that can be read builder.buffer # A string buffer that can be streamed out to a client ``` +## Obtaining a Certificate + +1. Visit the [Website Push IDs](https://developer.apple.com/account/ios/identifiers/websitePushId/websitePushIdList.action) page under Identifiers in the Developer Center. +2. Create a new ID. +3. Download the new certificate in the Certificates section. +4. Open the certificate in Keychain Access +5. Right click on the certificate and choose export. Select the p12 option. + ## Contributing 1. Fork it From 21dac5b6d5d0cf49df21bca8bc6a86b7a7eabf1a Mon Sep 17 00:00:00 2001 From: Ben Ubois Date: Thu, 24 Oct 2013 10:56:20 -0700 Subject: [PATCH 2/2] Corrected key. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33736df..79bfcb0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ builder = Grocer::Pushpackager::Package.new({ authenticationToken: "19f8d7a6e9fb8a7f6d9330dabe", webServiceURL: "https://example.com/push", certificate: p12.certificate, - key: p12.certificate, + key: p12.key, iconSet: { :'16x16' => File.open('icon.png'), :'16x16@2x' => File.open('icon.png'),