createSelectiveDisclosureProofBlsFFI method
Creates a selective disclosure proof using a BLS public key, nonce, signature, and a set of messages.
Selective disclosure proofs allow for revealing only specific messages while keeping others hidden.
This function prepares the input messages accordingly (marking them as revealed or hidden) and
generates a cryptographic proof via blsCreateProofFFI.
Implementation
Future<String> createSelectiveDisclosureProofBlsFFI(
Uint8List publicKey,
Uint8List nonce,
Uint8List signature,
List<Uint8List> messages,
Set<int> revealedIndices,
) {
final proofMessages = <ProofMessage>[];
for (int i = 0; i < messages.length; i++) {
final type = revealedIndices.contains(i)
? ProofMessageType.Revealed
: ProofMessageType.HiddenProofSpecificBlinding;
proofMessages.add(ProofMessage(
type,
messages[i],
Uint8List(0), // empty blinding factor
));
}
return Future.sync(() async {
final proof = await blsCreateProofFFI(
publicKey: publicKey,
nonce: nonce,
signature: signature,
messages: proofMessages,
);
final encoded = base64Url.encode(proof).replaceAll('=', '');
return 'u$encoded'; // prepend "u"
});
}