Skip to main content

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


Example


Example.swift

let MESSAGE_HASH = "cfa1ff5424d14eb60614d7ddf65a32243d26ddf7000d10007853d7336395efe4"

func deriveChildPublicKeyUsingKeyshare(
keyshare: Data, trioSession: TrioSession
) async -> Data? {

// performing signature example for context
let result = await trioSession.signature(
keyshare: keyshare, message: MESSAGE_HASH,
chainPath: "m" // This is the default, use your desired path here. For e.g 'm/1/2'
)
// returns nil if operation fails or other flow you might have
switch result {
case .success(let dataBytes):
do {
// do something with bytes, Here, let's derive child public key

// bytes
let childPublicKey = await SilentShard.ECDSA
.deriveChildPublicKey(
keyshare,
derivationPath: "m/1"
)

return dataBytes
}
case .failure(let error):
do {
// show error to user or abort process
Swift.print(error)
return nil
}
}
}
  • When trioSession.signature() is called with a derivationPath, the signature is generated for the specified BIP32 derivation path.
  • derivationPath is a string that specifies the path to the child key. It defaults to 'm' (no derivation) if not provided.