BIP32 Support
We support generating signatures for a BIP32 child key. Perform keygen once, and generate signatures for all BIP32 child keys!
Perform Derive Child Public-Key
- Call SilentShard.ECDSA.deriveChildPublicKey() or SilentShard.EdDSA.deriveChildPublicKey() which returns Result of Success with Child Public-Key ByteArray or Failure with exception.
Example
- ECDSA
- EdDSA
Example.kt
suspend fun deriveChildPublicKeyUsingKeyshare(
keyId: String,
trioSession: TrioSession,
storageClient: StorageClient,
): ByteArray {
return withContext(Dispatchers.IO) {
//signature example for context
trioSession.sign(
keyId = keyId,
message = messageHash,
derivationPath = "m" // This is the default, use your desired path here. For e.g. 'm/1/2'
).getOrThrow()
// Read the keyshare bytes from your StorageClient by keyId.
val keyshare = (storageClient.read(keyId) as ReconcileStoreDao).currentKeyshare!!
// child public key derivation
SilentShard.ECDSA.deriveChildPublicKey(
keyshare = keyshare,
derivationPath = "m/1"
).getOrThrow()
}
}
Example.kt
suspend fun deriveChildPublicKeyUsingKeyshare(
keyId: String,
trioSession: TrioSession,
storageClient: StorageClient,
): ByteArray {
return withContext(Dispatchers.IO) {
//signature example for context
trioSession.sign(
keyId = keyId,
message = messageHash,
derivationPath = "m" // This is the default, use your desired path here. For e.g. 'm/1/2'
).getOrThrow()
// Read the keyshare bytes from your StorageClient by keyId.
val keyshare = (storageClient.read(keyId) as ReconcileStoreDao).currentKeyshare!!
// child public key derivation
SilentShard.EdDSA.deriveChildPublicKey(
keyshare = keyshare,
derivationPath = "m/1"
).getOrThrow()
}
}
- When trioSession.sign() is called with a
derivationPath, 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.
The derivation above computes a child public key from your existing key. For ECDSA sessions, hardDerivation(keyId, derivationPath) performs an MPC hardened derivation and returns a new child keyId that you can sign with directly.