Git Product home page Git Product logo

wallet-pass's Introduction

wallet-pass

Latest version

Build and sign passes for apple wallet

Sign an exisiting pass

cargo build --release --features cli --bin signpass

./target/release/signpass --help

Create a custom pass

use std::path::Path;
use wallet_pass::{
    template::{Details, Field, Barcode, BarcodeFormat},
    Pass,
};

fn main() {
    // Load pass template
    let mut pass = Pass::from_path(Path::new("./StoreCard.pass")).unwrap();

    // Set general attributes
    pass.pass_type_identifier("pass.com.store.generic");
    pass.team_identifier("ASDF1234ASDF");

    // Set user specific attributes
    pass.serial_number("1234567890");
    pass.authentication_token("sda8f6ffDFS798SFDfsfSdf");

    pass.barcode(Barcode::new(BarcodeFormat::PkBarcodeFormatQr, "QR Code", "iso-8859-1"));

    let mut store_card = Details::new();

    let mut field = Field::new_f64("balance", 13.37);
    field.label("balance");
    field.currency_code("EUR");
    store_card.add_primary_field(field);

    let mut field = Field::new_string("account_name", "Max Mustermann");
    field.label("account_name");
    store_card.add_secondary_field(field);

    pass.store_card(store_card);

    // Sign, comprass and save pass
    pass.export_to_file(
        Path::new("Certificates.p12"),
        "Certificates Password",
        Path::new("Apple Worldwide Developer Relations Certification Authority.pem"),
        Path::new("./StoreCard.pkpass"),
    )
    .unwrap();
}

wallet-pass's People

Contributors

pixix4 avatar joepdejong 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.