pub struct KeyStore { /* private fields */ }Expand description
Stores master secret keys and derives app-scoped keys on demand.
Implementations§
Source§impl KeyStore
impl KeyStore
pub fn new(kv: Arc<dyn KvStore>) -> Self
Sourcepub async fn add_account(&self, secret_key: &Fr) -> Result<DerivedKeys, Error>
pub async fn add_account(&self, secret_key: &Fr) -> Result<DerivedKeys, Error>
Add an account by storing its secret key, indexed by the public keys hash.
Sourcepub async fn get_secret_key(&self, pk_hash: &Fr) -> Result<Option<Fr>, Error>
pub async fn get_secret_key(&self, pk_hash: &Fr) -> Result<Option<Fr>, Error>
Get the secret key for an account identified by its public keys hash.
Sourcepub async fn get_master_nullifier_hiding_key(
&self,
pk_hash: &Fr,
) -> Result<Option<GrumpkinScalar>, Error>
pub async fn get_master_nullifier_hiding_key( &self, pk_hash: &Fr, ) -> Result<Option<GrumpkinScalar>, Error>
Get the master nullifier hiding key for an account.
Sourcepub async fn get_master_incoming_viewing_secret_key(
&self,
pk_hash: &Fr,
) -> Result<Option<GrumpkinScalar>, Error>
pub async fn get_master_incoming_viewing_secret_key( &self, pk_hash: &Fr, ) -> Result<Option<GrumpkinScalar>, Error>
Get the master incoming viewing secret key for an account.
Sourcepub async fn get_master_outgoing_viewing_secret_key(
&self,
pk_hash: &Fr,
) -> Result<Option<GrumpkinScalar>, Error>
pub async fn get_master_outgoing_viewing_secret_key( &self, pk_hash: &Fr, ) -> Result<Option<GrumpkinScalar>, Error>
Get the master outgoing viewing secret key for an account.
Sourcepub async fn get_master_tagging_secret_key(
&self,
pk_hash: &Fr,
) -> Result<Option<GrumpkinScalar>, Error>
pub async fn get_master_tagging_secret_key( &self, pk_hash: &Fr, ) -> Result<Option<GrumpkinScalar>, Error>
Get the master tagging secret key for an account.
Sourcepub async fn get_public_keys(
&self,
pk_hash: &Fr,
) -> Result<Option<PublicKeys>, Error>
pub async fn get_public_keys( &self, pk_hash: &Fr, ) -> Result<Option<PublicKeys>, Error>
Get the public keys for an account.
Sourcepub async fn get_app_nullifier_hiding_key(
&self,
pk_hash: &Fr,
app: &AztecAddress,
) -> Result<Option<Fr>, Error>
pub async fn get_app_nullifier_hiding_key( &self, pk_hash: &Fr, app: &AztecAddress, ) -> Result<Option<Fr>, Error>
Compute the app-scoped nullifier hiding key.
Sourcepub async fn get_key_validation_request(
&self,
pk_m_hash: &Fr,
app: &AztecAddress,
) -> Result<Option<(Point, Fr)>, Error>
pub async fn get_key_validation_request( &self, pk_m_hash: &Fr, app: &AztecAddress, ) -> Result<Option<(Point, Fr)>, Error>
Find which account owns a given master public key hash, then return the corresponding public key point and app-siloed secret key.
Mirrors the TS getKeyValidationRequest(pkMHash, contractAddress).
Sourcepub async fn get_app_secret_key(
&self,
pk_hash: &Fr,
app: &AztecAddress,
key_type: KeyType,
) -> Result<Option<Fr>, Error>
pub async fn get_app_secret_key( &self, pk_hash: &Fr, app: &AztecAddress, key_type: KeyType, ) -> Result<Option<Fr>, Error>
Compute an app-scoped secret key for a given key type.
Sourcepub async fn get_app_ovsk(
&self,
pk_hash: &Fr,
app: &AztecAddress,
) -> Result<Option<GrumpkinScalar>, Error>
pub async fn get_app_ovsk( &self, pk_hash: &Fr, app: &AztecAddress, ) -> Result<Option<GrumpkinScalar>, Error>
Compute the app-scoped outgoing viewing secret key (returns GrumpkinScalar).
Auto Trait Implementations§
impl Freeze for KeyStore
impl !RefUnwindSafe for KeyStore
impl Send for KeyStore
impl Sync for KeyStore
impl Unpin 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more