Skip to main content

CoreDID

@iota/identity-wasm API documentation


Class: CoreDID

A method-agnostic Decentralized Identifier (DID).

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

input​

string

Returns​

CoreDID


setMethodName()​

setMethodName(value): void

Set the method name of the CoreDID.

Parameters​

value​

string

Returns​

void


validMethodName()​

static validMethodName(value): boolean

Validates whether a string is a valid DID method name.

Parameters​

value​

string

Returns​

boolean


setMethodId()​

setMethodId(value): void

Set the method-specific-id of the DID.

Parameters​

value​

string

Returns​

void


validMethodId()​

static validMethodId(value): boolean

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

Parameters​

value​

string

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​

segment​

string

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​

json​

any

Returns​

CoreDID


clone()​

clone(): CoreDID

Deep clones the object.

Returns​

CoreDID