@@ -22,11 +22,23 @@ export class CompositeProofG1 {
2222 this . value = proof ;
2323 }
2424
25+ /**
26+ * Generate the composite proof using a `ProofSpec`
27+ * @param proofSpec
28+ * @param witnesses
29+ * @param nonce
30+ */
2531 static generate ( proofSpec : ProofSpecG1 , witnesses : Witnesses , nonce ?: Uint8Array ) : CompositeProofG1 {
2632 const proof = generateCompositeProofG1 ( proofSpec . value , witnesses . values , nonce ) ;
2733 return new CompositeProofG1 ( proof ) ;
2834 }
2935
36+ /**
37+ * Generate the composite proof using a `QuasiProofSpecG1`
38+ * @param proofSpec
39+ * @param witnesses
40+ * @param nonce
41+ */
3042 static generateUsingQuasiProofSpec (
3143 proofSpec : QuasiProofSpecG1 ,
3244 witnesses : Witnesses ,
@@ -42,6 +54,40 @@ export class CompositeProofG1 {
4254 ) ;
4355 }
4456
57+ /**
58+ * Verify this composite proof using a `ProofSpec`
59+ * @param proofSpec
60+ * @param nonce
61+ */
62+ verify ( proofSpec : ProofSpecG1 , nonce ?: Uint8Array ) : VerifyResult {
63+ return verifyCompositeProofG1 ( this . value , proofSpec . value , nonce ) ;
64+ }
65+
66+ /**
67+ * Verify this composite proof using a `QuasiProofSpecG1`
68+ * @param proofSpec
69+ * @param nonce
70+ */
71+ verifyUsingQuasiProofSpec ( proofSpec : QuasiProofSpecG1 , nonce ?: Uint8Array ) : VerifyResult {
72+ return this . verifyWithDeconstructedProofSpec (
73+ proofSpec . statements ,
74+ proofSpec . metaStatements ,
75+ proofSpec . setupParams ,
76+ proofSpec . context ,
77+ nonce
78+ ) ;
79+ }
80+
81+ /**
82+ * Get the ciphertext for the SAVER statement at index `statementIndex`. The proof involving any SAVER statement also
83+ * contains the ciphertext corresponding to that statement. Will throw an error if it could not find the ciphertext or
84+ * statement at that index
85+ * @param statementIndex
86+ */
87+ getSaverCiphertext ( statementIndex : number ) : SaverCiphertext {
88+ return new SaverCiphertext ( saverGetCiphertextFromProof ( this . value , statementIndex ) ) ;
89+ }
90+
4591 static generateWithDeconstructedProofSpec (
4692 statements : Statements ,
4793 metaStatements : MetaStatements ,
@@ -62,20 +108,6 @@ export class CompositeProofG1 {
62108 return new CompositeProofG1 ( proof ) ;
63109 }
64110
65- verify ( proofSpec : ProofSpecG1 , nonce ?: Uint8Array ) : VerifyResult {
66- return verifyCompositeProofG1 ( this . value , proofSpec . value , nonce ) ;
67- }
68-
69- verifyUsingQuasiProofSpec ( proofSpec : QuasiProofSpecG1 , nonce ?: Uint8Array ) : VerifyResult {
70- return this . verifyWithDeconstructedProofSpec (
71- proofSpec . statements ,
72- proofSpec . metaStatements ,
73- proofSpec . setupParams ,
74- proofSpec . context ,
75- nonce
76- ) ;
77- }
78-
79111 verifyWithDeconstructedProofSpec (
80112 statements : Statements ,
81113 metaStatements : MetaStatements ,
@@ -93,13 +125,4 @@ export class CompositeProofG1 {
93125 nonce
94126 ) ;
95127 }
96-
97- /**
98- * Get the ciphertext for the SAVER statement at index `statementIndex`. The proof involving any SAVER statement also
99- * contains the ciphertext corresponding to that statement. Will throw an error if it could not find the ciphertext
100- * @param statementIndex
101- */
102- getSaverCiphertext ( statementIndex : number ) : SaverCiphertext {
103- return new SaverCiphertext ( saverGetCiphertextFromProof ( this . value , statementIndex ) ) ;
104- }
105128}
0 commit comments