Crates.io | passes |
lib.rs | passes |
version | 1.0.1 |
source | src |
created_at | 2024-02-29 02:57:51.255128 |
updated_at | 2024-03-01 07:04:19.651213 |
description | Rust library for generate Apple Wallet Passes for iOS, WatchOS, MacOS. |
homepage | |
repository | https://github.com/mvodya/passes-rs |
max_upload_size | |
id | 1157297 |
size | 125,096 |
A Rust library for generating PassKit passes, featuring:
.pkpass
files.pkpass
Documentation:
Add this to your Cargo.toml
:
[dependencies]
passes = "0.1.0"
For building simple pass:
// Creating pass
let pass = PassBuilder::new(PassConfig {
organization_name: "Test organization".into(),
description: "Super gentlememe pass".into(),
pass_type_identifier: "com.example.pass".into(),
team_identifier: "AA00AA0A0A".into(),
serial_number: "ABCDEFG1234567890".into(),
})
.grouping_identifier(String::from("com.example.pass.app"))
.logo_text("Test pass".into())
.build();
Creating package and generate .pkpass
file:
let mut package = Package::new(pass);
// Save package as .pkpass
let path = Path::new("test_pass.pkpass");
let file = match File::create(&path) {
Err(why) => panic!("couldn't create {}: {}", path.display(), why),
Ok(file) => file,
};
package.write(file).unwrap();
For more examples, see examples directory.
Passes is distributed under the terms of the MIT license. See LICENSE.