Crate did_peer

Source
Expand description

§DID Peer Method

The did-peer method is a DID method that is designed to be used for peer-to-peer communication. It is based on did:key which can be used for Verification (V) and Encryption (E) purposes. It also supports services (S) which can be used to define endpoints for communication.

Example:

let peer = DIDPeer;
match peer.resolve(DID::new::<str>("did:peer:2.Vabc...").unwrap()).await {
   Ok(res) => {
       println!("DID DOcument: {:#?}", res.document.into_document()),
   },
   Err(e) => {
     println!("Error: {:?}", e);
  }
}

Structs§

  • Structure to help with creating a new did:peer: string purpose: ENUM (DIDPeerKeys) - Verification or Encryption public_key_multibase: String - Optional: Multibase encoded public key (did:key:(.*)) If None, then auto-create and return the private key
  • DIDPeerCreatedKeys, contains information related to any keys that were created
  • DID Service structure in abbreviated format
  • DIDService structure, input into the DidPeerCreate structure
  • DidPeerCreate structure, input from JS into create_did_peer call Contains the required keys and optional services to create a new did:peer DID
  • DID serviceEndPoint structure in long format
  • DID serviceEndPoint structure in short format

Enums§

  • Supported DID Peer Key Types (used to create a new did:peer: string)
  • DID Peer Key Purpose (used to create a new did:peer: string) Verification: Keys are referenced in the authentication and assertionMethod fields Encryption: Keys are referenced in the keyAgreement field

Functions§

  • create_did_peer() wasm wrapper for DIDPeer::create_peer_did Input: reference to DidPeerCreate struct Returns: Error or String of the newly created did:peer DID
  • resolve_did_peer() resolves a DID Peer method DID to a full DID Document represented by a JS object Input: String of the DID Peer method DID (did:peer:2…) Returns: Error or JSON String of the resolved DID Document