Expand description
Constellation Metagraph SDK for Rust
A toolkit for signing and verifying data on Constellation Network metagraphs.
§Features
- ECDSA secp256k1 signing — industry-standard elliptic curve signatures
- RFC 8785 canonicalization — deterministic JSON serialization
- Cross-language compatibility — interoperable with TypeScript, Python, Go implementations
- Multi-signature support — create and verify objects signed by multiple parties
- Optional secp256r1 (P-256) — TPM-native curve, behind the
r1cargo feature
§Quick Start
use constellation_sdk::{
wallet::generate_key_pair,
signed_object::create_signed_object,
verify::verify,
};
use serde_json::json;
let key_pair = generate_key_pair();
let data = json!({"action": "transfer", "amount": 100});
let signed = create_signed_object(&data, &key_pair.private_key, false).unwrap();
let result = verify(&signed, false);
assert!(result.is_valid);§P-256 (R1) signing
Enable the r1 feature to access the parallel crate::r1 namespace
mirroring the K1 API:
[dependencies]
constellation-metagraph-sdk = { version = "0.2", features = ["r1"] }ⓘ
use constellation_sdk::r1::wallet::generate_key_pair;
use constellation_sdk::r1::sign::sign_hash;
let kp = generate_key_pair();
let sig = sign_hash(&"00".repeat(32), &kp.private_key)?;Re-exports§
pub use types::Hash;pub use types::KeyPair;pub use types::Result;pub use types::SdkError;pub use types::SignatureProof;pub use types::Signed;pub use types::SigningOptions;pub use types::SigningScheme;pub use types::VerificationResult;pub use types::ALGORITHM;pub use types::ALGORITHM_R1;pub use types::CONSTELLATION_PREFIX;pub use binary::encode_data_update;pub use binary::to_bytes;pub use canonicalize::canonicalize;pub use canonicalize::canonicalize_bytes;pub use codec::decode_data_update;pub use hash::compute_digest;pub use hash::hash_bytes;pub use hash::hash_data;pub use sign::sign;pub use sign::sign_data_update;pub use sign::sign_hash;pub use signed_object::add_signature;pub use signed_object::batch_sign;pub use signed_object::create_signed_object;pub use verify::verify;pub use verify::verify_hash;pub use verify::verify_signature;pub use wallet::generate_key_pair;pub use wallet::get_address;pub use wallet::get_public_key_hex;pub use wallet::get_public_key_id;pub use wallet::is_valid_private_key;pub use wallet::is_valid_public_key;pub use wallet::key_pair_from_private_key;pub use currency_transaction::create_currency_transaction;pub use currency_transaction::create_currency_transaction_batch;pub use currency_transaction::encode_currency_transaction;pub use currency_transaction::get_transaction_reference;pub use currency_transaction::hash_currency_transaction;pub use currency_transaction::is_valid_dag_address;pub use currency_transaction::sign_currency_transaction;pub use currency_transaction::token_to_units;pub use currency_transaction::units_to_token;pub use currency_transaction::verify_currency_transaction;pub use currency_types::CurrencyTransaction;pub use currency_types::CurrencyTransactionValue;pub use currency_types::TransactionReference;pub use currency_types::TransferParams;pub use currency_types::TOKEN_DECIMALS;
Modules§
- binary
- Binary Encoding
- canonicalize
- JSON Canonicalization (RFC 8785)
- codec
- Codec Utilities
- currency_
transaction - Currency transaction operations for metagraph token transfers
- currency_
types - hash
- Hashing Utilities
- network
- Network operations for Metagraph L1 node interactions
- r1
- secp256r1 (NIST P-256) signing module.
- sign
- Signing Functions
- signed_
object - High-Level Signed Object API
- types
- Core type definitions for the Constellation Metagraph SDK
- verify
- Signature Verification
- wallet
- Wallet and Key Management Utilities