pub struct MemberKeys { /* private fields */ }Expand description
A member’s Ed25519 signing pair and independent X25519 sealing pair (Appendix D). Both secrets erase on drop. Clone is needed by in-memory custody to keep its keys while returning an independently owned unlocked pair.
Implementations§
Source§impl MemberKeys
impl MemberKeys
Sourcepub const SECRET_LEN: usize = MEMBER_KEYS_LENGTH
pub const SECRET_LEN: usize = MEMBER_KEYS_LENGTH
The length of to_secret_bytes.
Sourcepub fn from_seed(seed: u8) -> MemberKeys
pub fn from_seed(seed: u8) -> MemberKeys
A pair whose signing and sealing seeds are both seed: public test
data, never a person’s keys.
Sourcepub fn generate() -> Result<MemberKeys, CryptoError>
pub fn generate() -> Result<MemberKeys, CryptoError>
Make both member key pairs using the operating system’s randomness.
Sourcepub fn public_keys(&self) -> MemberPublicKeys
pub fn public_keys(&self) -> MemberPublicKeys
The public pair admin entries bind to a stable member id (§10).
Sourcepub fn sign_object(&self, path: &str, digest: &ObjectDigest) -> Signature
pub fn sign_object(&self, path: &str, digest: &ObjectDigest) -> Signature
Sign the digest of every object byte before the signature (Appendix D.3).
Feed the prefix, length fields and sealed chunks to crate::ObjectHasher
in storage order. The signed message binds its domain, path and digest.
Panics if the storage path is empty.
A file’s content hash cannot stand in for an object’s digest.
use coven_crypto::{ContentHasher, MemberKeys};
let member = MemberKeys::generate().unwrap();
member.sign_object("10101010-1010-1010-1010-101010101010/seq/1", &ContentHasher::new().finish());Sourcepub fn sign_prefix(&self, path: &str, prefix: &[u8]) -> Signature
pub fn sign_prefix(&self, path: &str, prefix: &[u8]) -> Signature
Sign a snapshot’s exact kind, version and routing fields (D9). The prefix domain and path are bound separately from whole-object signing. Panics if the storage path is empty.
Sourcepub fn sign_write_header(
&self,
path: &str,
prefix: &[u8],
header: &[u8],
roots: &[[u8; 32]],
) -> Signature
pub fn sign_write_header( &self, path: &str, prefix: &[u8], header: &[u8], roots: &[[u8; 32]], ) -> Signature
Sign a write’s cleartext prefix, sealed header chunk and part roots (D9), separately from the whole-object signature. Panics if the storage path is empty.
Sourcepub fn to_secret_bytes(&self) -> SecretBytes
pub fn to_secret_bytes(&self) -> SecretBytes
Encode both private seeds for custody or the person’s restore code (§13.1).
Sourcepub fn from_secret_bytes(bytes: &[u8]) -> Result<MemberKeys, MaterialError>
pub fn from_secret_bytes(bytes: &[u8]) -> Result<MemberKeys, MaterialError>
Restore both pairs from custody or the person’s restore code (§13.1).
Sourcepub fn open_store_key(
&self,
path: &str,
prefix: &[u8],
sealed: &[u8],
) -> Result<StoreKey, CryptoError>
pub fn open_store_key( &self, path: &str, prefix: &[u8], sealed: &[u8], ) -> Result<StoreKey, CryptoError>
Open a store-key box, authenticating the exact path and opaque clear prefix. Format checks the recipient and opened identity; the caller checks the introduction commitment before accepting the candidate key. Panics if the storage path is empty.
Sourcepub fn open_circle_key(
&self,
path: &str,
prefix: &[u8],
sealed: &[u8],
) -> Result<CircleKey, CryptoError>
pub fn open_circle_key( &self, path: &str, prefix: &[u8], sealed: &[u8], ) -> Result<CircleKey, CryptoError>
Open a circle-key box, authenticating the exact path and opaque clear prefix. Format checks the recipient and opened identity; the caller checks the introduction commitment before accepting the candidate key. Panics if the storage path is empty.
Sourcepub fn open_own_circle_key(
&self,
binding: &[u8],
sealed: &[u8],
) -> Result<CircleKey, CryptoError>
pub fn open_own_circle_key( &self, binding: &[u8], sealed: &[u8], ) -> Result<CircleKey, CryptoError>
Open the copy of a circle key a joining request carries for its own
member, sealed by seal_own_circle_key with the same binding (D11).
It binds no slot path, so it opens wherever its bytes are found, and
only for the sealing key it was sealed to.
Sourcepub fn open_handover(
&self,
path: &str,
prefix: &[u8],
sealed: &[u8],
) -> Result<Zeroizing<Vec<u8>>, CryptoError>
pub fn open_handover( &self, path: &str, prefix: &[u8], sealed: &[u8], ) -> Result<Zeroizing<Vec<u8>>, CryptoError>
Open a pairing’s handover: the ephemeral key, nonce, ciphertext and tag
seal_handover returned, at the exact path and clear prefix it was
sealed for, with the private half of the sealing key it was sealed to
(D11). The plaintext is erased on drop.
Panics if the storage path is empty.
Trait Implementations§
Source§impl Clone for MemberKeys
impl Clone for MemberKeys
Source§fn clone(&self) -> MemberKeys
fn clone(&self) -> MemberKeys
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MemberKeys
impl RefUnwindSafe for MemberKeys
impl Send for MemberKeys
impl Sync for MemberKeys
impl Unpin for MemberKeys
impl UnsafeUnpin for MemberKeys
impl UnwindSafe for MemberKeys
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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