diff --git a/src/proof/verifiers/pub-signals-verifier.ts b/src/proof/verifiers/pub-signals-verifier.ts index ad6a1787..42988fa5 100644 --- a/src/proof/verifiers/pub-signals-verifier.ts +++ b/src/proof/verifiers/pub-signals-verifier.ts @@ -170,6 +170,14 @@ export class PubSignalsVerifier { byteEncoder.encode(JSON.stringify(pubSignals)) ); + if (!sigV2PubSignals.userID) { + throw new Error('user id is not presented in proof public signals'); + } + + if (!sigV2PubSignals.requestID) { + throw new Error('requestId is not presented in proof public signals'); + } + this.userId = sigV2PubSignals.userID; this.challenge = sigV2PubSignals.requestID; @@ -224,6 +232,14 @@ export class PubSignalsVerifier { let v3PubSignals = new AtomicQueryV3PubSignals(); v3PubSignals = v3PubSignals.pubSignalsUnmarshal(byteEncoder.encode(JSON.stringify(pubSignals))); + if (!v3PubSignals.userID) { + throw new Error('user id is not presented in proof public signals'); + } + + if (!v3PubSignals.requestID) { + throw new Error('requestId is not presented in proof public signals'); + } + this.userId = v3PubSignals.userID; this.challenge = v3PubSignals.requestID; @@ -388,6 +404,14 @@ export class PubSignalsVerifier { byteEncoder.encode(JSON.stringify(pubSignals)) ); + if (!authV2PubSignals.userID) { + throw new Error('user id is not presented in proof public signals'); + } + + if (!authV2PubSignals.challenge) { + throw new Error('challenge is not presented in proof public signals'); + } + this.userId = authV2PubSignals.userID; this.challenge = authV2PubSignals.challenge;