Skip to main content

Dkls Keyshare Object

Keyshare class represents a ECDSA Keyshare. This class hold memory pointer to the keyshare in the sdk and handle various useful operations on the keyshare.


Import

main.dart
import 'package:duo_dkls_flutter/duo_dkls_flutter.dart' as dkls;

// Then you can use it as
dkls.Keyshare;

Usage

main.dart
  // Get public key and key id from keyshare
final publicKey = keyshare.publicKeyBase64;
final publicKeyHex = keyshare.publicKeyHex;
final keyId = keyshare.id;

// Derive child public key from keyshare
final derivedPublicKey = keyshare.deriveChildPublicKeyHex('m');

// Get keyshare bytes
final keyshareBytes = keyshare.toBytes();

// Recreate keyshare from keyshare bytes
final keyshareFromBytes = dkls.Keyshare.fromBytes(keyshareBytes);

// After all operation free up memory
keyshare.free();

Properties

id

String *id**

ID of the keyshare in base64


publicKeyBase64

String publicKeyBase64

Public key of the keyshare in base64 format

Accessors

publicKeyHex

String publicKeyHex

Public key of the keyshare in hex format


handle

int handle

Handle of keyshare in int


Methods

deriveChildPublicKeyHex()

String deriveChildPublicKeyHex(derivationPath)

Derive child public key from keyshare in hex

Parameters

String derivationPath

BIP 32 derivation path

Returns

String

Derived public key (string hex encode)


deriveChildPublicKeyBase64()

String deriveChildPublicKeyBase64(derivationPath)

Derive child public key from keyshare in base64

Parameters

String derivationPath:

BIP 32 derivation path

Returns

String

Derived public key (string base64 encode)


free()

void free()

Free up the native memory allocated for the keyshare

Returns

void


toBytes()

Uint8List toBytes()

Get the keyshare in bytes

Returns

Uint8List

Keyshare in bytes format


fromBytes()

Keyshare.fromBytes(bytes)

Create a Keyshare instance from bytes

Parameters

Iterable<int> bytes

base64 encoded string of the keyshare

Returns

Keyshare

Keyshare instance