pub struct Keystore { /* private fields */ }Implementations§
Source§impl Keystore
impl Keystore
pub fn new() -> Self
pub fn entries(&self) -> &[Entry]
Sourcepub fn add(&mut self, entry: Entry) -> Result<(), KeystoreError>
pub fn add(&mut self, entry: Entry) -> Result<(), KeystoreError>
秘密を足す。アカウントのラベルが正しくないか、すでにあるものと重なるなら足さない。
Sourcepub fn add_account(
&mut self,
entry: usize,
account: Account,
) -> Result<(), KeystoreError>
pub fn add_account( &mut self, entry: usize, account: Account, ) -> Result<(), KeystoreError>
すでにある秘密にアカウントを足す。
Sourcepub fn rename_account(
&mut self,
label: &str,
new_label: &str,
) -> Result<(), KeystoreError>
pub fn rename_account( &mut self, label: &str, new_label: &str, ) -> Result<(), KeystoreError>
アカウントのラベルを変える。
Sourcepub fn remove_account(
&mut self,
label: &str,
) -> Result<(usize, Account), KeystoreError>
pub fn remove_account( &mut self, label: &str, ) -> Result<(usize, Account), KeystoreError>
アカウントを外す。秘密は、アカウントがなくなっても残す。
Sourcepub fn remove_entry(&mut self, entry: usize) -> Result<Entry, KeystoreError>
pub fn remove_entry(&mut self, entry: usize) -> Result<Entry, KeystoreError>
秘密を、残っているアカウントごと消す。
Sourcepub fn private_key(
&self,
label: &str,
bip39_passphrase: &str,
) -> Result<(&Account, PrivateKey), KeystoreError>
pub fn private_key( &self, label: &str, bip39_passphrase: &str, ) -> Result<(&Account, PrivateKey), KeystoreError>
ラベルでアカウントを探し、その秘密鍵を求める。
ニーモニックのアカウントは、bip39_passphrase を BIP39 のパスフレーズにして導出する。
公式ウォレットと同じ鍵になるのは空のときだけで、それ以外は同じ番号でも別の鍵(隠しウォレット)になる。
秘密鍵のアカウントには関係しない。
Sourcepub fn fill_harvest_secrets<R: CryptoRng + ?Sized>(&mut self, rng: &mut R)
pub fn fill_harvest_secrets<R: CryptoRng + ?Sized>(&mut self, rng: &mut R)
ハーベストの秘密がない秘密に、新しく作って入れる。すでにあるものは変えない。
Sourcepub fn harvester_keys(
&self,
label: &str,
bip39_passphrase: &str,
rotation: u32,
) -> Result<Option<HarvesterKeys>, KeystoreError>
pub fn harvester_keys( &self, label: &str, bip39_passphrase: &str, rotation: u32, ) -> Result<Option<HarvesterKeys>, KeystoreError>
ラベルでアカウントを探し、そのハーベストの鍵を求める。
bip39_passphrase は Self::private_key と同じで、ニーモニックのアカウントでだけ使う。
rotation は作り直しの番号で、ふだんは 0。ハーベストの秘密がまだなければ None
Sourcepub fn from_text(text: &[u8]) -> Result<Self, KeystoreError>
pub fn from_text(text: &[u8]) -> Result<Self, KeystoreError>
開いた中身のテキストを読む。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Keystore
impl RefUnwindSafe for Keystore
impl Send for Keystore
impl Sync for Keystore
impl Unpin for Keystore
impl UnsafeUnpin for Keystore
impl UnwindSafe for Keystore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more