#pass #apple #wallet #signpass

bin+lib wallet-pass

为Apple钱包构建和签名通行证

7个版本 (4个重大更新)

0.5.0 2024年8月6日
0.4.0 2023年10月5日
0.3.0 2022年1月21日
0.2.2 2022年1月21日
0.1.0 2021年8月1日

macOS和iOS API中排名第154

Download history 31/week @ 2024-04-22 25/week @ 2024-04-29 13/week @ 2024-05-06 21/week @ 2024-05-13 16/week @ 2024-05-20 30/week @ 2024-05-27 15/week @ 2024-06-03 15/week @ 2024-06-10 7/week @ 2024-06-17 18/week @ 2024-06-24 37/week @ 2024-07-15 12/week @ 2024-07-22 46/week @ 2024-07-29 139/week @ 2024-08-05

每月下载234

MIT许可证

89KB
1.5K SLoC

wallet-pass

Latest version

为Apple钱包构建和签名通行证

签名现有的通行证

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

./target/release/signpass --help

创建自定义通行证

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();
}

依赖

~9–18MB
~262K SLoC