5 releases (3 breaking)

new 0.4.0 Mar 17, 2025
0.3.0 Mar 17, 2025
0.2.0 Feb 20, 2025
0.1.1 Jul 28, 2024
0.1.0 Jul 28, 2024

#248 in Magic Beans

Download history 4/week @ 2024-12-09 13/week @ 2025-02-03 171/week @ 2025-02-17 121/week @ 2025-02-24 196/week @ 2025-03-03 163/week @ 2025-03-10

651 downloads per month

Apache-2.0

35KB
537 lines

BIP329

Crate Info Apache-2.0 Licensed CI Status Docs

A library for working with BIP329 labels.

  • The main data structure is the Labels struct, which is a list of Label structs.
  • The Label enum containing all the different types of labels.
  • The Labels struct can be imported/exported to/from a JSONL file.
  • Supports encryption and decryption using the encryption module.
  • Supports the uniffi feature, for easy integration with other languages.

Example Import:

use bip329::Labels;

let labels = Labels::try_from_file("tests/data/labels.jsonl").unwrap();

Example Export:

use bip329::Labels;

// Create a Labels struct
let labels = Labels::try_from_file("tests/data/labels.jsonl").unwrap();

// Create a JSONL string
let jsonl = labels.export().unwrap();

Example encryption:

use bip329::{Labels, encryption::EncryptedLabels};

let labels = Labels::try_from_file("tests/data/labels.jsonl").unwrap();
let encrypted = EncryptedLabels::encrypt(&labels, "passphrase").unwrap();

let encrypted = EncryptedLabels::read_from_file("tests/data/encrypted_labels.age").unwrap();
let decrypted = encrypted.decrypt("passphrase").unwrap();
assert_eq!(labels, decrypted);

Dependencies

~8–17MB
~192K SLoC