pub struct ClientId {
pub verification_key_bytes: VerificationKeyBytes,
pub pq_commitment_bytes: PQCommitmentBytes,
pub id: Id,
}Expand description
The stable identity of a single client (user account) on the network.
A ClientId binds together three pieces:
- an Ed25519
verification_key_bytes, the public half of the client’scrate::tools::types::SignatureKey, - a
pq_commitment_bytes— a 32-byte post-quantum commitment (Falcon + Dilithium concatenation) that future-proofs the identity against breakage of Ed25519, and - a derived 32-byte
crate::tools::types::Idwhich is the Blake3 hash of the other two fields concatenated.
Because the id is deterministically derived from the other two fields, tampering with
either half is detectable via ClientId::verify: the recomputed id will not match the
one carried on the struct. This is the identity anchor used wherever the protocol refers
to “who authored this” — e.g. on posts, RPC responses, and peer records.
Fields§
§verification_key_bytes: VerificationKeyBytes§pq_commitment_bytes: PQCommitmentBytes§id: IdImplementations§
Source§impl ClientId
impl ClientId
pub fn new( verification_key_bytes: VerificationKeyBytes, pq_commitment_bytes: PQCommitmentBytes, ) -> Result<Self>
pub fn verify(&self) -> Result<()>
pub fn id_from_parts( verification_key_bytes: &VerificationKeyBytes, pq_commitment_bytes: &PQCommitmentBytes, ) -> Result<Id>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ClientId
impl<'de> Deserialize<'de> for ClientId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ClientId
Auto Trait Implementations§
impl Freeze for ClientId
impl RefUnwindSafe for ClientId
impl Send for ClientId
impl Sync for ClientId
impl Unpin for ClientId
impl UnsafeUnpin for ClientId
impl UnwindSafe for ClientId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.