Skip to main content

MethodData

@iota/identity-wasm API documentation


Class: MethodData

Supported verification method data formats.

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


newBase58()​

static newBase58(data): MethodData

Creates a new MethodData variant with Base58-BTC encoded content.

Parameters​

data​

Uint8Array

Returns​

MethodData


newMultibase()​

static newMultibase(data): MethodData

Creates a new MethodData variant with Multibase-encoded content.

Parameters​

data​

Uint8Array

Returns​

MethodData


newJwk()​

static newJwk(key): MethodData

Creates a new MethodData variant consisting of the given key.

Errors​

An error is thrown if the given key contains any private components.

Parameters​

key​

Jwk

Returns​

MethodData


newCustom()​

static newCustom(name, data): MethodData

Creates a new custom MethodData.

Parameters​

name​

string

data​

any

Returns​

MethodData


tryCustom()​

tryCustom(): CustomMethodData

Returns the wrapped custom method data format is Custom.

Returns​

CustomMethodData


tryDecode()​

tryDecode(): Uint8Array

Returns a Uint8Array containing the decoded bytes of the MethodData.

This is generally a public key identified by a MethodData value.

Errors​

Decoding can fail if MethodData has invalid content or cannot be represented as a vector of bytes.

Returns​

Uint8Array


tryPublicKeyJwk()​

tryPublicKeyJwk(): Jwk

Returns the wrapped Jwk if the format is PublicKeyJwk.

Returns​

Jwk


fromJSON()​

static fromJSON(json): MethodData

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

MethodData


clone()​

clone(): MethodData

Deep clones the object.

Returns​

MethodData