@did-btc1/method / Btc1Identifier
Class: Btc1Identifier
Defined in: packages/method/src/utils/identifier.ts:17
Implements 3 Syntax. A did:btc1 DID consists of a did:btc1 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
- the specification version;
- the Bitcoin network identifier; and
- either:
- a key-value representing a secp256k1 public key; or
- a hash-value representing the hash of an initiating external DID document. Btc1Identifier
Constructors
Constructor
> new Btc1Identifier(): Btc1Identifier
Returns
Btc1Identifier
Methods
decode()
> static
decode(identifier
): DidComponents
Defined in: packages/method/src/utils/identifier.ts:135
Implements 3.3 did:btc1 Identifier Decoding.
Parameters
identifier
string
The BTC1 DID to be parsed
Returns
The parsed identifier components. See DidComponents for details.
Throws
if an error occurs while parsing the identifier
Throws
if identifier is invalid
Throws
if the method is not supported
encode()
> static
encode(params
): string
Defined in: packages/method/src/utils/identifier.ts:35
Implements 3.2 did:btc1 Identifier Encoding.
A did:btc1 DID consists of a did:btc1 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
- the specification version;
- the Bitcoin network identifier; and
- either:
- a key-value representing a secp256k1 public key; or
- a hash-value representing the hash of an initiating external DID document.
Parameters
params
See CreateIdentifierParams for details.
genesisBytes
Bytes
Public key or an intermediate document bytes.
idType
string
Identifier type (key or external).
network
string
| number
Bitcoin network name.
version
number
Identifier version.
Returns
string
The new did:btc1 identifier.
generate()
> static
generate(): object
Defined in: packages/method/src/utils/identifier.ts:265
Generates a new did:btc1 identifier based on a newly generated key pair.
Returns
object
The new did:btc1 identifier.
identifier
> identifier: object
identifier.controller
> controller: string
identifier.id
> id: string
keys
> keys: SchnorrKeyPair