Skip to main content
Version: 1.4

Class: VerificationMethod

identity_wasm.VerificationMethod

A DID Document Verification Method.

Table of contents

Constructors

Methods

Constructors

constructor

new VerificationMethod(id, controller, type_, data)

Create a custom VerificationMethod.

Parameters

NameType
idDIDUrl
controllerCoreDID
type_MethodType
dataMethodData

Methods

toJSON

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object

toJSON(): any

Serializes this to a JSON object.

Returns

any


toString

toString(): string

Return stringified version of self.

Returns

string


newFromJwk

Static newFromJwk(did, key, fragment?): VerificationMethod

Creates a new VerificationMethod from the given did and Jwk. If fragment is not given the kid value of the given key will be used, if present, otherwise an error is returned.

Recommendations

The following recommendations are essentially taken from the publicKeyJwk description from the DID specification:

  • It is recommended that verification methods that use Jwks to represent their public keys use the value of kid as their fragment identifier. This is done automatically if None is passed in as the fragment.
  • It is recommended that Jwk kid values are set to the public key fingerprint.

Parameters

NameType
didIToCoreDID | CoreDID
keyJwk
fragment?string

Returns

VerificationMethod


id

id(): DIDUrl

Returns a copy of the DIDUrl of the VerificationMethod's id.

Returns

DIDUrl


setId

setId(id): void

Sets the id of the VerificationMethod.

Parameters

NameType
idDIDUrl

Returns

void


controller

controller(): CoreDID

Returns a copy of the controller DID of the VerificationMethod.

Returns

CoreDID


setController

setController(did): void

Sets the controller DID of the VerificationMethod object.

Parameters

NameType
didCoreDID

Returns

void


type

type(): MethodType

Returns a copy of the VerificationMethod type.

Returns

MethodType


setType

setType(type_): void

Sets the VerificationMethod type.

Parameters

NameType
type_MethodType

Returns

void


data

data(): MethodData

Returns a copy of the VerificationMethod public key data.

Returns

MethodData


setData

setData(data): void

Sets VerificationMethod public key data.

Parameters

NameType
dataMethodData

Returns

void


properties

properties(): Map\<string, any>

Get custom properties of the Verification Method.

Returns

Map\<string, any>


setPropertyUnchecked

setPropertyUnchecked(key, value): void

Adds a custom property to the Verification Method. If the value is set to null, the custom property will be removed.

WARNING

This method can overwrite existing properties like id and result in an invalid Verification Method.

Parameters

NameType
keystring
valueany

Returns

void


fromJSON

Static fromJSON(json): VerificationMethod

Deserializes an instance from a JSON object.

Parameters

NameType
jsonany

Returns

VerificationMethod


clone

clone(): VerificationMethod

Deep clones the object.

Returns

VerificationMethod