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

// deriveChildPublicKey is a stateless helper that takes keyshare bytes, so first
// read the share from your StorageClient by its keyId (the SDK owns keyshare
// storage under the keyId model), then derive the child public key.
func deriveChildPublicKeyUsingKeyId(
keyId: String, storageClient: CustomStorageClient
) async -> Data? {

// Read the keyshare addressed by keyId from your own storage.
guard let dao = try? await storageClient.read(key: keyId),
let keyshare = dao.currentKeyshare else {
// no keyshare is stored for this keyId
return nil
}

// Derive the child public key at the desired path.
let result = await SilentShard.ECDSA.deriveChildPublicKey(
keyshare,
derivationPath: "m/1" // This is an example; use your desired path, e.g. "m/1/2"
)
// returns nil if operation fails or other flow you might have
switch result {
case .success(let childPublicKey):
// do something with the derived child public key bytes
Swift.print(childPublicKey)
return childPublicKey
case .failure(let error):
// show error to user or abort process
Swift.print(error)
return nil
}
}
  • When duoSession.sign() 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.