ECDSA Keyshare Object
Keyshare
class represents a ECDSA Keyshare from the Native Module.
This class hold memory pointer to the keyshare in the native module and handle
various useful operations on the keyshare.
Note: Most methods in this class are asynchronous and return a promise. Due to React-Native native module bridge.
Import
import * as duo from '@silencelaboratories/dkls-sdk';
// Then you can use it as
duo.Keyshare
Usage
// Get public key and key id from keyshare
const publicKey = await keyshare.publicKeyBase64;
const publicKeyHex = await keyshare.publicKeyHex;
const keyId = await keyshare.keyId;
// Derive child public key from keyshare
const derivedPublicKey = await keyshare.deriveChildPublicKey('m');
// Get keyshare in base64 format for persistence
const keyshareBase64 = keyshare.toBase64();
// Recreate keyshare from keyshare base64 string
const keyshareFromBase64 = await duo.Keyshare.fromBase64(keyshareBase64);
// After all operation free up memory
await keyshare.free();
Properties
keyId
keyId:
string
Key ID of the keyshare. Encode base64 URL safe string. Can include padding =
.
publicKeyBase64
publicKeyBase64:
string
Public key of the keyshare in base64 format
Accessors
handle
get
handle():number
Returns
number
publicKeyHex
get
publicKeyHex():string
Get the public key of the keyshare in Hex format
Returns
string
Hex encoded string of the public key
Methods
deriveChildPublicKey()
deriveChildPublicKey(
derivationPath
):Promise
<string
>
Derive child public key from keyshare
Parameters
• derivationPath: string
BIP 32 derivation path
Returns
Promise
<string
>
A promise contain derived public key (string base64 encode)
free()
free():
Promise
<boolean
>
Free up the native memory allocated for the keyshare
Returns
Promise
<boolean
>
A promise containing the success status of the operation
toBase64()
toBase64():
Promise
<string
>
Get the keyshare in base64 format
Returns
Promise
<string
>
A promise containing the base64 encoded string of the keyshare
fromBase64()
static
fromBase64(keyshareBase64
):Promise
<Keyshare
>
Create a Keyshare instance from a base64 encoded string
Parameters
• keyshareBase64: string
base64 encoded string of the keyshare
Returns
Promise
<Keyshare
>
A promise containing the Keyshare instance