mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Started added some minor doc on keychain
This commit is contained in:
parent
45ca7cff79
commit
2a8456a9db
1 changed files with 16 additions and 2 deletions
|
@ -375,8 +375,11 @@ impl BlindSum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encapsulates a max 4-level deep BIP32 path, which is the
|
/// Encapsulates a max 4-level deep BIP32 path, which is the most we can
|
||||||
/// most we can currently fit into a rangeproof message
|
/// currently fit into a rangeproof message. The depth encodes how far the
|
||||||
|
/// derivation depths go and allows differentiating paths. As m/0, m/0/0
|
||||||
|
/// or m/0/0/0/0 result in different derivations, a path needs to encode
|
||||||
|
/// its maximum depth.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize)]
|
||||||
pub struct ExtKeychainPath {
|
pub struct ExtKeychainPath {
|
||||||
pub depth: u8,
|
pub depth: u8,
|
||||||
|
@ -446,10 +449,21 @@ pub struct ValueExtKeychainPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Keychain: Sync + Send + Clone {
|
pub trait Keychain: Sync + Send + Clone {
|
||||||
|
/// Generates a keychain from a raw binary seed (which has already been
|
||||||
|
/// decrypted if applicable).
|
||||||
fn from_seed(seed: &[u8]) -> Result<Self, Error>;
|
fn from_seed(seed: &[u8]) -> Result<Self, Error>;
|
||||||
|
|
||||||
|
/// Generates a keychain from a list of space-separated mnemonic words
|
||||||
fn from_mnemonic(word_list: &str, extension_word: &str) -> Result<Self, Error>;
|
fn from_mnemonic(word_list: &str, extension_word: &str) -> Result<Self, Error>;
|
||||||
|
|
||||||
|
/// Generates a keychain from a randomly generated seed. Mostly used for tests.
|
||||||
fn from_random_seed() -> Result<Self, Error>;
|
fn from_random_seed() -> Result<Self, Error>;
|
||||||
|
|
||||||
|
/// Root identifier for that keychain
|
||||||
fn root_key_id() -> Identifier;
|
fn root_key_id() -> Identifier;
|
||||||
|
|
||||||
|
/// Derives a key id from the depth of the keychain and the values at each
|
||||||
|
/// depth level. See `KeychainPath` for more information.
|
||||||
fn derive_key_id(depth: u8, d1: u32, d2: u32, d3: u32, d4: u32) -> Identifier;
|
fn derive_key_id(depth: u8, d1: u32, d2: u32, d3: u32, d4: u32) -> Identifier;
|
||||||
fn derive_key(&self, amount: u64, id: &Identifier) -> Result<SecretKey, Error>;
|
fn derive_key(&self, amount: u64, id: &Identifier) -> Result<SecretKey, Error>;
|
||||||
fn commit(&self, amount: u64, id: &Identifier) -> Result<Commitment, Error>;
|
fn commit(&self, amount: u64, id: &Identifier) -> Result<Commitment, Error>;
|
||||||
|
|
Loading…
Reference in a new issue