DIDPeer4

fmgp.did.method.peer.DIDPeer4
See theDIDPeer4 companion trait
object DIDPeer4

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
DIDPeer4.type

Members list

Type members

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def calculateHash(initDoc: Obj): Array[Byte]
def calculateHash(encodeDocument: Multibase): Array[Byte]
def contextualize(decodedDocument: Obj, did: DID, alsoKnownAs: DID): Either[String, DIDDocument]

To “contextualize” a document:

To “contextualize” a document:

  • Take the decoded document
  • Add id at the root of the document and set it to the DID
  • Add alsoKnownAs at the root of the document and set it to a list, if not already present, and append the short form of the DID
  • For each verification method (declared in the verificationMethod section or embedded in a verification relationship like authentication): - If controller is not set, set controller to the DID

Attributes

def decodeDocument(multibase: Multibase): Either[String, Obj]
def encodeDocument(json: Obj): Multibase
    1. JSON stringify the object without whitespace
    1. Encode the string as utf-8 bytes
    1. Prefix the bytes with the multicodec prefix for json (varint 0x0200)
    1. Consider this value the hash

Attributes

    1. Take SHA2-256 digest of the encoded document (encode the bytes as utf-8)
    1. Prefix these bytes with the multihash prefix for SHA2-256 and the hash length (varint 0x12 for prefix, varint 0x20 for 32 bytes in length)
    1. Multibase encode the bytes as base58btc (base58 encode the value and prefix with a z)
    1. Consider this value the hash

Value parameters

hash

digest of the encoded document (encode the bytes as utf-8)

Attributes

def makeAgentLongForm(keySeq: Seq[PrivateKeyWithKid], initDoc: Obj): AgentDIDPeer

Value parameters

initDoc

that will create the DID

keySeq

MUST have relative references

Attributes

Returns

AgentDIDPeer for the long form of did:peer:4

def makeAgentShortForm(keySeq: Seq[PrivateKeyWithKid], initDoc: Obj): AgentDIDPeer

Value parameters

initDoc

that will create the DID

keySeq

MUST have relative references

Attributes

Returns

AgentDIDPeer for the short form of did:peer:4