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
ResultofSuccesswith Child Public-Key bytes asDataor Failure witherror.
Example
- ECDSA
- EdDSA
Example.swift
let MESSAGE_HASH = "cfa1ff5424d14eb60614d7ddf65a32243d26ddf7000d10007853d7336395efe4"
func deriveChildPublicKeyUsingKeyshare(
keyshare: Data, duoSession: DuoSession
) async -> Data? {
// performing signature example for context
let result = await duoSession.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
let childPublicKey = await SilentShardDuo.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
}
}
}
Example.swift
let MESSAGE_HASH = "cfa1ff5424d14eb60614d7ddf65a32243d26ddf7000d10007853d7336395efe4"
func deriveChildPublicKeyUsingKeyshare(
keyshare: Data, duoSession: DuoSession
) async -> Data? {
// performing signature example for context
let result = await duoSession.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
let childPublicKey = await SilentShardDuo.EdDSA
.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 duoSession.signature() 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.