Skip to main content
Version: 1.3

Class: CoreDID

identity_wasm.CoreDID

A method-agnostic Decentralized Identifier (DID).

Table of contents

Methods

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 CoreDID as a string.

Returns

string


parse

Static parse(input): CoreDID

Parses a CoreDID from the given input.

Errors

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

Parameters

NameType
inputstring

Returns

CoreDID


setMethodName

setMethodName(value): void

Set the method name of the CoreDID.

Parameters

NameType
valuestring

Returns

void


validMethodName

Static validMethodName(value): boolean

Validates whether a string is a valid DID method name.

Parameters

NameType
valuestring

Returns

boolean


setMethodId

setMethodId(value): void

Set the method-specific-id of the DID.

Parameters

NameType
valuestring

Returns

void


validMethodId

Static validMethodId(value): boolean

Validates whether a string is a valid DID method-id.

Parameters

NameType
valuestring

Returns

boolean


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


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 CoreDID into a DIDUrl.

Returns

DIDUrl


intoUrl

intoUrl(): DIDUrl

Converts the CoreDID into a DIDUrl, consuming it.

Returns

DIDUrl


fromJSON

Static fromJSON(json): CoreDID

Deserializes an instance from a JSON object.

Parameters

NameType
jsonany

Returns

CoreDID


clone

clone(): CoreDID

Deep clones the object.

Returns

CoreDID