106 lines
5.0 KiB
Rust
106 lines
5.0 KiB
Rust
// file: ks-wallet/src/lib.rs
|
|
// version: 8
|
|
|
|
//! Wallet boundary for local key storage and transaction signing.
|
|
#![warn(missing_docs)]
|
|
#![deny(unreachable_pub)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
mod constants;
|
|
mod manager;
|
|
mod native;
|
|
mod password;
|
|
mod transfer;
|
|
mod unlocked;
|
|
mod wallet;
|
|
|
|
/// Native wallet file extension without the leading dot.
|
|
pub use self::constants::KSWALLET_FILE_EXTENSION;
|
|
/// Opaque reference to one identified native wallet file.
|
|
pub use self::manager::WalletFileHandle;
|
|
/// Multi-wallet manager rooted at one configured wallet directory.
|
|
pub use self::manager::WalletManager;
|
|
/// Explicit non-clonable password supplied to native wallet operations.
|
|
pub use self::password::WalletPassword;
|
|
/// Explicit secret import/export format supported by the wallet boundary.
|
|
pub use self::transfer::WalletTransferFormat;
|
|
/// Authenticated signing capability for one unlocked persistent wallet.
|
|
pub use self::unlocked::UnlockedWallet;
|
|
/// Solana keypair kept private inside the wallet boundary.
|
|
pub use self::wallet::TemporaryWallet;
|
|
/// Filesystem-backed store for legacy development and integration-test wallets.
|
|
pub use self::wallet::TemporaryWalletStore;
|
|
/// Validated non-secret wallet alias.
|
|
pub use self::wallet::WalletAlias;
|
|
/// Minimal non-secret identity of a wallet.
|
|
pub use self::wallet::WalletIdentity;
|
|
/// Whether a runtime wallet is temporary or persistent.
|
|
pub use self::wallet::WalletPersistence;
|
|
/// Non-secret wallet policy.
|
|
pub use self::wallet::WalletPolicy;
|
|
/// Backward-compatible name for a non-secret wallet identity.
|
|
pub use self::wallet::WalletSummary;
|
|
|
|
/// Encryption-key length required by XChaCha20-Poly1305.
|
|
pub(crate) use self::constants::KSWALLET_AEAD_KEY_LENGTH;
|
|
/// Version-one AEAD identifier for XChaCha20-Poly1305.
|
|
pub(crate) use self::constants::KSWALLET_AEAD_XCHACHA20_POLY1305;
|
|
/// Default Argon2id pass count for newly protected wallets.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_DEFAULT_ITERATIONS;
|
|
/// Default Argon2id memory cost for newly protected wallets.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_DEFAULT_MEMORY_KIB;
|
|
/// Default Argon2id parallelism for newly protected wallets.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_DEFAULT_PARALLELISM;
|
|
/// Maximum accepted Argon2id pass count.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MAX_ITERATIONS;
|
|
/// Maximum accepted Argon2id memory cost in KiB.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MAX_MEMORY_KIB;
|
|
/// Maximum accepted Argon2id lane count.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MAX_PARALLELISM;
|
|
/// Minimum accepted Argon2id pass count.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MIN_ITERATIONS;
|
|
/// Minimum accepted Argon2id memory cost in KiB.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MIN_MEMORY_KIB;
|
|
/// Minimum accepted Argon2id lane count.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_MIN_PARALLELISM;
|
|
/// Argon2 version identifier required by native format version one.
|
|
pub(crate) use self::constants::KSWALLET_ARGON2_VERSION;
|
|
/// Exact ciphertext length for a version-one protected keypair.
|
|
pub(crate) use self::constants::KSWALLET_CIPHERTEXT_LENGTH;
|
|
/// Fixed version-one header length before variable alias bytes.
|
|
pub(crate) use self::constants::KSWALLET_FIXED_HEADER_LENGTH;
|
|
/// Version-one flag value when no optional feature is enabled.
|
|
pub(crate) use self::constants::KSWALLET_FLAGS_NONE;
|
|
/// Native wallet format version.
|
|
pub(crate) use self::constants::KSWALLET_FORMAT_VERSION;
|
|
/// Version-one KDF identifier for Argon2id.
|
|
pub(crate) use self::constants::KSWALLET_KDF_ARGON2ID;
|
|
/// Native wallet format identification magic.
|
|
pub(crate) use self::constants::KSWALLET_MAGIC;
|
|
/// Maximum wallet alias length encoded by version one.
|
|
pub(crate) use self::constants::KSWALLET_MAX_ALIAS_LENGTH;
|
|
/// Maximum complete native wallet file length.
|
|
pub(crate) use self::constants::KSWALLET_MAX_FILE_LENGTH;
|
|
/// Minimum complete native wallet file length.
|
|
pub(crate) use self::constants::KSWALLET_MIN_FILE_LENGTH;
|
|
/// Nonce length used by XChaCha20-Poly1305.
|
|
pub(crate) use self::constants::KSWALLET_NONCE_LENGTH;
|
|
/// Salt length used by the version-one Argon2id profile.
|
|
pub(crate) use self::constants::KSWALLET_SALT_LENGTH;
|
|
/// Number of bytes stored by the standard Solana keypair JSON format.
|
|
pub(crate) use self::constants::SOLANA_KEYPAIR_LENGTH;
|
|
/// Canonical tracing target for this crate.
|
|
pub(crate) use self::constants::TRACING_TARGET;
|
|
/// Parsed version-one native wallet container.
|
|
pub(crate) use self::native::NativeWalletContainer;
|
|
/// Protects one exact keypair payload with the native password contract.
|
|
pub(crate) use self::native::protect_native_wallet_keypair;
|
|
/// Reads and strictly decodes one native wallet file.
|
|
pub(crate) use self::native::read_native_wallet_container;
|
|
/// Atomically replaces one native wallet after authenticated password rotation.
|
|
pub(crate) use self::native::replace_native_wallet_file_atomic;
|
|
/// Authenticates and decrypts one native wallet keypair.
|
|
pub(crate) use self::native::unlock_native_wallet_keypair;
|
|
/// Publishes one new native wallet atomically without overwrite.
|
|
pub(crate) use self::native::write_native_wallet_file_atomic;
|