pub struct DelegateeKey { /* private fields */ }Expand description
A verified Delegation and the delegatee’s private signing key.
Invariant: every non-test DelegateeKey constructed, deserialized, or parsed via FromStr
satisfies Did::from(delegatee_secret_key.address()) == delegation.delegatee_did() and carries
a cryptographically valid delegator signature over delegation.
Clone law: cloning a DelegateeKey duplicates the same in-memory signing and decryption
authority. The clone preserves the delegator DID, delegatee identity, and delegatee public
key; it does not mint, rotate, or narrow the capability.
Implementations§
Source§impl DelegateeKey
impl DelegateeKey
Sourcepub fn try_from_parts(
delegation: Delegation,
delegatee_secret_key: SecretKey,
) -> Result<DelegateeKey, Error>
pub fn try_from_parts( delegation: Delegation, delegatee_secret_key: SecretKey, ) -> Result<DelegateeKey, Error>
Construct a DelegateeKey after verifying both the private-key-to-delegation DID binding
and the delegator’s signature over delegation, without enforcing wall-clock expiry so
genuinely bound historical keys used solely for decryption can still be restored.
Sourcepub fn verify_binding(&self) -> Result<(), Error>
pub fn verify_binding(&self) -> Result<(), Error>
Verify that this key’s private scalar derives delegation.delegatee_did().
Sourcepub fn verify(&self) -> Result<(), Error>
pub fn verify(&self) -> Result<(), Error>
Verify private-key binding, delegator signature, and delegation validity window as of now.
Sourcepub fn verify_at(&self, at_ms: u128) -> Result<(), Error>
pub fn verify_at(&self, at_ms: u128) -> Result<(), Error>
Verify private-key binding, delegator signature, and delegation validity window at at_ms.
Sourcepub fn new_with_seckey(key: &SecretKey) -> Result<DelegateeKey, Error>
pub fn new_with_seckey(key: &SecretKey) -> Result<DelegateeKey, Error>
Generate a self-delegated key from an existing private key. Only use this for unit tests.
To protect account private keys in production, use DelegationBuilder instead.
Sourcepub fn new_with_seckey_at(
key: &SecretKey,
ttl_ms: u64,
ts_ms: u128,
) -> Result<DelegateeKey, Error>
pub fn new_with_seckey_at( key: &SecretKey, ttl_ms: u64, ts_ms: u128, ) -> Result<DelegateeKey, Error>
Mint a fresh DelegateeKey authorized by key for ttl_ms starting at ts_ms.
Sourcepub fn delegation(&self) -> Delegation
pub fn delegation(&self) -> Delegation
Clone the public delegation proof.
Sourcepub fn delegatee_public_key(&self) -> PublicKey<33>
pub fn delegatee_public_key(&self) -> PublicKey<33>
Return the secp256k1 delegatee public key used for encryption.
Sourcepub fn decrypt_elgamal_aead(
&self,
sealed: &AeadCiphertext,
aad: &[u8],
) -> Result<Vec<u8>, Error>
pub fn decrypt_elgamal_aead( &self, sealed: &AeadCiphertext, aad: &[u8], ) -> Result<Vec<u8>, Error>
Decrypt an ElGamal-AEAD envelope with this delegatee key.
Sourcepub fn diffie_hellman(
&self,
peer: &NonIdentityPoint<Secp256k1>,
) -> Zeroizing<[u8; 32]>
pub fn diffie_hellman( &self, peer: &NonIdentityPoint<Secp256k1>, ) -> Zeroizing<[u8; 32]>
The Diffie–Hellman shared secret x(P·d) of a peer element P and the delegatee secret
d, zeroized on drop.
Law: for every x ∈ Z_n^*, diffie_hellman(x·G) = (d·G)·x in its x-coordinate, so a
sender holding x and Self::delegatee_public_key derives the same secret. P ≠ O by
its type, and the secret scalar is only ever held in a zeroizing Z_n^* value.
Sourcepub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, Error>
pub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, Error>
Sign a message with this delegatee key.
Sourcepub fn delegator_did(&self) -> Did
pub fn delegator_did(&self) -> Did
Get the DID of the delegator.
Sourcepub fn delegator_verifier(&self) -> AccountVerifier
pub fn delegator_verifier(&self) -> AccountVerifier
Get the delegator account verifier from this delegation.
Trait Implementations§
Source§impl Clone for DelegateeKey
impl Clone for DelegateeKey
Source§fn clone(&self) -> DelegateeKey
fn clone(&self) -> DelegateeKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DelegateeKey
impl Debug for DelegateeKey
Source§impl<'de> Deserialize<'de> for DelegateeKey
impl<'de> Deserialize<'de> for DelegateeKey
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DelegateeKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DelegateeKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for DelegateeKey
Source§impl FromStr for DelegateeKey
impl FromStr for DelegateeKey
Source§impl PartialEq for DelegateeKey
impl PartialEq for DelegateeKey
Source§impl Serialize for DelegateeKey
impl Serialize for DelegateeKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for DelegateeKey
Source§impl TryFrom<UnverifiedDelegateeKey> for DelegateeKey
impl TryFrom<UnverifiedDelegateeKey> for DelegateeKey
Source§impl TurnCredentialSigner for DelegateeKey
impl TurnCredentialSigner for DelegateeKey
Source§fn turn_credentials(
&self,
server_pubkey: PublicKey<33>,
) -> Result<TurnCredentials, Error>
fn turn_credentials( &self, server_pubkey: PublicKey<33>, ) -> Result<TurnCredentials, Error>
TurnCredentials for server_pubkey.Source§fn sign_ice_servers(&self, ice_servers: &str) -> Result<String, Error>
fn sign_ice_servers(&self, ice_servers: &str) -> Result<String, Error>
turn:// and turns:// URLs carrying ?pubkey=<base58(server_pubkey)> in a
;-separated ICE server string with TurnCredentials signed by self.Auto Trait Implementations§
impl Forget for DelegateeKey
impl Freeze for DelegateeKey
impl Move for DelegateeKey
impl RefUnwindSafe for DelegateeKey
impl Send for DelegateeKey
impl Sync for DelegateeKey
impl Unpin for DelegateeKey
impl UnsafeUnpin for DelegateeKey
impl UnwindSafe for DelegateeKey
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.