Code Monkey home page Code Monkey logo

passbook's People

Contributors

afallou avatar avinoth avatar cjeffries avatar frozon avatar jspooner avatar lgleasain avatar nikoroberts avatar nov avatar ronakjangir47 avatar stereoscott avatar thejchap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passbook's Issues

Anyone else having their expiration/relevant dates set to the day before the one you specify?

I'm setting my expiration dates in the required rfc3339 format using either:
DateTime.parse(Date.today.to_s).to_s
or
Date.today.strftime(""%Y-%m-%dT%H:%M:%S%:z"")

In the simulator and Safari on a mac, this is yielding correct results. But on an ios7 phone, It's subtracting 1 day from my date for the expiration date. I suspect this is a question for StackOverflow, but was hoping someone here might have seen this before.

How to install?

Until this gem is on rubygems.org... I have tried in vain to install this but keep failing miserably. There is not even a .gem file, so I try to build the .gem myself by doing

gem build ~/Downloads/passbook-0.0.4/passbook.gemspec

But I get

ERROR: While executing gem ... (Gem::InvalidSpecificationException)
["LICENSE", "README.md"] are not files

Any ideas?

invalid option -w

pk build your_pass_name -w ./wwdc.pem -c ./your_pass_name.p12 -p ''

➜ repo git:(master) ✗ pk build mypass -w ./wwdc.pem -c ./mypass.p12 -p ''
invalid option: -w

Pass signing does not use WWDR cert

Hello,

As of the September 12th conference Apple has changed their pass signing to include the WWDR in the signing process. I have integrated your gem into my app and it works great (Thanks by the way ;) ) however I can not open them on a device because it is missing this part of the signature.

notification_passphrase missing

Hy,

I'm creating a rails app with passbook.

Now i have problems with sending pushes for notification.
How i can set the notification_cert.pem - password to the passbook.rb?

I downloaded the version 0.4.1 of the passbook gem and it seems the Key ":notification_passphrase" in the line of the "mattr_accessor" in the passbook module is missing.

Is there another way to set the password?

Thanks for your help

Encoding::UndefinedConversionError ("\x9F" from ASCII-8BIT to UTF-8):

Hi, I've got this error:

Encoding::UndefinedConversionError ("\x9F" from ASCII-8BIT to UTF-8):

passbook = Passbook::PKPass.new json passbook.addFiles [Rails.root.join('certificates/icon.png'), Rails.root.join('certificates/[email protected]')] gen_pass = passbook.file send_file(gen_pass.path, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: "pass.pkpass")

What I do wrong?
Rais 6, ruby 2.7.1

The pass "pass.pkpass" could not be opened

I keep getting this error: The pass "pass.pkpass" could not be opened. Below's my code. I've re-done the cert process like 3 times. Not sure where it's failing because the package seems intact.

def show
   pass = Pass.find(params[:id])
   pass_path = ENV['passes_folder_path'] + "/passes/#{pass.id}"
   pass_json = File.read(pass_path + "/pass.json")
   pkpass = Passbook::PKPass.new pass_json
   files = []
   Dir.foreach(pass_path) do |file|
     next if file == '.' or file == '..' or file == '.DS_Store'
     files << file
   end
   pkpass.addFiles files
   send_data(pkpass, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: 'pass.pkpass', status: 201, location: [:api, pass])
 end

NoMethodError: undefined method `pusher' for Grocer:Module

I'm setting up push notifications and I'm getting a no method error for Grocer when calling Passbook::PushNotification.send_notification

➜  wallet git:(62) ✗ rails c
Loading development environment (Rails 4.2.0)
irb: warn: can't alias context from irb_context.
2.2.0 :001 > Passbook::PushNotification.send_notification 'SNIP'
NoMethodError: undefined method `pusher' for Grocer:Module
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/passbook-0.4.1/lib/passbook/push_notification.rb:4:in `send_notification'
    from (irb):1
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/jspooner/v/wallet/bin/rails:8:in `<top (required)>'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/commands/rails.rb:6:in `call'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/command_wrapper.rb:38:in `call'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:183:in `block in serve'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:156:in `fork'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:156:in `serve'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:131:in `block in run'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:125:in `loop'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application.rb:125:in `run'
    from /Users/jspooner/.rvm/gems/ruby-2.2.0/gems/spring-1.4.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/jspooner/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/jspooner/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'2.2.0 :002 > 

Safari cannot download this file

Hi,

I make my pass. It's work fine, and I can download it from my web browser. And the content of the pass is OK, manifest, signature, json... . But on IOS 6 Beta 3, Safari say Download Failed. Nothing in the console ...

Any idea ?

My json :

'{
"passTypeIdentifier": "pass.xxxx.yyyy",
"formatVersion": 1,
"organizationName": "Flight Express",
"serialNumber": "123456",
"teamIdentifier": "SAB5MVXXXX",
"backgroundColor": "rgb(107,156,196)",
"logoText": "Flight info",
"description": "Demo pass",
"boardingPass": {
"primaryFields": [
{
"key" : "origin",
"label" : "San Francisco",
"value" : "SFO"
},
{
"key" : "destination",
"label" : "London",
"value" : "LHR"
}
],
"secondaryFields": [
{
"key": "gate",
"label": "Gate",
"value": "F12"
},
{
"key": "date",
"label": "Departure date",
"value": "07/11/2012 10:22"
}

    ],
    "backFields": [
        {
            "key": "passenger-name",
            "label": "Passenger",
            "value": "John Appleseed"
        }
    ],
    "transitType" : "PKTransitTypeAir"
},
"barcode": {
    "format": "PKBarcodeFormatQR",
    "message": "Flight-GateF12-ID6643679AH7B",
    "messageEncoding": "iso-8859-1"
}

}'

I use ruby 1.9.3 and rails 3.2.6

stream vs temp

Pardon the newb question, but could you detail differences between your tempfile implementaiton vs stream and any impacts to the user experience?

Thanks

S

No method error on Heroku.

Hi,

I made a simple Sinatra app that uses this Gem. It runs fine on localhost, but when I deploy to Heroku I get the error NoMethodError - undefined method 'write_buffer' for Zip::ZipOutputStream:Class: which is being raised by the line /app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:122:in outputZip.

Any idea what the cause of this could be?

I posted on StackOverflow with the same problem, more detailed description here

Signature error unter iOS 7

I'm seeing this error when I try to download and open a pkpass under iOS 7

Invalid data error reading pass pass.com.domain.discount/2500000.
The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
Error adding pass The pass cannot be read because it isn’t valid.

However ,the passTypeIdentifier and teamIdentifier seem to be correct since everything works fine under iOS 6 and even Safari from Mavericks.

As far as I can tell, the only difference in the signing process with iOS 7 is that the signature needs to contain a signing date.

Is there a step missing to make this work on a device?

Hi.

I can see the passbook on a Mac when visiting the URL, but when I try to send it to my phone or view the exact same URL on the phone it ays "Safari cannot download this file"?

Am I missing a configuration? I have all the assets and information (which properly display on a browser)

screen shot 2014-02-15 at 13 41 34

Thanks!

Can't open .pkpass file

We've been using this gem for a few years, but suddenly we're unable to open generated .pkpass files and all we've done is generated a new Pass Type certificate from Apple. Has anyone else had any issues lately?

config/initializers/passbook.rb:9:in `block in <top (required)>': undefined method `p12_cert=' for Passbook:Module (NoMethodError)

