pub struct ChatIdentity { /* private fields */ }Expand description
The chat identity: an ed25519 keypair whose public key is the stable chat id. This is separate from the Nym transport identity.
Implementations§
Source§impl ChatIdentity
impl ChatIdentity
Sourcepub fn from_secret_bytes(bytes: [u8; 32]) -> Self
pub fn from_secret_bytes(bytes: [u8; 32]) -> Self
Restore an identity from raw ed25519 secret bytes.
The bytes are the encryption key material: never log them or store them unencrypted.
Sourcepub fn from_secret_hex(value: &str) -> Result<Self>
pub fn from_secret_hex(value: &str) -> Result<Self>
Restore an identity from a 32-byte hex secret.
Sourcepub fn secret_bytes(&self) -> [u8; 32]
pub fn secret_bytes(&self) -> [u8; 32]
Secret serialization. Callers must encrypt it at rest.
Sourcepub fn secret_hex(&self) -> String
pub fn secret_hex(&self) -> String
Secret serialization as lowercase hex. Callers must encrypt it at rest.
Sourcepub fn public_bytes(&self) -> [u8; 32]
pub fn public_bytes(&self) -> [u8; 32]
The ed25519 public key bytes, which are also the stable chat id.
Sourcepub fn public_hex(&self) -> String
pub fn public_hex(&self) -> String
The ed25519 public key as lowercase hex.
Sourcepub fn sign_hex(&self, message: &[u8]) -> String
pub fn sign_hex(&self, message: &[u8]) -> String
Sign a message with this identity’s ed25519 key, returning hex.
Sourcepub fn verify_hex(
public_hex: &str,
message: &[u8],
signature_hex: &str,
) -> Result<()>
pub fn verify_hex( public_hex: &str, message: &[u8], signature_hex: &str, ) -> Result<()>
Verify a hex-encoded ed25519 signature against a hex public key.
Uses strict verification, so non-canonical signatures are rejected.
Trait Implementations§
Source§impl Clone for ChatIdentity
impl Clone for ChatIdentity
Auto Trait Implementations§
impl Freeze for ChatIdentity
impl RefUnwindSafe for ChatIdentity
impl Send for ChatIdentity
impl Sync for ChatIdentity
impl Unpin for ChatIdentity
impl UnsafeUnpin for ChatIdentity
impl UnwindSafe for ChatIdentity
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