Skip to main content

VerificationMethod

@iota/identity-wasm API documentation


Class: VerificationMethod

A DID Document Verification Method.

Constructors​

new VerificationMethod()​

new VerificationMethod(id, controller, type_, data): VerificationMethod

Create a custom VerificationMethod.

Parameters​

id​

DIDUrl

controller​

CoreDID

type_​

MethodType

data​

MethodData

Returns​

VerificationMethod

Methods​

toJSON()​

Call Signature​

toJSON(): Object

  • Return copy of self without private attributes.
Returns​

Object

Call Signature​

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​

did​

IToCoreDID | CoreDID

key​

Jwk

fragment?​

null | 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​

id​

DIDUrl

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​

did​

CoreDID

Returns​

void


type()​

type(): MethodType

Returns a copy of the VerificationMethod type.

Returns​

MethodType


setType()​

setType(type_): void

Sets the VerificationMethod type.

Parameters​

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​

data​

MethodData

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​

key​

string

value​

any

Returns​

void


fromJSON()​

static fromJSON(json): VerificationMethod

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

VerificationMethod


clone()​

clone(): VerificationMethod

Deep clones the object.

Returns​

VerificationMethod