Skip to main content

DIDJwk

@iota/identity-wasm API documentation


Class: DIDJwk

did:jwk DID.

Constructors​

new DIDJwk()​

new DIDJwk(did): DIDJwk

Creates a new DIDJwk from a CoreDID.

Errors​

Throws an error if the given did is not a valid did:jwk DID.

Parameters​

did​

IToCoreDID | CoreDID

Returns​

DIDJwk

Methods​

parse()​

static parse(input): DIDJwk

Parses a DIDJwk from the given input.

Errors​

Throws an error if the input is not a valid DIDJwk.

Parameters​

input​

string

Returns​

DIDJwk


jwk()​

jwk(): Jwk

Returns the JSON WEB KEY (JWK) encoded inside this did:jwk.

Returns​

Jwk


scheme()​

scheme(): string

Returns the CoreDID scheme.

E.g.

  • "did:example:12345678" -> "did"
  • "did:iota:smr:12345678" -> "did"

Returns​

string


authority()​

authority(): string

Returns the CoreDID authority: the method name and method-id.

E.g.

  • "did:example:12345678" -> "example:12345678"
  • "did:iota:smr:12345678" -> "iota:smr:12345678"

Returns​

string


method()​

method(): string

Returns the CoreDID method name.

E.g.

  • "did:example:12345678" -> "example"
  • "did:iota:smr:12345678" -> "iota"

Returns​

string


methodId()​

methodId(): string

Returns the CoreDID method-specific ID.

E.g.

  • "did:example:12345678" -> "12345678"
  • "did:iota:smr:12345678" -> "smr:12345678"

Returns​

string


toString()​

toString(): string

Returns the CoreDID as a string.

Returns​

string


toJSON()​

toJSON(): any

Serializes this to a JSON object.

Returns​

any


fromJSON()​

static fromJSON(json): DIDJwk

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

DIDJwk


clone()​

clone(): DIDJwk

Deep clones the object.

Returns​

DIDJwk