getPreimage method
Get the preimage secret associated to a digest proposition.
digestProposition
The Digest Proposition for which to retrieve the preimage secret for
Returns the preimage secret associated to the Digest Proposition if it exists. Else null
Implementation
@override
m.Preimage? getPreimage(m.Proposition_Digest digestProposition) {
final result = digestsStore.findFirstSync(_instance,
finder: Finder(
filter: Filter.equals(
"digestEvidence",
Encoding().encodeToBase58Check(Uint8List.fromList(
digestProposition.sizedEvidence.digest.value))),
));
if (result != null) {
return m.Preimage(
input: Encoding()
.decodeFromBase58Check(result["preimageInput"]! as String)
.getOrThrow(),
salt: Encoding()
.decodeFromBase58Check(result["preimageSalt"]! as String)
.getOrThrow());
}
return null;
}