Skip to main content

assertion_key

Function assertion_key 

Source
pub fn assertion_key(
    document: &Value,
    did: &str,
    verification_method: &str,
    algorithm: &str,
) -> Result<Vec<u8>>
Expand description

The raw public key a proof names, when document lets did use it for assertions. Every rule must hold, or the key is refused:

  • the document’s id is exactly did;
  • verification_method is did plus a fragment (or just the fragment), and exactly one method in the document has that id (ids written relative to the document, “#key-1”, count);
  • the method’s controller is did;
  • the method is listed in assertionMethod, by reference (absolute or relative) or embedded there;
  • the method carries one kind of key material, of the right kind: Multikey or Ed25519VerificationKey2020 with publicKeyMultibase, or JsonWebKey2020 / JsonWebKey (or the earlier Ed25519VerificationKey2020) with a public Ed25519 publicKeyJwk meant for signatures;
  • the key is a well-formed algorithm key (ED25519, MLDSA44 or SLHDSA128), decoded strictly.