Spark Address
A minimal, no-std-compatible Rust library for encoding and decoding Spark Bech32m addresses.
- 100 % safe Rust
- Works in
no_std+allocenvironments - Optional secp256k1 public-key validation
Quick start
Add the crate to your Cargo.toml:
= "0.1"
Enable optional features if you need them:
= { = "0.1", = false, = ["validate-secp256k1"] }
Example
use ;
Features
| Feature | Default | Description |
|---|---|---|
std |
✓ | Use the Rust standard library. Disable it for #![no_std] targets. |
validate-secp256k1 |
Verify that the supplied public key is a valid compressed secp256k1 key (uses the secp256k1 crate). |
The crate has no transitive dependencies beyond bech32 and hex (plus secp256k1 when validation is enabled).
Address format
A Spark address is a standard Bech32m string consisting of:
- A human-readable part (HRP) identifying the network:
sp,spt,sps,sprt, orspl. - A tiny protobuf-like payload containing a single field (tag
0x0a) that wraps a 33-byte compressed secp256k1 public key.
For full details see the implementation in src/lib.rs.
License
Licensed under either of
- Apache License, Version 2.0, or
- MIT license
at your option.