Class: DidApi ​
Defined in: packages/api/src/did.ts:15
DID identifier operations sub-facade (encode, decode, generate, parse).
Constructors ​
Constructor ​
new DidApi():
DidApi
Returns ​
DidApi
Methods ​
decode() ​
decode(
did):IdentifierComponents
Defined in: packages/api/src/did.ts:32
Decode a DID into its components.
Parameters ​
did ​
string
The DID string to decode.
Returns ​
The decoded identifier components.
encode() ​
encode(
genesisBytes,options):string
Defined in: packages/api/src/did.ts:22
Encode a DID from genesis bytes and options.
Parameters ​
genesisBytes ​
The genesis document bytes.
options ​
The creation options.
Returns ​
string
The encoded DID string.
generate() ​
generate(
network?):object
Defined in: packages/api/src/did.ts:46
Generate a new DID along with its keypair.
When no network is given, defaults to 'regtest' (upstream default). Pass an explicit network to generate DIDs for other networks.
Parameters ​
network? ​
Optional network to generate the DID for.
Returns ​
object
The generated keypair and DID string.
did ​
did:
string
keyPair ​
keyPair:
SchnorrKeyPairObject
isValid() ​
isValid(
did):boolean
Defined in: packages/api/src/did.ts:61
Check if a DID string is valid.
Parameters ​
did ​
string
The DID string to validate.
Returns ​
boolean
true if valid, false otherwise.
parse() ​
parse(
did):Did|null
Defined in: packages/api/src/did.ts:71
Parse a DID string into a Did instance.
Parameters ​
did ​
string
The DID string to parse.
Returns ​
Did | null
The parsed Did instance, or null if parsing failed.