Skip to main content

IdentityKeys

Struct IdentityKeys 

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

The runtime-free half of a huddle identity: the Ed25519 signing key, its derived 24-char fingerprint, and (on demand) the ML-KEM-768 keypair derived from the same seed.

huddle-core::identity::Identity wraps this and adds the libp2p PeerId/Keypair (which need the libp2p dependency), delegating every pure method here via Deref — so id.fingerprint(), id.sign(..), id.seed() etc. resolve to these implementations and existing call sites are unchanged.

Implementations§

Source§

impl IdentityKeys

Source

pub fn generate() -> Result<Self>

Source

pub fn from_secret_bytes(bytes: [u8; 32]) -> Result<Self>

Source

pub fn fingerprint(&self) -> &str

Source

pub fn secret_bytes(&self) -> [u8; 32]

Source

pub fn public_bytes(&self) -> [u8; 32]

Source

pub fn sign(&self, msg: &[u8]) -> [u8; 64]

Ed25519-sign msg with our identity key. Used by protocol envelopes (SignedRoomMessage) and signed invites so receivers can prove the sender’s identity at the application layer.

Source

pub fn pq_keypair(&self) -> PqKeypair

huddle 1.3: this identity’s ML-KEM-768 keypair, deterministically derived from the Ed25519 secret seed (see crate::crypto::pqc). Computed on demand — there is no extra key material on disk; the 32-byte Ed25519 seed is the sole root secret, so every pre-1.3 identity gains a post-quantum keypair for free with no migration.

Source

pub fn mlkem_public_bytes(&self) -> [u8; 1184]

huddle 1.3: our serialized ML-KEM-768 encapsulation (public) key, published to peers in the signed MemberAnnounce on Direct rooms. Stable across restarts.

Source

pub fn mldsa_public_bytes(&self) -> [u8; 1952]

huddle 2.0.6 (WS2-a): our serialized ML-DSA-65 verifying (public) key, published in signed announces so peers can pin it for hybrid post-quantum authentication. Deterministically derived from the Ed25519 seed (see crate::crypto::mldsa); stable across restarts, no storage.

Source

pub fn mldsa_sign(&self, msg: &[u8]) -> [u8; 3309]

huddle 2.0.6 (WS2-a): ML-DSA-65-sign msg with our identity’s deterministically-derived post-quantum authentication key. Used for the composite signature on identity/authority envelopes.

Source

pub fn seed(&self) -> Zeroizing<[u8; 32]>

huddle 2.0: export this identity’s 32-byte Ed25519 seed — the sole root secret from which the PeerId, the ML-KEM-768 keypair, and every DM key deterministically derive. Returned in a Zeroizing wrapper so the copy is scrubbed when the caller drops it. Rendered as a 24-word BIP39 phrase by crate::crypto::mnemonic::seed_to_phrase for backup / recovery; treat it as the crown jewel.

Source

pub fn from_seed(seed: Zeroizing<[u8; 32]>) -> Result<Self>

huddle 2.0: rebuild from a 32-byte Ed25519 seed recovered from a BIP39 phrase (crate::crypto::mnemonic::phrase_to_seed). The seed is the only input, so the restored keys are byte-for-byte the original.

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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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