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§

DIDPeer
DIDPeerCreateKeys
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
DIDPeerCreatedKeys, contains information related to any keys that were created
DIDPeerResult
DIDPeerService
DID Service structure in abbreviated format
DIDService
DIDService structure, input into the DidPeerCreate structure
DidPeerCreate
DidPeerCreate structure, input from JS into create_did_peer call Contains the required keys and optional services to create a new did:peer DID
PeerServiceEndPointLong
DID serviceEndPoint structure in long format
PeerServiceEndPointShort
DID serviceEndPoint structure in short format

Enums§

DIDPeerError
DIDPeerKeyType
Supported DID Peer Key Types (used to create a new did:peer: string)
DIDPeerKeys
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
PeerServiceEndPoint

Functions§

create_did_peer
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
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