Giter Site home page Giter Site logo

pkpass-go's Introduction

pkpass-go

Summary

This package will generate a signed Apple Wallet Pass given your companion files, and your Apple issued Pass Type Certificate.

For instructions on how to obtain these certifcates for your account, please see this tutorial.

example coupon

Currently, we depend on openssl. When running in production, I recommend installing this in your Docker container.

Usage

// Open your certifcate via a file, string reader, etc.
cert, err := os.Open("Certificates.p12")
if err != nil {
    panic(err)
}
defer cert.Close()
    
// Pass the directory containing your companiion files, the password you need
// to open your certificate, and the actual certificate to the New func.
r, err := pkpass.New("Coupon.pass", "", cert)
if err != nil {
    panic(err)
}

// The reader contains your freshly minted .pkpass file, just write it out so you can
// use it.
f, err := os.Create("Coupon.pkpass")
if err != nil {
    t.Fatal(err)
}
defer f.Close()

// Copy the reader into an actual file so that you can open it.
_, err = io.Copy(f, r)
if err != nil {
    panic(err)
}

Certificates

When you log into your Apple Developer account, you should create a Pass Type ID. This type id will be what goes into your pass.json file, and will be what the certificate will be attached to. You should name this using the reverse domain convention.

pass.com.example.mypass

Once you have created a Pass Type ID, click edit. Follow the instructions to create and download your certificate. Likely, your certificate will be placced into Keychain Access from there, you can export it, and use it with this package.

It is important that you update your pass.json file prior to creating the pass. You will need to substitute the passTypeIdentifier and teamIdentifier for their actual values.

License

Copyright © 2018 Trevor Hutto

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

pkpass-go's People

Stargazers

 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

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.