[−][src]Function lnpbp::lnpbp1::verify
pub fn verify(
verified_pubkey: PublicKey,
original_keyset: &BTreeSet<PublicKey>,
target_pubkey: PublicKey,
protocol_tag: &Hash,
message: &impl AsRef<[u8]>
) -> bool
Function verifies commitment created according to LNPBP-1.
Parameters
verified_pubkey
: public key containing LNPBP-1 commitment, i.e. the one modified bycommit()
procedure as its second parametertarget_key
original_keyset
: set of public keys provided to thecommit()
procedure. This set must include orignal pubkey specified in the next parametertaget_pubkey
target_pubkey
: one of public keys included into the original keyset and that was provided to thecommit()
procedure astarget_pubkey
. This must be an original version of public key from theverified_pubkey
parameter before the tweak was appliedprotocol_tag
: protocol-specific tag in form of 32-byte hashmessage
: message to commit to, which must be representable as a byte slice usingAsRef::as_ref()
Returns
true
, if verification succeeds,false
, if verification fails, indicating that the providedverified_pubkey
is not committed to the data given in the rest of function parameters.
Procedure
Please refer to the original document for the general algotirhm: https://github.com/LNP-BP/LNPBPs/blob/master/lnpbp-0001.md
Function verifies commitment by running LNPBP-1 commitment procedure once
again with the provided data as a source data, and comparing the result of
the commitment to the verified_pubkey
. If the commitment function fails,
it means that it was not able to commit with the provided data, meaning that
the commitment was not created. Thus, we return that verification have not
passed, and not a error. Verification succeeds if the commitment procedure
produces public key equivalent to the verified_pubkey
.