Class: DataIntegrityProofApi ​
Defined in: packages/api/src/crypto.ts:186
Data Integrity Proof operations.
Optionally stateful: call use to set a current proof instance, then call addProof or verifyProof without passing an explicit instance. Pass an explicit instance to override for that call.
Constructors ​
Constructor ​
new DataIntegrityProofApi():
DataIntegrityProofApi
Returns ​
DataIntegrityProofApi
Accessors ​
current ​
Get Signature ​
get current():
BIP340DataIntegrityProof|undefined
Defined in: packages/api/src/crypto.ts:190
The currently active proof instance, or undefined if none is set.
Returns ​
BIP340DataIntegrityProof | undefined
Methods ​
addProof() ​
addProof(
document,config,proof?):SignedBTCR2Update
Defined in: packages/api/src/crypto.ts:226
Add a proof to a document. Uses the current proof instance when proof is omitted.
Parameters ​
document ​
The document to add the proof to.
config ​
Configuration for adding the proof.
proof? ​
Optional explicit proof instance; defaults to current.
Returns ​
A document with a proof added.
clear() ​
clear():
void
Defined in: packages/api/src/crypto.ts:205
Clear the current proof instance.
Returns ​
void
create() ​
create(
cryptosuite):BIP340DataIntegrityProof
Defined in: packages/api/src/crypto.ts:214
Create a BIP340DataIntegrityProof instance with the given cryptosuite.
Parameters ​
cryptosuite ​
The cryptosuite to use for proof operations.
Returns ​
The created BIP340DataIntegrityProof instance.
signDocument() ​
signDocument(
multikey,document,config):SignedBTCR2Update
Defined in: packages/api/src/crypto.ts:243
Convenience: create a cryptosuite, proof instance, and sign a document in one call. Requires a multikey with signing capability.
Parameters ​
multikey ​
The Schnorr multikey (must include secret key).
document ​
The unsigned document to sign.
config ​
The Data Integrity proof configuration.
Returns ​
The signed document with proof attached.
use() ​
use(
p):this
Defined in: packages/api/src/crypto.ts:199
Set the current proof instance for subsequent operations.
Parameters ​
p ​
The proof instance to activate.
Returns ​
this
this for chaining.
verifyProof() ​
verifyProof(
document,expectedPurpose,mediaType?,expectedDomain?,expectedChallenge?,proof?):VerificationResult
Defined in: packages/api/src/crypto.ts:264
Verify a proof using a BIP340DataIntegrityProof instance. Uses the current proof instance when proof is omitted.
Parameters ​
document ​
string
The document to verify the proof for.
expectedPurpose ​
string
The expected proof purpose.
mediaType? ​
string
The media type of the document.
expectedDomain? ​
string
The expected domain for the proof.
expectedChallenge? ​
string
The expected challenge for the proof.
proof? ​
Optional explicit proof instance; defaults to current.
Returns ​
The result of verifying the proof.