@veridid/poe 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +39 -2
- package/build/PoeApi.d.mts +150 -0
- package/build/PoeApi.d.mts.map +1 -0
- package/build/PoeApi.mjs +262 -0
- package/build/PoeApi.mjs.map +1 -0
- package/build/PoeEvents.d.mts +187 -0
- package/build/PoeEvents.d.mts.map +1 -0
- package/build/PoeEvents.mjs +28 -0
- package/build/PoeEvents.mjs.map +1 -0
- package/build/PoeModule.d.mts +61 -0
- package/build/PoeModule.d.mts.map +1 -0
- package/build/PoeModule.mjs +139 -0
- package/build/PoeModule.mjs.map +1 -0
- package/build/PoeModuleConfig.d.mts +71 -0
- package/build/PoeModuleConfig.d.mts.map +1 -0
- package/build/PoeRole.d.mts +21 -0
- package/build/PoeRole.d.mts.map +1 -0
- package/build/PoeRole.mjs +23 -0
- package/build/PoeRole.mjs.map +1 -0
- package/build/PoeState.d.mts +76 -0
- package/build/PoeState.d.mts.map +1 -0
- package/build/PoeState.mjs +78 -0
- package/build/PoeState.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateParam.mjs +9 -0
- package/build/_virtual/_rolldown/runtime.mjs +8 -0
- package/build/errors/PoeError.d.mts +173 -0
- package/build/errors/PoeError.d.mts.map +1 -0
- package/build/errors/PoeError.mjs +147 -0
- package/build/errors/PoeError.mjs.map +1 -0
- package/build/errors/index.d.mts +1 -0
- package/build/errors/index.mjs +1 -0
- package/build/executor/ProgramExecutor.d.mts +148 -0
- package/build/executor/ProgramExecutor.d.mts.map +1 -0
- package/build/executor/ProgramExecutorRegistry.d.mts +111 -0
- package/build/executor/ProgramExecutorRegistry.d.mts.map +1 -0
- package/build/executor/ProgramExecutorRegistry.mjs +145 -0
- package/build/executor/ProgramExecutorRegistry.mjs.map +1 -0
- package/build/executor/__mocks__/MockProgramExecutor.d.mts +118 -0
- package/build/executor/__mocks__/MockProgramExecutor.d.mts.map +1 -0
- package/build/executor/__mocks__/MockProgramExecutor.mjs +96 -0
- package/build/executor/__mocks__/MockProgramExecutor.mjs.map +1 -0
- package/build/executor/__mocks__/MockProofVerifier.d.mts +97 -0
- package/build/executor/__mocks__/MockProofVerifier.d.mts.map +1 -0
- package/build/executor/__mocks__/MockProofVerifier.mjs +79 -0
- package/build/executor/__mocks__/MockProofVerifier.mjs.map +1 -0
- package/build/executor/__mocks__/index.d.mts +2 -0
- package/build/executor/index.d.mts +5 -0
- package/build/executor/index.mjs +3 -0
- package/build/handlers/AcceptPoeMessageHandler.mjs +24 -0
- package/build/handlers/AcceptPoeMessageHandler.mjs.map +1 -0
- package/build/handlers/ChallengeMessageHandler.mjs +24 -0
- package/build/handlers/ChallengeMessageHandler.mjs.map +1 -0
- package/build/handlers/CompleteMessageHandler.mjs +24 -0
- package/build/handlers/CompleteMessageHandler.mjs.map +1 -0
- package/build/handlers/DeclinePoeMessageHandler.mjs +24 -0
- package/build/handlers/DeclinePoeMessageHandler.mjs.map +1 -0
- package/build/handlers/PoeProblemReportMessageHandler.mjs +18 -0
- package/build/handlers/PoeProblemReportMessageHandler.mjs.map +1 -0
- package/build/handlers/ProposePoeMessageHandler.mjs +18 -0
- package/build/handlers/ProposePoeMessageHandler.mjs.map +1 -0
- package/build/handlers/RequestPoeMessageHandler.mjs +18 -0
- package/build/handlers/RequestPoeMessageHandler.mjs.map +1 -0
- package/build/handlers/SubmitPoeMessageHandler.mjs +18 -0
- package/build/handlers/SubmitPoeMessageHandler.mjs.map +1 -0
- package/build/handlers/index.mjs +8 -0
- package/build/index.d.mts +38 -0
- package/build/index.mjs +33 -0
- package/build/messages/AcceptPoeMessage.d.mts +48 -0
- package/build/messages/AcceptPoeMessage.d.mts.map +1 -0
- package/build/messages/AcceptPoeMessage.mjs +61 -0
- package/build/messages/AcceptPoeMessage.mjs.map +1 -0
- package/build/messages/ChallengeMessage.d.mts +46 -0
- package/build/messages/ChallengeMessage.d.mts.map +1 -0
- package/build/messages/ChallengeMessage.mjs +57 -0
- package/build/messages/ChallengeMessage.mjs.map +1 -0
- package/build/messages/CompleteMessage.d.mts +56 -0
- package/build/messages/CompleteMessage.d.mts.map +1 -0
- package/build/messages/CompleteMessage.mjs +69 -0
- package/build/messages/CompleteMessage.mjs.map +1 -0
- package/build/messages/DeclinePoeMessage.d.mts +36 -0
- package/build/messages/DeclinePoeMessage.d.mts.map +1 -0
- package/build/messages/DeclinePoeMessage.mjs +45 -0
- package/build/messages/DeclinePoeMessage.mjs.map +1 -0
- package/build/messages/PoeProblemReportMessage.d.mts +51 -0
- package/build/messages/PoeProblemReportMessage.d.mts.map +1 -0
- package/build/messages/PoeProblemReportMessage.mjs +64 -0
- package/build/messages/PoeProblemReportMessage.mjs.map +1 -0
- package/build/messages/ProposePoeMessage.d.mts +51 -0
- package/build/messages/ProposePoeMessage.d.mts.map +1 -0
- package/build/messages/ProposePoeMessage.mjs +69 -0
- package/build/messages/ProposePoeMessage.mjs.map +1 -0
- package/build/messages/RequestPoeMessage.d.mts +64 -0
- package/build/messages/RequestPoeMessage.d.mts.map +1 -0
- package/build/messages/RequestPoeMessage.mjs +82 -0
- package/build/messages/RequestPoeMessage.mjs.map +1 -0
- package/build/messages/SubmitPoeMessage.d.mts +58 -0
- package/build/messages/SubmitPoeMessage.d.mts.map +1 -0
- package/build/messages/SubmitPoeMessage.mjs +75 -0
- package/build/messages/SubmitPoeMessage.mjs.map +1 -0
- package/build/messages/index.d.mts +9 -0
- package/build/messages/index.mjs +11 -0
- package/build/models/BindingContext.d.mts +36 -0
- package/build/models/BindingContext.d.mts.map +1 -0
- package/build/models/BindingContext.mjs +42 -0
- package/build/models/BindingContext.mjs.map +1 -0
- package/build/models/ProgramExecution.d.mts +142 -0
- package/build/models/ProgramExecution.d.mts.map +1 -0
- package/build/models/ProofArtifact.d.mts +260 -0
- package/build/models/ProofArtifact.d.mts.map +1 -0
- package/build/programs/AppAttestationProgram.d.mts +179 -0
- package/build/programs/AppAttestationProgram.d.mts.map +1 -0
- package/build/programs/AppAttestationProgram.mjs +296 -0
- package/build/programs/AppAttestationProgram.mjs.map +1 -0
- package/build/programs/PoeProgram.d.mts +204 -0
- package/build/programs/PoeProgram.d.mts.map +1 -0
- package/build/programs/PoeProgram.mjs +155 -0
- package/build/programs/PoeProgram.mjs.map +1 -0
- package/build/programs/examples/MockProgram.d.mts +98 -0
- package/build/programs/examples/MockProgram.d.mts.map +1 -0
- package/build/programs/examples/MockProgram.mjs +117 -0
- package/build/programs/examples/MockProgram.mjs.map +1 -0
- package/build/programs/examples/index.d.mts +1 -0
- package/build/programs/index.d.mts +4 -0
- package/build/programs/index.mjs +3 -0
- package/build/programs/vkeys/app_attestation_vkey.mjs +136 -0
- package/build/programs/vkeys/app_attestation_vkey.mjs.map +1 -0
- package/build/registry/ProgramRegistry.d.mts +108 -0
- package/build/registry/ProgramRegistry.d.mts.map +1 -0
- package/build/registry/ProgramRegistry.mjs +87 -0
- package/build/registry/ProgramRegistry.mjs.map +1 -0
- package/build/registry/ProofSystemRegistry.d.mts +111 -0
- package/build/registry/ProofSystemRegistry.d.mts.map +1 -0
- package/build/registry/ProofSystemRegistry.mjs +87 -0
- package/build/registry/ProofSystemRegistry.mjs.map +1 -0
- package/build/registry/index.d.mts +2 -0
- package/build/registry/index.mjs +2 -0
- package/build/repository/NonceRecord.d.mts +45 -0
- package/build/repository/NonceRecord.d.mts.map +1 -0
- package/build/repository/NonceRecord.mjs +34 -0
- package/build/repository/NonceRecord.mjs.map +1 -0
- package/build/repository/NonceRepository.d.mts +41 -0
- package/build/repository/NonceRepository.d.mts.map +1 -0
- package/build/repository/NonceRepository.mjs +63 -0
- package/build/repository/NonceRepository.mjs.map +1 -0
- package/build/repository/PoeSessionRecord.d.mts +107 -0
- package/build/repository/PoeSessionRecord.d.mts.map +1 -0
- package/build/repository/PoeSessionRecord.mjs +100 -0
- package/build/repository/PoeSessionRecord.mjs.map +1 -0
- package/build/repository/PoeSessionRepository.d.mts +29 -0
- package/build/repository/PoeSessionRepository.d.mts.map +1 -0
- package/build/repository/PoeSessionRepository.mjs +46 -0
- package/build/repository/PoeSessionRepository.mjs.map +1 -0
- package/build/repository/index.d.mts +4 -0
- package/build/repository/index.mjs +6 -0
- package/build/services/AutoProofExecutionService.d.mts +2 -0
- package/build/services/AutoProofExecutionService.mjs +144 -0
- package/build/services/AutoProofExecutionService.mjs.map +1 -0
- package/build/services/ContextBindingService.d.mts +51 -0
- package/build/services/ContextBindingService.d.mts.map +1 -0
- package/build/services/ContextBindingService.mjs +92 -0
- package/build/services/ContextBindingService.mjs.map +1 -0
- package/build/services/NonceService.d.mts +74 -0
- package/build/services/NonceService.d.mts.map +1 -0
- package/build/services/NonceService.mjs +126 -0
- package/build/services/NonceService.mjs.map +1 -0
- package/build/services/PoeService.d.mts +163 -0
- package/build/services/PoeService.d.mts.map +1 -0
- package/build/services/PoeService.mjs +487 -0
- package/build/services/PoeService.mjs.map +1 -0
- package/build/services/ProofVerificationService.d.mts +87 -0
- package/build/services/ProofVerificationService.d.mts.map +1 -0
- package/build/services/ProofVerificationService.mjs +164 -0
- package/build/services/ProofVerificationService.mjs.map +1 -0
- package/build/services/index.d.mts +5 -0
- package/build/services/index.mjs +5 -0
- package/build/workflow/PoeV1Actions.d.mts +149 -0
- package/build/workflow/PoeV1Actions.d.mts.map +1 -0
- package/build/workflow/PoeV1Actions.mjs +190 -0
- package/build/workflow/PoeV1Actions.mjs.map +1 -0
- package/package.json +44 -3
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { BindingContext } from "../../models/BindingContext.mjs";
|
|
2
|
+
import { ProofArtifact } from "../../models/ProofArtifact.mjs";
|
|
3
|
+
import { ProofVerifier } from "../ProgramExecutor.mjs";
|
|
4
|
+
import { AgentContext } from "@credo-ts/core";
|
|
5
|
+
|
|
6
|
+
//#region src/executor/__mocks__/MockProofVerifier.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Mock ZK proof verifier for testing.
|
|
9
|
+
*
|
|
10
|
+
* Simulates proof verification without actual cryptographic verification.
|
|
11
|
+
* Useful for integration tests and development.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const mockVerifier = new MockProofVerifier('mock-age-check', {
|
|
16
|
+
* verificationDelayMs: 50,
|
|
17
|
+
* shouldVerify: true
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* const agent = new Agent({
|
|
21
|
+
* modules: {
|
|
22
|
+
* poe: new PoeModule({
|
|
23
|
+
* verifiers: [mockVerifier]
|
|
24
|
+
* })
|
|
25
|
+
* }
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class MockProofVerifier implements ProofVerifier {
|
|
30
|
+
readonly programId: string;
|
|
31
|
+
private options;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new mock verifier
|
|
34
|
+
*
|
|
35
|
+
* @param programId - Program identifier (e.g., 'mock-age-check')
|
|
36
|
+
* @param options - Mock behavior options
|
|
37
|
+
*/
|
|
38
|
+
constructor(programId: string, options?: MockVerifierOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Verify the mock proof
|
|
41
|
+
*
|
|
42
|
+
* Returns verification result with configured behavior.
|
|
43
|
+
*/
|
|
44
|
+
verify(context: AgentContext, artifact: ProofArtifact, expectedContext: BindingContext): Promise<{
|
|
45
|
+
verified: boolean;
|
|
46
|
+
errors?: string[];
|
|
47
|
+
warnings?: string[];
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Helper to introduce async delay
|
|
51
|
+
*/
|
|
52
|
+
private delay;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Configuration options for MockProofVerifier
|
|
56
|
+
*/
|
|
57
|
+
interface MockVerifierOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Delay in milliseconds to simulate verification time
|
|
60
|
+
* @default 0
|
|
61
|
+
*/
|
|
62
|
+
verificationDelayMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Whether verification should succeed (if no validation errors)
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
shouldVerify?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Errors to include in verification result
|
|
70
|
+
* @default []
|
|
71
|
+
*/
|
|
72
|
+
errors?: string[];
|
|
73
|
+
/**
|
|
74
|
+
* Warnings to include in verification result
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
|
+
warnings?: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Whether to validate binding context matches
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
validateBindingContext?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether to validate program ID matches
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
validateProgramId?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Custom validation function
|
|
90
|
+
*
|
|
91
|
+
* Return array of error messages, or undefined/empty array if valid
|
|
92
|
+
*/
|
|
93
|
+
customValidation?: (context: AgentContext, artifact: ProofArtifact, expectedContext: BindingContext) => Promise<string[] | undefined>;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { MockProofVerifier, MockVerifierOptions };
|
|
97
|
+
//# sourceMappingURL=MockProofVerifier.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockProofVerifier.d.mts","names":[],"sources":["../../../src/executor/__mocks__/MockProofVerifier.ts"],"mappings":";;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,iBAAA,YAA6B,aAAA;EAAA,SACxB,SAAA;EAAA,QAER,OAAA;EA4BN;;;;;;cApBiB,SAAA,UAAmB,OAAA,GAAS,mBAAA;EA6EvC;;;AAQV;;EAnEe,MAAA,CACX,OAAA,EAAS,YAAA,EACT,QAAA,EAAU,aAAA,EACV,eAAA,EAAiB,cAAA,GAChB,OAAA;IACD,QAAA;IACA,MAAA;IACA,QAAA;EAAA;EA0GU;;;EAAA,QAtDJ,KAAA;AAAA;;;;UAQO,mBAAA;EA2CJ;;;;EAtCX,mBAAA;EAwCE;;;;EAlCF,YAAA;;;;;EAMA,MAAA;;;;;EAMA,QAAA;;;;;EAMA,sBAAA;;;;;EAMA,iBAAA;;;;;;EAOA,gBAAA,IACE,OAAA,EAAS,YAAA,EACT,QAAA,EAAU,aAAA,EACV,eAAA,EAAiB,cAAA,KACd,OAAA;AAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region src/executor/__mocks__/MockProofVerifier.ts
|
|
2
|
+
/**
|
|
3
|
+
* Mock ZK proof verifier for testing.
|
|
4
|
+
*
|
|
5
|
+
* Simulates proof verification without actual cryptographic verification.
|
|
6
|
+
* Useful for integration tests and development.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const mockVerifier = new MockProofVerifier('mock-age-check', {
|
|
11
|
+
* verificationDelayMs: 50,
|
|
12
|
+
* shouldVerify: true
|
|
13
|
+
* })
|
|
14
|
+
*
|
|
15
|
+
* const agent = new Agent({
|
|
16
|
+
* modules: {
|
|
17
|
+
* poe: new PoeModule({
|
|
18
|
+
* verifiers: [mockVerifier]
|
|
19
|
+
* })
|
|
20
|
+
* }
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
var MockProofVerifier = class {
|
|
25
|
+
/**
|
|
26
|
+
* Create a new mock verifier
|
|
27
|
+
*
|
|
28
|
+
* @param programId - Program identifier (e.g., 'mock-age-check')
|
|
29
|
+
* @param options - Mock behavior options
|
|
30
|
+
*/
|
|
31
|
+
constructor(programId, options = {}) {
|
|
32
|
+
this.programId = programId;
|
|
33
|
+
this.options = {
|
|
34
|
+
verificationDelayMs: 0,
|
|
35
|
+
shouldVerify: true,
|
|
36
|
+
errors: [],
|
|
37
|
+
warnings: [],
|
|
38
|
+
validateBindingContext: true,
|
|
39
|
+
validateProgramId: true,
|
|
40
|
+
...options
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Verify the mock proof
|
|
45
|
+
*
|
|
46
|
+
* Returns verification result with configured behavior.
|
|
47
|
+
*/
|
|
48
|
+
async verify(context, artifact, expectedContext) {
|
|
49
|
+
if (this.options.verificationDelayMs && this.options.verificationDelayMs > 0) await this.delay(this.options.verificationDelayMs);
|
|
50
|
+
const errors = [...this.options.errors || []];
|
|
51
|
+
const warnings = [...this.options.warnings || []];
|
|
52
|
+
if (this.options.validateProgramId && artifact.program_id !== this.programId) errors.push(`Program ID mismatch: expected ${this.programId}, got ${artifact.program_id}`);
|
|
53
|
+
if (this.options.validateBindingContext) {
|
|
54
|
+
if (artifact.public.nonce !== expectedContext.nonce) errors.push("Nonce mismatch in binding context");
|
|
55
|
+
if (artifact.public.context_hash !== expectedContext.context_hash) errors.push("Context hash mismatch in binding context");
|
|
56
|
+
if (artifact.public.session_id !== expectedContext.session_id) errors.push("Session ID mismatch in binding context");
|
|
57
|
+
}
|
|
58
|
+
if (this.options.customValidation) {
|
|
59
|
+
const customErrors = await this.options.customValidation(context, artifact, expectedContext);
|
|
60
|
+
if (customErrors) errors.push(...customErrors);
|
|
61
|
+
}
|
|
62
|
+
const hasErrors = errors.length > 0;
|
|
63
|
+
return {
|
|
64
|
+
verified: (this.options.shouldVerify ?? true) && !hasErrors,
|
|
65
|
+
errors: errors.length > 0 ? errors : void 0,
|
|
66
|
+
warnings: warnings.length > 0 ? warnings : void 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Helper to introduce async delay
|
|
71
|
+
*/
|
|
72
|
+
delay(ms) {
|
|
73
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { MockProofVerifier };
|
|
79
|
+
//# sourceMappingURL=MockProofVerifier.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockProofVerifier.mjs","names":[],"sources":["../../../src/executor/__mocks__/MockProofVerifier.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type { ProofVerifier } from '../ProgramExecutor'\nimport type { ProofArtifact, BindingContext } from '../../models'\n\n/**\n * Mock ZK proof verifier for testing.\n *\n * Simulates proof verification without actual cryptographic verification.\n * Useful for integration tests and development.\n *\n * @example\n * ```typescript\n * const mockVerifier = new MockProofVerifier('mock-age-check', {\n * verificationDelayMs: 50,\n * shouldVerify: true\n * })\n *\n * const agent = new Agent({\n * modules: {\n * poe: new PoeModule({\n * verifiers: [mockVerifier]\n * })\n * }\n * })\n * ```\n */\nexport class MockProofVerifier implements ProofVerifier {\n public readonly programId: string\n\n private options: MockVerifierOptions\n\n /**\n * Create a new mock verifier\n *\n * @param programId - Program identifier (e.g., 'mock-age-check')\n * @param options - Mock behavior options\n */\n public constructor(programId: string, options: MockVerifierOptions = {}) {\n this.programId = programId\n this.options = {\n verificationDelayMs: 0,\n shouldVerify: true,\n errors: [],\n warnings: [],\n validateBindingContext: true,\n validateProgramId: true,\n ...options,\n }\n }\n\n /**\n * Verify the mock proof\n *\n * Returns verification result with configured behavior.\n */\n public async verify(\n context: AgentContext,\n artifact: ProofArtifact,\n expectedContext: BindingContext\n ): Promise<{\n verified: boolean\n errors?: string[]\n warnings?: string[]\n }> {\n // Simulate verification delay\n if (this.options.verificationDelayMs && this.options.verificationDelayMs > 0) {\n await this.delay(this.options.verificationDelayMs)\n }\n\n const errors: string[] = [...(this.options.errors || [])]\n const warnings: string[] = [...(this.options.warnings || [])]\n\n // Validate program ID if enabled\n if (this.options.validateProgramId && artifact.program_id !== this.programId) {\n errors.push(\n `Program ID mismatch: expected ${this.programId}, got ${artifact.program_id}`\n )\n }\n\n // Validate binding context if enabled\n if (this.options.validateBindingContext) {\n if (artifact.public.nonce !== expectedContext.nonce) {\n errors.push('Nonce mismatch in binding context')\n }\n if (artifact.public.context_hash !== expectedContext.context_hash) {\n errors.push('Context hash mismatch in binding context')\n }\n if (artifact.public.session_id !== expectedContext.session_id) {\n errors.push('Session ID mismatch in binding context')\n }\n }\n\n // Custom validation function\n if (this.options.customValidation) {\n const customErrors = await this.options.customValidation(context, artifact, expectedContext)\n if (customErrors) {\n errors.push(...customErrors)\n }\n }\n\n // Determine verification result\n const hasErrors = errors.length > 0\n const verified = (this.options.shouldVerify ?? true) && !hasErrors\n\n return {\n verified,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n }\n\n /**\n * Helper to introduce async delay\n */\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n }\n}\n\n/**\n * Configuration options for MockProofVerifier\n */\nexport interface MockVerifierOptions {\n /**\n * Delay in milliseconds to simulate verification time\n * @default 0\n */\n verificationDelayMs?: number\n\n /**\n * Whether verification should succeed (if no validation errors)\n * @default true\n */\n shouldVerify?: boolean\n\n /**\n * Errors to include in verification result\n * @default []\n */\n errors?: string[]\n\n /**\n * Warnings to include in verification result\n * @default []\n */\n warnings?: string[]\n\n /**\n * Whether to validate binding context matches\n * @default true\n */\n validateBindingContext?: boolean\n\n /**\n * Whether to validate program ID matches\n * @default true\n */\n validateProgramId?: boolean\n\n /**\n * Custom validation function\n *\n * Return array of error messages, or undefined/empty array if valid\n */\n customValidation?: (\n context: AgentContext,\n artifact: ProofArtifact,\n expectedContext: BindingContext\n ) => Promise<string[] | undefined>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAwD;;;;;;;CAWtD,AAAO,YAAY,WAAmB,UAA+B,EAAE,EAAE;AACvE,OAAK,YAAY;AACjB,OAAK,UAAU;GACb,qBAAqB;GACrB,cAAc;GACd,QAAQ,EAAE;GACV,UAAU,EAAE;GACZ,wBAAwB;GACxB,mBAAmB;GACnB,GAAG;GACJ;;;;;;;CAQH,MAAa,OACX,SACA,UACA,iBAKC;AAED,MAAI,KAAK,QAAQ,uBAAuB,KAAK,QAAQ,sBAAsB,EACzE,OAAM,KAAK,MAAM,KAAK,QAAQ,oBAAoB;EAGpD,MAAM,SAAmB,CAAC,GAAI,KAAK,QAAQ,UAAU,EAAE,CAAE;EACzD,MAAM,WAAqB,CAAC,GAAI,KAAK,QAAQ,YAAY,EAAE,CAAE;AAG7D,MAAI,KAAK,QAAQ,qBAAqB,SAAS,eAAe,KAAK,UACjE,QAAO,KACL,iCAAiC,KAAK,UAAU,QAAQ,SAAS,aAClE;AAIH,MAAI,KAAK,QAAQ,wBAAwB;AACvC,OAAI,SAAS,OAAO,UAAU,gBAAgB,MAC5C,QAAO,KAAK,oCAAoC;AAElD,OAAI,SAAS,OAAO,iBAAiB,gBAAgB,aACnD,QAAO,KAAK,2CAA2C;AAEzD,OAAI,SAAS,OAAO,eAAe,gBAAgB,WACjD,QAAO,KAAK,yCAAyC;;AAKzD,MAAI,KAAK,QAAQ,kBAAkB;GACjC,MAAM,eAAe,MAAM,KAAK,QAAQ,iBAAiB,SAAS,UAAU,gBAAgB;AAC5F,OAAI,aACF,QAAO,KAAK,GAAG,aAAa;;EAKhC,MAAM,YAAY,OAAO,SAAS;AAGlC,SAAO;GACL,WAHgB,KAAK,QAAQ,gBAAgB,SAAS,CAAC;GAIvD,QAAQ,OAAO,SAAS,IAAI,SAAS;GACrC,UAAU,SAAS,SAAS,IAAI,WAAW;GAC5C;;;;;CAMH,AAAQ,MAAM,IAA2B;AACvC,SAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExecutorFactory, ProgramExecutor, ProofVerifier, VerifierFactory } from "./ProgramExecutor.mjs";
|
|
2
|
+
import { ProgramExecutorRegistry } from "./ProgramExecutorRegistry.mjs";
|
|
3
|
+
import { MockExecutorOptions, MockProgramExecutor } from "./__mocks__/MockProgramExecutor.mjs";
|
|
4
|
+
import { MockProofVerifier, MockVerifierOptions } from "./__mocks__/MockProofVerifier.mjs";
|
|
5
|
+
import "./__mocks__/index.mjs";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { AcceptPoeMessage } from "../messages/AcceptPoeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/AcceptPoeMessageHandler.ts
|
|
6
|
+
/**
|
|
7
|
+
* Handler for incoming AcceptPoe messages.
|
|
8
|
+
*
|
|
9
|
+
* This handler is invoked when the prover receives an accept message
|
|
10
|
+
* from the requester, indicating that a proposal has been accepted.
|
|
11
|
+
*/
|
|
12
|
+
var AcceptPoeMessageHandler = class {
|
|
13
|
+
constructor(poeService) {
|
|
14
|
+
this.supportedMessages = [AcceptPoeMessage];
|
|
15
|
+
this.poeService = poeService;
|
|
16
|
+
}
|
|
17
|
+
async handle(messageContext) {
|
|
18
|
+
await this.poeService.processAccept(messageContext);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AcceptPoeMessageHandler };
|
|
24
|
+
//# sourceMappingURL=AcceptPoeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcceptPoeMessageHandler.mjs","names":[],"sources":["../../src/handlers/AcceptPoeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { AcceptPoeMessage } from '../messages'\nimport { PoeService } from '../services'\n\n/**\n * Handler for incoming AcceptPoe messages.\n *\n * This handler is invoked when the prover receives an accept message\n * from the requester, indicating that a proposal has been accepted.\n */\nexport class AcceptPoeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [AcceptPoeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<AcceptPoeMessageHandler>) {\n await this.poeService.processAccept(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,0BAAb,MAAsE;CAIpE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,iBAAiB;AAI3C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA8E;AAChG,QAAM,KAAK,WAAW,cAAc,eAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { ChallengeMessage } from "../messages/ChallengeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/ChallengeMessageHandler.ts
|
|
6
|
+
/**
|
|
7
|
+
* Handler for incoming Challenge messages.
|
|
8
|
+
*
|
|
9
|
+
* This handler is invoked when the prover receives a challenge message
|
|
10
|
+
* from the requester for interactive ZK programs.
|
|
11
|
+
*/
|
|
12
|
+
var ChallengeMessageHandler = class {
|
|
13
|
+
constructor(poeService) {
|
|
14
|
+
this.supportedMessages = [ChallengeMessage];
|
|
15
|
+
this.poeService = poeService;
|
|
16
|
+
}
|
|
17
|
+
async handle(messageContext) {
|
|
18
|
+
await this.poeService.processChallenge(messageContext);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ChallengeMessageHandler };
|
|
24
|
+
//# sourceMappingURL=ChallengeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChallengeMessageHandler.mjs","names":[],"sources":["../../src/handlers/ChallengeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { ChallengeMessage } from '../messages'\nimport { PoeService } from '../services'\n\n/**\n * Handler for incoming Challenge messages.\n *\n * This handler is invoked when the prover receives a challenge message\n * from the requester for interactive ZK programs.\n */\nexport class ChallengeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [ChallengeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<ChallengeMessageHandler>) {\n await this.poeService.processChallenge(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,0BAAb,MAAsE;CAIpE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,iBAAiB;AAI3C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA8E;AAChG,QAAM,KAAK,WAAW,iBAAiB,eAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { CompleteMessage } from "../messages/CompleteMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/CompleteMessageHandler.ts
|
|
6
|
+
/**
|
|
7
|
+
* Handler for incoming Complete messages.
|
|
8
|
+
*
|
|
9
|
+
* This handler is invoked when the prover receives a complete message
|
|
10
|
+
* from the requester, indicating that the protocol has finished successfully.
|
|
11
|
+
*/
|
|
12
|
+
var CompleteMessageHandler = class {
|
|
13
|
+
constructor(poeService) {
|
|
14
|
+
this.supportedMessages = [CompleteMessage];
|
|
15
|
+
this.poeService = poeService;
|
|
16
|
+
}
|
|
17
|
+
async handle(messageContext) {
|
|
18
|
+
await this.poeService.processComplete(messageContext);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CompleteMessageHandler };
|
|
24
|
+
//# sourceMappingURL=CompleteMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompleteMessageHandler.mjs","names":[],"sources":["../../src/handlers/CompleteMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { CompleteMessage } from '../messages'\nimport { PoeService } from '../services'\n\n/**\n * Handler for incoming Complete messages.\n *\n * This handler is invoked when the prover receives a complete message\n * from the requester, indicating that the protocol has finished successfully.\n */\nexport class CompleteMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [CompleteMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<CompleteMessageHandler>) {\n await this.poeService.processComplete(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,yBAAb,MAAqE;CAInE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,gBAAgB;AAI1C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA6E;AAC/F,QAAM,KAAK,WAAW,gBAAgB,eAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { DeclinePoeMessage } from "../messages/DeclinePoeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/DeclinePoeMessageHandler.ts
|
|
6
|
+
/**
|
|
7
|
+
* Handler for incoming DeclinePoe messages.
|
|
8
|
+
*
|
|
9
|
+
* This handler is invoked when the prover receives a decline message
|
|
10
|
+
* from the requester, indicating that a proposal has been rejected.
|
|
11
|
+
*/
|
|
12
|
+
var DeclinePoeMessageHandler = class {
|
|
13
|
+
constructor(poeService) {
|
|
14
|
+
this.supportedMessages = [DeclinePoeMessage];
|
|
15
|
+
this.poeService = poeService;
|
|
16
|
+
}
|
|
17
|
+
async handle(messageContext) {
|
|
18
|
+
await this.poeService.processDecline(messageContext);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { DeclinePoeMessageHandler };
|
|
24
|
+
//# sourceMappingURL=DeclinePoeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeclinePoeMessageHandler.mjs","names":[],"sources":["../../src/handlers/DeclinePoeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { DeclinePoeMessage } from '../messages'\nimport { PoeService } from '../services'\n\n/**\n * Handler for incoming DeclinePoe messages.\n *\n * This handler is invoked when the prover receives a decline message\n * from the requester, indicating that a proposal has been rejected.\n */\nexport class DeclinePoeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [DeclinePoeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<DeclinePoeMessageHandler>) {\n await this.poeService.processDecline(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,2BAAb,MAAuE;CAIrE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,kBAAkB;AAI5C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA+E;AACjG,QAAM,KAAK,WAAW,eAAe,eAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { PoeProblemReportMessage } from "../messages/PoeProblemReportMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/PoeProblemReportMessageHandler.ts
|
|
6
|
+
var PoeProblemReportMessageHandler = class {
|
|
7
|
+
constructor(poeService) {
|
|
8
|
+
this.supportedMessages = [PoeProblemReportMessage];
|
|
9
|
+
this.poeService = poeService;
|
|
10
|
+
}
|
|
11
|
+
async handle(messageContext) {
|
|
12
|
+
await this.poeService.processProblemReport(messageContext);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PoeProblemReportMessageHandler };
|
|
18
|
+
//# sourceMappingURL=PoeProblemReportMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PoeProblemReportMessageHandler.mjs","names":[],"sources":["../../src/handlers/PoeProblemReportMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { PoeProblemReportMessage } from '../messages'\nimport { PoeService } from '../services'\n\nexport class PoeProblemReportMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [PoeProblemReportMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<PoeProblemReportMessageHandler>) {\n await this.poeService.processProblemReport(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;AAKA,IAAa,iCAAb,MAA6E;CAI3E,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,wBAAwB;AAIlD,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAAqF;AACvG,QAAM,KAAK,WAAW,qBAAqB,eAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { ProposePoeMessage } from "../messages/ProposePoeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/ProposePoeMessageHandler.ts
|
|
6
|
+
var ProposePoeMessageHandler = class {
|
|
7
|
+
constructor(poeService) {
|
|
8
|
+
this.supportedMessages = [ProposePoeMessage];
|
|
9
|
+
this.poeService = poeService;
|
|
10
|
+
}
|
|
11
|
+
async handle(messageContext) {
|
|
12
|
+
await this.poeService.processProposal(messageContext);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ProposePoeMessageHandler };
|
|
18
|
+
//# sourceMappingURL=ProposePoeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProposePoeMessageHandler.mjs","names":[],"sources":["../../src/handlers/ProposePoeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { ProposePoeMessage } from '../messages'\nimport { PoeService } from '../services'\n\nexport class ProposePoeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [ProposePoeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<ProposePoeMessageHandler>) {\n await this.poeService.processProposal(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;AAKA,IAAa,2BAAb,MAAuE;CAIrE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,kBAAkB;AAI5C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA+E;AACjG,QAAM,KAAK,WAAW,gBAAgB,eAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { RequestPoeMessage } from "../messages/RequestPoeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/RequestPoeMessageHandler.ts
|
|
6
|
+
var RequestPoeMessageHandler = class {
|
|
7
|
+
constructor(poeService) {
|
|
8
|
+
this.supportedMessages = [RequestPoeMessage];
|
|
9
|
+
this.poeService = poeService;
|
|
10
|
+
}
|
|
11
|
+
async handle(messageContext) {
|
|
12
|
+
await this.poeService.processRequest(messageContext);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { RequestPoeMessageHandler };
|
|
18
|
+
//# sourceMappingURL=RequestPoeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestPoeMessageHandler.mjs","names":[],"sources":["../../src/handlers/RequestPoeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { RequestPoeMessage } from '../messages'\nimport { PoeService } from '../services'\n\nexport class RequestPoeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [RequestPoeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<RequestPoeMessageHandler>) {\n await this.poeService.processRequest(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;AAKA,IAAa,2BAAb,MAAuE;CAIrE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,kBAAkB;AAI5C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA+E;AACjG,QAAM,KAAK,WAAW,eAAe,eAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "../services/index.mjs";
|
|
2
|
+
import { SubmitPoeMessage } from "../messages/SubmitPoeMessage.mjs";
|
|
3
|
+
import "../messages/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/handlers/SubmitPoeMessageHandler.ts
|
|
6
|
+
var SubmitPoeMessageHandler = class {
|
|
7
|
+
constructor(poeService) {
|
|
8
|
+
this.supportedMessages = [SubmitPoeMessage];
|
|
9
|
+
this.poeService = poeService;
|
|
10
|
+
}
|
|
11
|
+
async handle(messageContext) {
|
|
12
|
+
await this.poeService.processSubmit(messageContext);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SubmitPoeMessageHandler };
|
|
18
|
+
//# sourceMappingURL=SubmitPoeMessageHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubmitPoeMessageHandler.mjs","names":[],"sources":["../../src/handlers/SubmitPoeMessageHandler.ts"],"sourcesContent":["import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm'\n\nimport { SubmitPoeMessage } from '../messages'\nimport { PoeService } from '../services'\n\nexport class SubmitPoeMessageHandler implements DidCommMessageHandler {\n public supportedMessages = [SubmitPoeMessage]\n private poeService: PoeService\n\n public constructor(poeService: PoeService) {\n this.poeService = poeService\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<SubmitPoeMessageHandler>) {\n await this.poeService.processSubmit(messageContext)\n return undefined\n }\n}\n"],"mappings":";;;;;AAKA,IAAa,0BAAb,MAAsE;CAIpE,AAAO,YAAY,YAAwB;OAHpC,oBAAoB,CAAC,iBAAiB;AAI3C,OAAK,aAAa;;CAGpB,MAAa,OAAO,gBAA8E;AAChG,QAAM,KAAK,WAAW,cAAc,eAAe"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RequestPoeMessageHandler } from "./RequestPoeMessageHandler.mjs";
|
|
2
|
+
import { ProposePoeMessageHandler } from "./ProposePoeMessageHandler.mjs";
|
|
3
|
+
import { AcceptPoeMessageHandler } from "./AcceptPoeMessageHandler.mjs";
|
|
4
|
+
import { DeclinePoeMessageHandler } from "./DeclinePoeMessageHandler.mjs";
|
|
5
|
+
import { ChallengeMessageHandler } from "./ChallengeMessageHandler.mjs";
|
|
6
|
+
import { SubmitPoeMessageHandler } from "./SubmitPoeMessageHandler.mjs";
|
|
7
|
+
import { CompleteMessageHandler } from "./CompleteMessageHandler.mjs";
|
|
8
|
+
import { PoeProblemReportMessageHandler } from "./PoeProblemReportMessageHandler.mjs";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PoeRole } from "./PoeRole.mjs";
|
|
2
|
+
import { PoeState } from "./PoeState.mjs";
|
|
3
|
+
import { BindingContext, bindingContextsEqual, validateBindingContext } from "./models/BindingContext.mjs";
|
|
4
|
+
import { DisclosureLevel, EncryptionInfo, ExecutionPolicy, InputReference, ProgramExecution, ProgramInputs, TransportHints } from "./models/ProgramExecution.mjs";
|
|
5
|
+
import { ChallengeSpec, ChallengeStep, EvidenceReference, ExecutionReceipt, ExecutionSummary, ProofArtifact, ProofResult, PublicOutputs, VerificationResult, ZKProof, ZKScheme } from "./models/ProofArtifact.mjs";
|
|
6
|
+
import { CustomPoeTags, DefaultPoeTags, PoeSessionRecord, PoeSessionStorageProps, PoeTags } from "./repository/PoeSessionRecord.mjs";
|
|
7
|
+
import { PoeSessionRepository } from "./repository/PoeSessionRepository.mjs";
|
|
8
|
+
import { CustomNonceTags, DefaultNonceTags, NonceRecord, NonceRecordStorageProps } from "./repository/NonceRecord.mjs";
|
|
9
|
+
import { NonceRepository } from "./repository/NonceRepository.mjs";
|
|
10
|
+
import "./repository/index.mjs";
|
|
11
|
+
import { ProgramMetadata } from "./registry/ProgramRegistry.mjs";
|
|
12
|
+
import { ProofSystem, VerifyingKey } from "./registry/ProofSystemRegistry.mjs";
|
|
13
|
+
import { ExecutorFactory, ProgramExecutor, ProofVerifier, VerifierFactory } from "./executor/ProgramExecutor.mjs";
|
|
14
|
+
import { ProgramExecutorRegistry } from "./executor/ProgramExecutorRegistry.mjs";
|
|
15
|
+
import { RequestPoeMessage, RequestPoeMessageOptions } from "./messages/RequestPoeMessage.mjs";
|
|
16
|
+
import { ProposePoeMessage, ProposePoeMessageOptions } from "./messages/ProposePoeMessage.mjs";
|
|
17
|
+
import { AcceptPoeMessage, AcceptPoeMessageOptions } from "./messages/AcceptPoeMessage.mjs";
|
|
18
|
+
import { DeclinePoeMessage, DeclinePoeMessageOptions } from "./messages/DeclinePoeMessage.mjs";
|
|
19
|
+
import { ChallengeMessage, ChallengeMessageOptions } from "./messages/ChallengeMessage.mjs";
|
|
20
|
+
import { SubmitPoeMessage, SubmitPoeMessageOptions } from "./messages/SubmitPoeMessage.mjs";
|
|
21
|
+
import { CompleteMessage, CompleteMessageOptions } from "./messages/CompleteMessage.mjs";
|
|
22
|
+
import { AttesterUnavailableError, BindingContextError, ContextMismatchError, ExpiredChallengeError, ExpiryError, InvalidInputsError, NonceError, PoeError, PoeErrorCode, PolicyViolationError, ProgramNotSupportedError, ProgramParametersError, ProofVerificationError, RateLimitedError, TooLargeError, VerifyingKeyError } from "./errors/PoeError.mjs";
|
|
23
|
+
import { PoeProblemReportMessage, PoeProblemReportMessageOptions } from "./messages/PoeProblemReportMessage.mjs";
|
|
24
|
+
import "./messages/index.mjs";
|
|
25
|
+
import { PoeApi } from "./PoeApi.mjs";
|
|
26
|
+
import { PoeProgram, ProverOnlyProgram, VerifierOnlyProgram, isPoeProgram } from "./programs/PoeProgram.mjs";
|
|
27
|
+
import { PoeModuleConfig } from "./PoeModuleConfig.mjs";
|
|
28
|
+
import { PoeModule } from "./PoeModule.mjs";
|
|
29
|
+
import { PoeAcceptReceivedEvent, PoeAcceptSentEvent, PoeChallengeReceivedEvent, PoeChallengeSentEvent, PoeCompleteReceivedEvent, PoeCompleteSentEvent, PoeCompletedEvent, PoeDeclineReceivedEvent, PoeDeclineSentEvent, PoeEvent, PoeEventTypes, PoeProblemReportEvent, PoeProposalReceivedEvent, PoeProposalSentEvent, PoeRequestReceivedEvent, PoeRequestSentEvent, PoeStateChangedEvent, PoeSubmitReceivedEvent, PoeSubmitSentEvent } from "./PoeEvents.mjs";
|
|
30
|
+
import "./errors/index.mjs";
|
|
31
|
+
import { MockExecutorOptions, MockProgramExecutor } from "./executor/__mocks__/MockProgramExecutor.mjs";
|
|
32
|
+
import { MockProofVerifier, MockVerifierOptions } from "./executor/__mocks__/MockProofVerifier.mjs";
|
|
33
|
+
import "./executor/index.mjs";
|
|
34
|
+
import { MockProgram, MockProgramOptions } from "./programs/examples/MockProgram.mjs";
|
|
35
|
+
import { AppAttestationExecuteArgs, AppAttestationProgram, AppAttestationProgramOptions, AppAttestationProofProvider, AppAttestationProverResult, PUBLIC_INPUT_INDEX, canonicalVkHash } from "./programs/AppAttestationProgram.mjs";
|
|
36
|
+
import "./programs/index.mjs";
|
|
37
|
+
import { PoeAcceptProposalAction, PoeCompleteAction, PoeDeclineProposalAction, PoeProblemReportAction, PoeProposalAction, PoeRequestAction, PoeSubmitAction, WorkflowActionHandlerLike, createPoeV1Actions } from "./workflow/PoeV1Actions.mjs";
|
|
38
|
+
export { AcceptPoeMessage, AcceptPoeMessageOptions, AppAttestationExecuteArgs, AppAttestationProgram, AppAttestationProgramOptions, AppAttestationProofProvider, AppAttestationProverResult, AttesterUnavailableError, BindingContext, BindingContextError, ChallengeMessage, ChallengeMessageOptions, ChallengeSpec, ChallengeStep, CompleteMessage, CompleteMessageOptions, ContextMismatchError, CustomNonceTags, CustomPoeTags, DeclinePoeMessage, DeclinePoeMessageOptions, DefaultNonceTags, DefaultPoeTags, DisclosureLevel, EncryptionInfo, EvidenceReference, ExecutionPolicy, ExecutionReceipt, ExecutionSummary, ExecutorFactory, ExpiredChallengeError, ExpiryError, InputReference, InvalidInputsError, MockExecutorOptions, MockProgram, MockProgramExecutor, MockProgramOptions, MockProofVerifier, MockVerifierOptions, NonceError, NonceRecord, NonceRecordStorageProps, NonceRepository, PUBLIC_INPUT_INDEX, PoeAcceptProposalAction, PoeAcceptReceivedEvent, PoeAcceptSentEvent, PoeApi, PoeChallengeReceivedEvent, PoeChallengeSentEvent, PoeCompleteAction, PoeCompleteReceivedEvent, PoeCompleteSentEvent, PoeCompletedEvent, PoeDeclineProposalAction, PoeDeclineReceivedEvent, PoeDeclineSentEvent, PoeError, PoeErrorCode, PoeEvent, PoeEventTypes, PoeModule, type PoeModuleConfig, PoeProblemReportAction, PoeProblemReportEvent, PoeProblemReportMessage, PoeProblemReportMessageOptions, PoeProgram, PoeProposalAction, PoeProposalReceivedEvent, PoeProposalSentEvent, PoeRequestAction, PoeRequestReceivedEvent, PoeRequestSentEvent, PoeRole, PoeSessionRecord, PoeSessionRepository, PoeSessionStorageProps, PoeState, PoeStateChangedEvent, PoeSubmitAction, PoeSubmitReceivedEvent, PoeSubmitSentEvent, PoeTags, PolicyViolationError, ProgramExecution, ProgramExecutor, ProgramExecutorRegistry, ProgramInputs, type ProgramMetadata, ProgramNotSupportedError, ProgramParametersError, ProofArtifact, ProofResult, type ProofSystem, ProofVerificationError, ProofVerifier, ProposePoeMessage, ProposePoeMessageOptions, ProverOnlyProgram, PublicOutputs, RateLimitedError, RequestPoeMessage, RequestPoeMessageOptions, SubmitPoeMessage, SubmitPoeMessageOptions, TooLargeError, TransportHints, VerificationResult, VerifierFactory, VerifierOnlyProgram, type VerifyingKey, VerifyingKeyError, WorkflowActionHandlerLike, ZKProof, ZKScheme, bindingContextsEqual, canonicalVkHash, createPoeV1Actions, isPoeProgram, validateBindingContext };
|
package/build/index.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AttesterUnavailableError, BindingContextError, ContextMismatchError, ExpiredChallengeError, ExpiryError, InvalidInputsError, NonceError, PoeError, PoeErrorCode, PolicyViolationError, ProgramNotSupportedError, ProgramParametersError, ProofVerificationError, RateLimitedError, TooLargeError, VerifyingKeyError } from "./errors/PoeError.mjs";
|
|
2
|
+
import "./errors/index.mjs";
|
|
3
|
+
import { NonceRecord } from "./repository/NonceRecord.mjs";
|
|
4
|
+
import { NonceRepository } from "./repository/NonceRepository.mjs";
|
|
5
|
+
import { bindingContextsEqual, validateBindingContext } from "./models/BindingContext.mjs";
|
|
6
|
+
import { ProgramExecutorRegistry } from "./executor/ProgramExecutorRegistry.mjs";
|
|
7
|
+
import { PoeSessionRecord } from "./repository/PoeSessionRecord.mjs";
|
|
8
|
+
import { PoeSessionRepository } from "./repository/PoeSessionRepository.mjs";
|
|
9
|
+
import "./repository/index.mjs";
|
|
10
|
+
import { PoeState } from "./PoeState.mjs";
|
|
11
|
+
import { PoeRole } from "./PoeRole.mjs";
|
|
12
|
+
import { PoeEventTypes } from "./PoeEvents.mjs";
|
|
13
|
+
import { PoeApi } from "./PoeApi.mjs";
|
|
14
|
+
import { RequestPoeMessage } from "./messages/RequestPoeMessage.mjs";
|
|
15
|
+
import { ProposePoeMessage } from "./messages/ProposePoeMessage.mjs";
|
|
16
|
+
import { AcceptPoeMessage } from "./messages/AcceptPoeMessage.mjs";
|
|
17
|
+
import { DeclinePoeMessage } from "./messages/DeclinePoeMessage.mjs";
|
|
18
|
+
import { ChallengeMessage } from "./messages/ChallengeMessage.mjs";
|
|
19
|
+
import { SubmitPoeMessage } from "./messages/SubmitPoeMessage.mjs";
|
|
20
|
+
import { CompleteMessage } from "./messages/CompleteMessage.mjs";
|
|
21
|
+
import { PoeProblemReportMessage } from "./messages/PoeProblemReportMessage.mjs";
|
|
22
|
+
import "./messages/index.mjs";
|
|
23
|
+
import { PoeModule } from "./PoeModule.mjs";
|
|
24
|
+
import { MockProgramExecutor } from "./executor/__mocks__/MockProgramExecutor.mjs";
|
|
25
|
+
import { MockProofVerifier } from "./executor/__mocks__/MockProofVerifier.mjs";
|
|
26
|
+
import "./executor/index.mjs";
|
|
27
|
+
import { PoeProgram, ProverOnlyProgram, VerifierOnlyProgram, isPoeProgram } from "./programs/PoeProgram.mjs";
|
|
28
|
+
import { MockProgram } from "./programs/examples/MockProgram.mjs";
|
|
29
|
+
import { AppAttestationProgram, PUBLIC_INPUT_INDEX, canonicalVkHash } from "./programs/AppAttestationProgram.mjs";
|
|
30
|
+
import "./programs/index.mjs";
|
|
31
|
+
import { PoeAcceptProposalAction, PoeCompleteAction, PoeDeclineProposalAction, PoeProblemReportAction, PoeProposalAction, PoeRequestAction, PoeSubmitAction, createPoeV1Actions } from "./workflow/PoeV1Actions.mjs";
|
|
32
|
+
|
|
33
|
+
export { AcceptPoeMessage, AppAttestationProgram, AttesterUnavailableError, BindingContextError, ChallengeMessage, CompleteMessage, ContextMismatchError, DeclinePoeMessage, ExpiredChallengeError, ExpiryError, InvalidInputsError, MockProgram, MockProgramExecutor, MockProofVerifier, NonceError, NonceRecord, NonceRepository, PUBLIC_INPUT_INDEX, PoeAcceptProposalAction, PoeApi, PoeCompleteAction, PoeDeclineProposalAction, PoeError, PoeErrorCode, PoeEventTypes, PoeModule, PoeProblemReportAction, PoeProblemReportMessage, PoeProgram, PoeProposalAction, PoeRequestAction, PoeRole, PoeSessionRecord, PoeSessionRepository, PoeState, PoeSubmitAction, PolicyViolationError, ProgramExecutorRegistry, ProgramNotSupportedError, ProgramParametersError, ProofVerificationError, ProposePoeMessage, ProverOnlyProgram, RateLimitedError, RequestPoeMessage, SubmitPoeMessage, TooLargeError, VerifierOnlyProgram, VerifyingKeyError, bindingContextsEqual, canonicalVkHash, createPoeV1Actions, isPoeProgram, validateBindingContext };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as _credo_ts_didcomm0 from "@credo-ts/didcomm";
|
|
2
|
+
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
|
+
|
|
4
|
+
//#region src/messages/AcceptPoeMessage.d.ts
|
|
5
|
+
interface AcceptPoeMessageOptions {
|
|
6
|
+
id?: string;
|
|
7
|
+
threadId: string;
|
|
8
|
+
programId: string;
|
|
9
|
+
publicConstraints?: Record<string, unknown>;
|
|
10
|
+
inputsDigest?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Message for accepting a program/proposal
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```json
|
|
17
|
+
* {
|
|
18
|
+
* "type": "https://didcomm.org/poe/1.0/accept-poe",
|
|
19
|
+
* "id": "acc-1",
|
|
20
|
+
* "thid": "req-123",
|
|
21
|
+
* "body": {
|
|
22
|
+
* "program_id": "vendor.policy.eval.v1",
|
|
23
|
+
* "public_constraints": { "params_hash": "0x...32B" },
|
|
24
|
+
* "inputs_digest": "0x...32B"
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class AcceptPoeMessage extends DidCommMessage {
|
|
30
|
+
constructor(options: AcceptPoeMessageOptions);
|
|
31
|
+
readonly type: string;
|
|
32
|
+
static readonly type: _credo_ts_didcomm0.ParsedMessageType;
|
|
33
|
+
/**
|
|
34
|
+
* Accepted program ID
|
|
35
|
+
*/
|
|
36
|
+
programId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Public constraints for the accepted program
|
|
39
|
+
*/
|
|
40
|
+
publicConstraints?: Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Digest of the inputs for verification
|
|
43
|
+
*/
|
|
44
|
+
inputsDigest?: string;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { AcceptPoeMessage, AcceptPoeMessageOptions };
|
|
48
|
+
//# sourceMappingURL=AcceptPoeMessage.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcceptPoeMessage.d.mts","names":[],"sources":["../../src/messages/AcceptPoeMessage.ts"],"mappings":";;;;UAIiB,uBAAA;EACf,EAAA;EACA,QAAA;EACA,SAAA;EACA,iBAAA,GAAoB,MAAA;EACpB,YAAA;AAAA;;;;;;;;;AAoBF;;;;;;;;;cAAa,gBAAA,SAAyB,cAAA;cACjB,OAAA,EAAS,uBAAA;EAAA,SAaZ,IAAA;EAAA,gBACO,IAAA,EAd4B,kBAAA,CAcxB,iBAAA;EADX;;;EAQT,SAAA;EAQA;;;EAAA,iBAAA,GAAoB,MAAA;EAQR;;;EAAZ,YAAA;AAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs";
|
|
2
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
|
|
3
|
+
import { DidCommMessage, IsValidMessageType, parseMessageType } from "@credo-ts/didcomm";
|
|
4
|
+
import { Expose } from "class-transformer";
|
|
5
|
+
import { IsObject, IsOptional, IsString } from "class-validator";
|
|
6
|
+
|
|
7
|
+
//#region src/messages/AcceptPoeMessage.ts
|
|
8
|
+
var _ref;
|
|
9
|
+
/**
|
|
10
|
+
* Message for accepting a program/proposal
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```json
|
|
14
|
+
* {
|
|
15
|
+
* "type": "https://didcomm.org/poe/1.0/accept-poe",
|
|
16
|
+
* "id": "acc-1",
|
|
17
|
+
* "thid": "req-123",
|
|
18
|
+
* "body": {
|
|
19
|
+
* "program_id": "vendor.policy.eval.v1",
|
|
20
|
+
* "public_constraints": { "params_hash": "0x...32B" },
|
|
21
|
+
* "inputs_digest": "0x...32B"
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var AcceptPoeMessage = class AcceptPoeMessage extends DidCommMessage {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super();
|
|
29
|
+
this.type = AcceptPoeMessage.type.messageTypeUri;
|
|
30
|
+
if (options) {
|
|
31
|
+
this.id = options.id ?? this.generateId();
|
|
32
|
+
this.setThread({ threadId: options.threadId });
|
|
33
|
+
this.programId = options.programId;
|
|
34
|
+
this.publicConstraints = options.publicConstraints;
|
|
35
|
+
this.inputsDigest = options.inputsDigest;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
AcceptPoeMessage.type = parseMessageType("https://didcomm.org/poe/1.0/accept-poe");
|
|
40
|
+
__decorate([IsValidMessageType(AcceptPoeMessage.type), __decorateMetadata("design:type", Object)], AcceptPoeMessage.prototype, "type", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
Expose({ name: "program_id" }),
|
|
43
|
+
IsString(),
|
|
44
|
+
__decorateMetadata("design:type", String)
|
|
45
|
+
], AcceptPoeMessage.prototype, "programId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Expose({ name: "public_constraints" }),
|
|
48
|
+
IsOptional(),
|
|
49
|
+
IsObject(),
|
|
50
|
+
__decorateMetadata("design:type", Object)
|
|
51
|
+
], AcceptPoeMessage.prototype, "publicConstraints", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Expose({ name: "inputs_digest" }),
|
|
54
|
+
IsOptional(),
|
|
55
|
+
IsString(),
|
|
56
|
+
__decorateMetadata("design:type", String)
|
|
57
|
+
], AcceptPoeMessage.prototype, "inputsDigest", void 0);
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { AcceptPoeMessage };
|
|
61
|
+
//# sourceMappingURL=AcceptPoeMessage.mjs.map
|