wallet_pass/lib.rs
1#![warn(missing_docs)]
2
3//! # wallet-pass
4//! ```no_run
5//! use std::path::Path;
6//! use wallet_pass::{
7//! template::{Details, Field, Barcode, BarcodeFormat},
8//! Pass,
9//! };
10//!
11//! // Load pass template
12//! let mut pass = Pass::from_path(Path::new("./StoreCard.pass")).unwrap();
13//!
14//! // Set general attributes
15//! pass.pass_type_identifier("pass.com.store.generic");
16//! pass.team_identifier("ASDF1234ASDF");
17//!
18//! // Set user specific attributes
19//! pass.serial_number("1234567890");
20//! pass.authentication_token("sda8f6ffDFS798SFDfsfSdf");
21//!
22//! pass.barcode(Barcode::new(BarcodeFormat::PkBarcodeFormatQr, "QR Code", "iso-8859-1"));
23//!
24//! let mut store_card = Details::new();
25//!
26//! let mut field = Field::new_f64("balance", 13.37);
27//! field.label("balance");
28//! field.currency_code("EUR");
29//! store_card.add_primary_field(field);
30//!
31//! let mut field = Field::new_string("account_name", "Max Mustermann");
32//! field.label("account_name");
33//! store_card.add_secondary_field(field);
34//!
35//! pass.store_card(store_card);
36//!
37//! // Sign, comprass and save pass
38//! pass.export_to_file(
39//! Path::new("Certificates.p12"),
40//! "Certificates Password",
41//! Path::new("Apple Worldwide Developer Relations Certification Authority.pem"),
42//! Path::new("./StoreCard.pkpass"),
43//! )
44//! .unwrap();
45//! ```
46
47#[cfg(feature = "cli")]
48extern crate clap;
49
50mod pass;
51pub use pass::Pass;
52
53/// Sign an package of passes
54pub mod sign;
55
56/// Json template of passes
57pub mod template;