pub enum DidKeyPubkey {
Ed25519([u8; 32]),
P256(Vec<u8>),
Secp256k1(Vec<u8>),
}Expand description
W3C did:key public-key payload.
Variants§
Ed25519([u8; 32])
32-byte raw Ed25519 public key (RFC 8032).
P256(Vec<u8>)
33-byte SEC1-compressed NIST P-256 public key.
Secp256k1(Vec<u8>)
33-byte SEC1-compressed secp256k1 public key.
Implementations§
Source§impl DidKeyPubkey
impl DidKeyPubkey
Sourcepub fn codec_name(&self) -> &'static str
pub fn codec_name(&self) -> &'static str
Human-readable name for diagnostics.
Sourcepub fn codec_code(&self) -> u64
pub fn codec_code(&self) -> u64
Multicodec integer code corresponding to this variant.
Sourcepub fn jws_alg(&self) -> &'static str
pub fn jws_alg(&self) -> &'static str
JWS alg value required for a signature produced by the paired
private key, per RFC 8037 (EdDSA) / RFC 7518 §3.4 (ES256 /
ES256K).
Sourcepub fn to_multicodec_bytes(&self) -> Vec<u8> ⓘ
pub fn to_multicodec_bytes(&self) -> Vec<u8> ⓘ
Multicodec payload: varint(codec) || key_bytes. Used by the
did:key encoder and by callers that want a raw identifier
(e.g. CBOR identity tokens).
Sourcepub fn from_multicodec_bytes(bytes: &[u8]) -> Result<Self, DidKeyError>
pub fn from_multicodec_bytes(bytes: &[u8]) -> Result<Self, DidKeyError>
Parse a multicodec payload into a DidKeyPubkey. Returns an
error for unknown codecs or length mismatches.
Trait Implementations§
Source§impl Clone for DidKeyPubkey
impl Clone for DidKeyPubkey
Source§fn clone(&self) -> DidKeyPubkey
fn clone(&self) -> DidKeyPubkey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DidKeyPubkey
impl Debug for DidKeyPubkey
Source§impl PartialEq for DidKeyPubkey
impl PartialEq for DidKeyPubkey
Source§fn eq(&self, other: &DidKeyPubkey) -> bool
fn eq(&self, other: &DidKeyPubkey) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for DidKeyPubkey
impl StructuralPartialEq for DidKeyPubkey
Auto Trait Implementations§
impl Freeze for DidKeyPubkey
impl RefUnwindSafe for DidKeyPubkey
impl Send for DidKeyPubkey
impl Sync for DidKeyPubkey
impl Unpin for DidKeyPubkey
impl UnsafeUnpin for DidKeyPubkey
impl UnwindSafe for DidKeyPubkey
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