Class: CoreDID
identity_wasm.CoreDID
A method-agnostic Decentralized Identifier (DID).
Table of contents
Methods
- toJSON
- toString
- parse
- setMethodName
- validMethodName
- setMethodId
- validMethodId
- scheme
- authority
- method
- methodId
- join
- toUrl
- intoUrl
- fromJSON
- clone
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
Name | Type |
---|---|
input | string |
Returns
setMethodName
▸ setMethodName(value
): void
Set the method name of the CoreDID.
Parameters
Name | Type |
---|---|
value | string |
Returns
void
validMethodName
▸ Static
validMethodName(value
): boolean
Validates whether a string is a valid DID method name.
Parameters
Name | Type |
---|---|
value | string |
Returns
boolean
setMethodId
▸ setMethodId(value
): void
Set the method-specific-id of the DID
.
Parameters
Name | Type |
---|---|
value | string |
Returns
void
validMethodId
▸ Static
validMethodId(value
): boolean
Validates whether a string is a valid DID
method-id.
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
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
▸ Static
fromJSON(json
): CoreDID
Deserializes an instance from a JSON object.
Parameters
Name | Type |
---|---|
json | any |
Returns
clone
▸ clone(): CoreDID
Deep clones the object.