Hello All,

I followed below steps:-

  1. Added gem in Gemfile and installed it.
  2. rails g passbook:config
  3. Passbook.configure do |passbook|
    passbook.wwdc_cert = Rails.root.join('my.pem')
    passbook.p12_certificate = Rails.root.join('my.p12')
    passbook.p12_password = 'my_password'
    end

Once I start server then facing below error:-

config/initializers/passbook.rb:9:in block in <top (required)>': undefined methodp12_cert=' for Passbook:Module (NoMethodError)

Thanks! in advance.

Problems with JRuby?

I hit problems using this Gem with latest JRuby 9.1.8.0 and latest JRuby-OpenSSL.

This monkey-patch may be useful - it addresses a bug in JRuby-OpenSSL (by explicitly passing pk7.data as a second argument to the write_smime method), as well as problems with str_debut and str_end being in a slightly different format in the JRuby output.

Hope its useful to someone :)

module Passbook
  class Signer

    # this works around a bug in JRuby-OpenSSL related to writing of SMIME,
    # as well as discrepancies in the SMIME output compared to what the 
    # passbook gem expects by default.
    
    def sign(data)
      wwdc  = OpenSSL::X509::Certificate.new File.read(wwdc_cert)
      pk7   = OpenSSL::PKCS7.sign key_hash[:cert], key_hash[:key], data.to_s, [wwdc], OpenSSL::PKCS7::BINARY | OpenSSL::PKCS7::DETACHED
      data  = OpenSSL::PKCS7.write_smime pk7, pk7.data

      str_debut = "filename=smime.p7s"
      data      = data[data.index(str_debut)+str_debut.length..data.length-1]
      str_end   = "\n------"
      data      = data[0..data.index(str_end)-1]

      Base64.decode64(data)
    end
  end
end

PKCS12_parse: unsupported error with Ruby 3.2

Ruby 3.2 includes OpenSSL 3. This causes issues signed Passbook passes using a p12 archive.

The fix is to extract the certificate and private key from your p12 file and pass those individually to the Passbook gem.

Passbook.configure do |passbook|
  passbook.wwdc_cert = Rails.root.join('config/apple/wwdr.pem')


  # no longer works in Ruby 3.2 / OpenSSL 3
  # passbook.p12_certificate = Rails.root.join('config/apple/whatever.p12')
  # passbook.p12_password = ''

  # this works in Ruby 3.2
  passbook.p12_certificate = Rails.root.join('config/apple/whatever.crt')
  passbook.p12_key = Rails.root.join('config/apple/whatever.key')
end

uninitialized constant Rack::PassbookRack (NameError)

Added config.middleware.use Rack::PassbookRack to application.rb and have gem 'passbook' in my gemfile. I have added all of my certs to the config file, and when I start the server I get the error message below.

/rails/test_project/config/application.rb:63:in class:Application': uninitialized constant Rack::PassbookRack (NameError)
from /rails/test_project/config/application.rb:13:in <module:TestProject>' from /rails/test_project/config/application.rb:12:in <top (required)>'
from /Users/jbadger/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.12/lib/rails/commands.rb:53:in require' from /Users/jbadger/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.12/lib/rails/commands.rb:53:in block in <top (required)>'
from /Users/jbadger/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.12/lib/rails/commands.rb:50:in tap' from /Users/jbadger/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.12/lib/rails/commands.rb:50:in <top (required)>'
from script/rails:6:in require' from script/rails:6:in

'`

sinatra with passbook has error....

in my rails web...
in Gemfile

gem 'passbook', :git => 'git://github.com/frozon/passbook.git'

and works well!

but sinatra... ( I'm beginner in sinatra app dev)

require 'passbook'
require 'active_support/json/encoding'

has error...

no such file to load -- passbook

How can I do fix it??? plz... help me...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.