pub struct VerificationMethod {
pub id: String,
pub typ: String,
pub controller: String,
pub public_key_jwk: Option<Map<String, Value>>,
pub public_key_multibase: Option<String>,
}Expand description
A verification method entry in a DID Document.
Per W3C DID Core §5.2, a verification method has an id, type,
controller, and one public key representation. The most common types are:
JsonWebKey2020+publicKeyJwkEd25519VerificationKey2020+publicKeyMultibase
Fields§
§id: StringDID URL identifying this verification method (e.g. did:ndn:…#key-0).
typ: StringVerification method type.
Common values:
"JsonWebKey2020"— public key as JWK"Ed25519VerificationKey2020"— Ed25519 as multibase"X25519KeyAgreementKey2020"— X25519 for ECDH key agreement
controller: StringDID of the entity that controls this key.
public_key_jwk: Option<Map<String, Value>>Public key as a JSON Web Key (for JsonWebKey2020 type).
public_key_multibase: Option<String>Public key as a multibase-encoded string (for Ed25519VerificationKey2020
and X25519KeyAgreementKey2020 types). The leading character encodes the
base: z = base58btc.
Implementations§
Source§impl VerificationMethod
impl VerificationMethod
Sourcepub fn ed25519_jwk(
id: impl Into<String>,
controller: impl Into<String>,
key_bytes: &[u8],
) -> Self
pub fn ed25519_jwk( id: impl Into<String>, controller: impl Into<String>, key_bytes: &[u8], ) -> Self
Build a JsonWebKey2020 verification method from raw Ed25519 public key bytes.
Sourcepub fn x25519_jwk(
id: impl Into<String>,
controller: impl Into<String>,
key_bytes: &[u8],
) -> Self
pub fn x25519_jwk( id: impl Into<String>, controller: impl Into<String>, key_bytes: &[u8], ) -> Self
Build a X25519KeyAgreementKey2020 verification method from raw X25519 key bytes.
Sourcepub fn ed25519_key_bytes(&self) -> Option<[u8; 32]>
pub fn ed25519_key_bytes(&self) -> Option<[u8; 32]>
Extract the raw Ed25519 public key bytes from a JsonWebKey2020 VM.
Sourcepub fn x25519_key_bytes(&self) -> Option<[u8; 32]>
pub fn x25519_key_bytes(&self) -> Option<[u8; 32]>
Extract the raw X25519 public key bytes from a JsonWebKey2020 VM.
Trait Implementations§
Source§impl Clone for VerificationMethod
impl Clone for VerificationMethod
Source§fn clone(&self) -> VerificationMethod
fn clone(&self) -> VerificationMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more