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
- DIDPeer
Create Keys - 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
- DIDPeer
Created Keys - DIDPeerCreatedKeys, contains information related to any keys that were created
- DIDPeer
Result - DIDPeer
Service - DID Service structure in abbreviated format
- DIDService
- DIDService structure, input into the DidPeerCreate structure
- DidPeer
Create - DidPeerCreate structure, input from JS into create_did_peer call Contains the required keys and optional services to create a new did:peer DID
- Peer
Service EndPoint Long - DID serviceEndPoint structure in long format
- Peer
Service EndPoint Short - DID serviceEndPoint structure in short format
Enums§
- DIDPeer
Error - DIDPeer
KeyType - Supported DID Peer Key Types (used to create a new did:peer: string)
- DIDPeer
Keys - 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
- Peer
Service EndPoint
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