@did-btc1/cryptosuite / Cryptosuite
Class: Cryptosuite
Defined in: cryptosuite/index.ts:54
Implements 3.1 Instantiate Cryptosuite
The Instantiate Cryptosuite algorithm is used to configure a cryptographic suite to be used by the Add Proof and Verify Proof functions in Verifiable Credential Data Integrity 1.0. The algorithm takes an options object (map options) as input and returns a cryptosuite instance (struct cryptosuite).
- Initialize cryptosuite to an empty struct.
- If options.type does not equal DataIntegrityProof, return cryptosuite.
- If options.cryptosuite is bip340-rdfc-2025: 3.1) Set cryptosuite.createProof to the algorithm in Section 3.2.1 Create Proof (bip340-rdfc-2025). 3.2) Set cryptosuite.verifyProof to the algorithm in Section 3.2.2 Verify Proof (bip340-rdfc-2025).
- If options.cryptosuite is bip340-jcs-2025: 4.2) Set cryptosuite.createProof to the algorithm in Section 3.3.1 Create Proof (bip340-jcs-2025). 4.3) Set cryptosuite.verifyProof to the algorithm in Section 3.3.2 Verify Proof (bip340-jcs-2025).
- Return cryptosuite.
Cryptosuite
Implements
Constructors
Constructor
> new Cryptosuite(params
): Cryptosuite
Defined in: cryptosuite/index.ts:88
Constructs an instance of Cryptosuite.
Parameters
params
See CryptosuiteParams for required parameters to create a cryptosuite.
Returns
Cryptosuite
Properties
algorithm
> algorithm: "rdfc"
| "jcs"
Defined in: cryptosuite/index.ts:80
The algorithm used for canonicalization
cryptosuite
> cryptosuite: "bip340-jcs-2025"
| "bip340-rdfc-2025"
Defined in: cryptosuite/index.ts:66
The name of the cryptosuite
Implementation of
multikey
> multikey: SchnorrMultikey
Defined in: cryptosuite/index.ts:73
The multikey used to sign and verify proofs
Implementation of
type
> type: "DataIntegrityProof"
= 'DataIntegrityProof'
Defined in: cryptosuite/index.ts:59
The type of the proof
Implementation of
Methods
createProof()
> createProof(params
): Promise
<Proof
>
Defined in: cryptosuite/index.ts:115
Create a proof for an insecure document.
Parameters
params
See CreateProofParams for details.
Returns
Promise
<Proof
>
The proof for the document.
Implementation of
generateHash()
> generateHash(params
): Bytes
Defined in: cryptosuite/index.ts:226
Generate a hash of the canonical proof configuration and document.
Parameters
params
See GenerateHashParams for details.
Returns
Bytes
The hash string of the proof configuration and document.
Implementation of
proofConfiguration()
> proofConfiguration(options
): Promise
<string
>
Defined in: cryptosuite/index.ts:246
Configure the proof by canonicalzing it.
Parameters
options
ProofOptions
The options to use when transforming the proof.
Returns
Promise
<string
>
The canonicalized proof configuration.
Throws
if the proof configuration cannot be canonicalized.
Implementation of
ICryptosuite
.proofConfiguration
proofSerialization()
> proofSerialization(params
): Bytes
Defined in: cryptosuite/index.ts:277
Serialize the proof into a byte array.
Parameters
params
See ProofSerializationParams for details.
Returns
Bytes
The serialized proof.
Throws
if the multikey does not match the verification method.
Implementation of
ICryptosuite
.proofSerialization
proofVerification()
> proofVerification(params
): boolean
Defined in: cryptosuite/index.ts:299
Verify the proof by comparing the hash of the proof configuration and document to the proof bytes.
Parameters
params
See ProofVerificationParams for details.
Returns
boolean
True if the proof is verified, false otherwise.
Throws
if the multikey does not match the verification method.
Implementation of
ICryptosuite
.proofVerification
toDataIntegrityProof()
> toDataIntegrityProof(): DataIntegrityProof
Defined in: cryptosuite/index.ts:100
Constructs an instance of DataIntegrityProof from the current Cryptosuite instance.
Returns
A new DataIntegrityProof instance.
transformDocument()
> transformDocument(params
): Promise
<string
>
Defined in: cryptosuite/index.ts:192
Transform a document (secure didUpdateInvocation or insecure didUpdatePayload) into canonical form.
Parameters
params
See TransformDocumentParams for details.
Returns
Promise
<string
>
The canonicalized document.
Throws
if the document cannot be transformed.
Implementation of
ICryptosuite
.transformDocument
verifyProof()
> verifyProof(document
): Promise
<VerificationResult
>
Defined in: cryptosuite/index.ts:158
Verify a proof for a secure document. Implements ICryptosuite Method verifyProof.
Parameters
document
DidUpdateInvocation
The secure document to verify.
Returns
Promise
<VerificationResult
>
The result of the verification.