Bip32 Support
Please refer to the Session creation section to learn how to create a new session.
We support generating signatures for a BIP32 child key. Perform keygen once, and generate signatures for all BIP32 child keys!
Full example:
- ECDSA
- EdDSA
main.dart
import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;
const messageHash =
'e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03';
Future<void> keyDerivation(sdk.EcdsaSession session) async {
// Keygen
final sdk.DklsKeyshare keyshare = await session.keygen();
print('Keyshare created, public key: ${keyshare.publicKeyHex}');
final signature = await session.sign(
keyId: keyshare.keyId,
messageHash: messageHash,
derivationPath:
'm', // This is the default, use your desired path here. For e.g 'm/1/2'
);
print('Signature: $signature');
final publicKey = keyshare.publicKeyHex;
print('Public key: $publicKey');
final derivedPublicKey = keyshare.deriveChildPublicKeyHex('m');
print('Derived public key: $derivedPublicKey');
}
main.dart
import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;
const messageHash =
'e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03';
Future<void> keyDerivation(sdk.EddsaSession session) async {
// Keygen
final sdk.SchnorrKeyshare keyshare = await session.keygen();
print('Keyshare created, public key: ${keyshare.publicKeyHex}');
final signature = await session.sign(
keyId: await keyshare.keyId,
messageHash: messageHash,
derivationPath:
'm', // This is the default, use your desired path here. For e.g 'm/1/2'
);
print('Signature: $signature');
final publicKey = keyshare.publicKeyHex;
print('Public key: $publicKey');
final derivedPublicKey = keyshare.deriveChildPublicKeyHex('m');
print('Derived public key: $derivedPublicKey');
}
- When
session.sign()is called with aderivationPath, the signature is generated for the specified BIP32 derivation path. derivationPathis a string that specifies the path to the child key. It defaults to 'm' (no derivation) if not provided.