Skip to main content
Version: 1.4

Class: IotaDID

identity_wasm.IotaDID

A DID conforming to the IOTA DID method specification.

Typicalname

did

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new IotaDID(bytes, network)

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

See also placeholder.

Parameters

NameType
bytesUint8Array
networkstring

Properties

DEFAULT_NETWORK

Static Readonly DEFAULT_NETWORK: string

The default Tangle network ("iota").


METHOD

Static Readonly METHOD: string

The IOTA DID method name ("iota").

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

toString(): string

Returns the DID as a string.

Returns

string


fromAliasId

Static fromAliasId(aliasId, network): IotaDID

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

Parameters

NameType
aliasIdstring
networkstring

Returns

IotaDID


placeholder

Static placeholder(network): IotaDID

Creates a new placeholder IotaDID with the given network name.

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

Parameters

NameType
networkstring

Returns

IotaDID


parse

Static parse(input): IotaDID

Parses a IotaDID from the input string.

Parameters

NameType
inputstring

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

NameType
segmentstring

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

NameType
jsonany

Returns

IotaDID


clone

clone(): IotaDID

Deep clones the object.

Returns

IotaDID