Skip to main content

IotaDID

@iota/identity-wasm API documentation


Class: IotaDID

A DID conforming to the IOTA DID method specification.

Typicalname​

did

Constructors​

new IotaDID()​

new IotaDID(bytes, network): IotaDID

Constructs a new IotaDID from a byte representation of the tag and the given network name.

See also IotaDID.placeholder.

Parameters​

bytes​

Uint8Array

network​

string

Returns​

IotaDID

Properties​

METHOD​

readonly static METHOD: string

The IOTA DID method name ("iota").


DEFAULT_NETWORK​

readonly static DEFAULT_NETWORK: string

The default Tangle network ("iota").

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()​

Call Signature​

toString(): string

Return stringified version of self.

Returns​

string

Call Signature​

toString(): string

Returns the DID as a string.

Returns​

string


fromAliasId()​

static fromAliasId(objectId, network): IotaDID

Constructs a new IotaDID from a hex representation of an Alias Id and the given network name.

Parameters​

objectId​

string

network​

string

Returns​

IotaDID


placeholder()​

static placeholder(network): IotaDID

Creates a new placeholder IotaDID with the given network name.

E.g. did:iota:smr:0x0000000000000000000000000000000000000000000000000000000000000000.

Parameters​

network​

string

Returns​

IotaDID


parse()​

static parse(input): IotaDID

Parses a IotaDID from the input string.

Parameters​

input​

string

Returns​

IotaDID


network()​

network(): string

Returns the Tangle network name of the IotaDID.

Returns​

string


tag()​

tag(): string

Returns a copy of the unique tag of the IotaDID.

Returns​

string


toCoreDid()​

toCoreDid(): CoreDID

Returns the DID represented as a CoreDID.

Returns​

CoreDID


scheme()​

scheme(): string

Returns the DID scheme.

E.g.

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

Returns​

string


authority()​

authority(): string

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

E.g.

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

Returns​

string


method()​

method(): string

Returns the DID method name.

E.g.

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

Returns​

string


methodId()​

methodId(): string

Returns the DID method-specific ID.

E.g.

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

Returns​

string


join()​

join(segment): DIDUrl

Construct a new DIDUrl by joining with a relative DID Url string.

Parameters​

segment​

string

Returns​

DIDUrl


toUrl()​

toUrl(): DIDUrl

Clones the DID into a DIDUrl.

Returns​

DIDUrl


toAliasId()​

toAliasId(): string

Returns the hex-encoded AliasId with a '0x' prefix, from the DID tag.

Returns​

string


intoUrl()​

intoUrl(): DIDUrl

Converts the DID into a DIDUrl, consuming it.

Returns​

DIDUrl


fromJSON()​

static fromJSON(json): IotaDID

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

IotaDID


clone()​

clone(): IotaDID

Deep clones the object.

Returns​

IotaDID