writeLinkedAuth(id, controller, targetId, allowedOperations)

Feature

Generates an LinkedAuth instance a component of the did document.

Parameters

string authentication id, // did string + β€œ#” + unique id string controller, // did string string targetId, // did string + β€œ#” + unique id AllowedOperation[] allowedOperations // did string + β€œ#” + unique id

Return Value

LinkedAuth instance

const did = "did:mitum:0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca";
const id = did + "#linked1";
const targetId = "did:mitum:0x507487Ea8EaB3935b849a98428F1486d5CE054d7fca#auth1";
const contract = "0x99e749E6e00fc6BA3E965881589D185cc5B447d4fca";
const allowed = [
    Mitum.allowedOperation.currency.transfer(),
    Mitum.allowedOperation.authdid.updateDocument(contract),
];

const authentication = mitum.authdid.writeLinkedAuth(id, did, targetId, allowed);

console.log(authentication.toHintedObject());

//output1
{
  _hint: 'mitum-did-verification-method-v0.0.1',
  id: 'did:mitum:0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca#linked1',
  controller: 'did:mitum:0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca',
  type: 'LinkedVerificationMethod',
  targetId: 'did:mitum:0x507487Ea8EaB3935b849a98428F1486d5CE054d7fca#auth1',
  allowed: [
    { operation: 'mitum-currency-transfer-operation-v0.0.1' },
    {
      contract: '0x99e749E6e00fc6BA3E965881589D185cc5B447d4fca',
      operation: 'mitum-did-update-did-document-operation-v0.0.1'
    }
  ]
}

Last updated