Skip to main content

Signer

Struct Signer 

Source
pub struct Signer { /* private fields */ }
Expand description

One account’s branch of the keystore (kept as Signer for 0.2.15 callers).

Implementations§

Source§

impl Signer

Source

pub fn init( path: impl Into<PathBuf>, human: &HumanKey, ) -> Result<Self, SignerError>

Source

pub fn open(path: impl Into<PathBuf>) -> Self

Source

pub fn is_unlocked(&self) -> bool

Source

pub fn unlock(&mut self, human: &HumanKey) -> Result<(), SignerError>

Source

pub fn lock(&mut self)

Source

pub fn set_account(&mut self, account: &str) -> Result<(), SignerError>

Source

pub fn account(&self) -> Result<String, SignerError>

Source

pub fn register_node( &mut self, node: &str, human: &HumanKey, ) -> Result<(), SignerError>

Source

pub fn provision( &mut self, node: &str, provider: &str, session: &str, rights: BTreeSet<String>, human: Option<&HumanKey>, ) -> Result<Provisioned, SignerError>

New identity for a root session. Grants that need a human require the human key.

Source

pub fn provision_child( &mut self, parent_token: &str, node: &str, provider: &str, child_session: &str, rights: BTreeSet<String>, ) -> Result<Provisioned, SignerError>

Child session: NEW identity, grants ⊆ parent’s, parent must hold spawn_child.

Source

pub fn sign( &self, token: &str, op: &str, payload: &[u8], ) -> Result<Signature, SignerError>

Sign payload as the token’s own nick.

Source

pub fn delegate( &self, token: &str, transport: &str, ) -> Result<String, SignerError>

Attenuated copy of a session token for a consumer running inside hatchery: only the grants of transport (e.g. “m4a”) that the token already holds. The consumer can verify and use it but cannot widen it or mint siblings.

Source

pub fn sign_m4a_keyproof( &self, node: &str, token: &str, message: &[u8], ) -> Result<Signature, SignerError>

Sign an m4a key-proof statement (m4a-key-login-v1 / m4a-key-enroll-v1) with the token’s own session key, so the session’s m4a account is proven by the same key that never leaves the keystore. Any other message is refused: this cannot sign letters or arbitrary bytes. The session must live on node.

Source

pub fn m4a_vault_key( &self, node: &str, token: &str, ) -> Result<Zeroizing<[u8; 32]>, SignerError>

The 32-byte master key of this session’s m4a client vault (E2E device state, store keys), derived from the session’s keystore secret. Only the session’s own token on its own node gets it; another session’s vault cannot be opened with it.

Source

pub fn has_node(&self, node: &str) -> bool

Source

pub fn sign_from_node( &self, node: &str, token: &str, op: &str, payload: &[u8], ) -> Result<Signature, SignerError>

Source

pub fn session_on_node( &self, session: &str, node: &str, ) -> Result<(), SignerError>

Source

pub fn revoke_session(&mut self, session: &str) -> Result<(), SignerError>

Source

pub fn retire( &mut self, session: &str, human: &HumanKey, ) -> Result<(), SignerError>

Source

pub fn public_key_of(&self, session: &str) -> Result<[u8; 32], SignerError>

Source

pub fn parent_of(&self, session: &str) -> Result<Option<String>, SignerError>

Source

pub fn path(&self) -> &Path

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V