Getting frost share verify to work

This commit is contained in:
kngako 2024-08-23 01:03:56 +02:00
parent 9541124a4a
commit 9a06440277

View File

@ -603,27 +603,22 @@ public object Secp256k1Native : Secp256k1 {
memScoped {
val nFrostShare = allocFrostShare(share)
// val nVssCommitment = vssCommitment.map { allocPublicKey(it).ptr }
val nVssCommitments = allocArray<CPointerVar<secp256k1_pubkey>>(1)
val nVssCommitment = allocArray<CPointerVar<secp256k1_pubkey>>(vssCommitment.size)
vssCommitment.forEachIndexed { index, bytes ->
memcpy(nVssCommitment[index], bytes.refTo(0).getPointer(memScope), bytes.size.convert())
val pubkeyArray = allocArray<secp256k1_pubkey>(vssCommitment.size)
vssCommitment.forEachIndexed { commitmentIndex, pubkeyData ->
if (secp256k1_ec_pubkey_parse(ctx, pubkeyArray[commitmentIndex].ptr, toNat(pubkeyData), pubkeyData.size.convert()) == 0) {
error("Failed to parse public key")
}
// val nVssCommitment = allocArray<CPointerVar<secp256k1_pubkey>>(vssCommitment.size)
// vssCommitment.forEachIndexed { index, pubkeyData ->
// pubkeyData.usePinned { pinned ->
// if (secp256k1_ec_pubkey_parse(ctx, nVssCommitment[index], toNat(pinned.get()), pubkeyData.size.convert()) == 0) {
// error("Failed to parse public key")
// }
// }
// }
}
nVssCommitments[0] = pubkeyArray
return secp256k1_frost_share_verify(
ctx = ctx,
threshold = threshold.convert(),
id33 = toNat(id33),
share = nFrostShare.ptr,
vss_commitment = nVssCommitment
vss_commitment = nVssCommitments
)
}
}