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()
staticparse(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
setMethodName()
setMethodName(
value):void
Set the method name of the CoreDID.
Parameters
value
string
Returns
void
validMethodName()
staticvalidMethodName(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()
staticvalidMethodId(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
toUrl()
toUrl():
DIDUrl
Clones the CoreDID into a DIDUrl.
Returns
intoUrl()
intoUrl():
DIDUrl
Converts the CoreDID into a DIDUrl, consuming it.
Returns
fromJSON()
staticfromJSON(json):CoreDID
Deserializes an instance from a JSON object.
Parameters
json
any
Returns
clone()
clone():
CoreDID
Deep clones the object.