Class: IotaDID
identity_wasm.IotaDID
A DID conforming to the IOTA DID method specification.
Typicalname
did
Table of contents
Constructors
Properties
Methods
- toJSON
- toString
- fromAliasId
- placeholder
- parse
- network
- tag
- toCoreDid
- scheme
- authority
- method
- methodId
- join
- toUrl
- toAliasId
- intoUrl
- fromJSON
- clone
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
| Name | Type |
|---|---|
bytes | Uint8Array |
network | string |
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
| Name | Type |
|---|---|
aliasId | string |
network | string |
Returns
placeholder
▸ Static placeholder(network): IotaDID
Creates a new placeholder IotaDID with the given network name.
E.g. did:iota:smr:0x0000000000000000000000000000000000000000000000000000000000000000.
Parameters
| Name | Type |
|---|---|
network | string |
Returns
parse
▸ Static parse(input): IotaDID
Parses a IotaDID from the input string.
Parameters
| Name | Type |
|---|---|
input | string |
Returns
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
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
| Name | Type |
|---|---|
segment | string |
Returns
toUrl
▸ toUrl(): DIDUrl
Clones the DID into a DIDUrl.
Returns
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
fromJSON
▸ Static fromJSON(json): IotaDID
Deserializes an instance from a JSON object.
Parameters
| Name | Type |
|---|---|
json | any |
Returns
clone
▸ clone(): IotaDID
Deep clones the object.