pub struct UserKeypair { /* private fields */ }Expand description
Ed25519 keypair used for Store identities and derived device signers. The same seed can derive an X25519 keypair for key wrapping.
A Store identity authorizes membership and device registration. Each registration derives a device signing key from that identity and its Store root and registration origin; the identity and device signer are distinct protocol roles.
Implementations§
Source§impl UserKeypair
impl UserKeypair
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a new random Ed25519 keypair. The unmanaged primitive behind every identity-establishing act — creating, joining, or restoring a store; also lets host code (and its tests) mint an identity directly.
Sourcepub fn from_signing_key_bytes(signing_key: &[u8; 64]) -> Result<Self, KeyError>
pub fn from_signing_key_bytes(signing_key: &[u8; 64]) -> Result<Self, KeyError>
Reconstruct a keypair from its 64-byte Ed25519 signing key (seed + public),
deriving the public key from it and validating that the bytes are a real
keypair. This is the single place stored signing-key bytes become a
UserKeypair, so a torn or corrupt signing key fails at the persistence
boundary.
pub fn public_key(&self) -> [u8; 32]
pub fn to_keypair_bytes(&self) -> [u8; 64]
pub fn derive_signing_key(&self, domain: &[u8], context: &[u8]) -> Self
Sourcepub fn sign(&self, message: &[u8]) -> [u8; 64]
pub fn sign(&self, message: &[u8]) -> [u8; 64]
Sign a message, returning a 64-byte detached signature.
Sourcepub fn to_x25519_secret_key(&self) -> [u8; 32]
pub fn to_x25519_secret_key(&self) -> [u8; 32]
Derive the X25519 secret key from this Ed25519 signing key.
Sourcepub fn to_x25519_public_key(&self) -> [u8; 32]
pub fn to_x25519_public_key(&self) -> [u8; 32]
Derive the X25519 public key from this Ed25519 public key.
Trait Implementations§
Source§impl Clone for UserKeypair
impl Clone for UserKeypair
Source§fn clone(&self) -> UserKeypair
fn clone(&self) -> UserKeypair
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more