@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,260 @@
|
|
|
1
|
+
import { BindingContext } from "./BindingContext.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/models/ProofArtifact.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Complete proof artifact returned by the prover
|
|
6
|
+
*/
|
|
7
|
+
interface ProofArtifact {
|
|
8
|
+
/**
|
|
9
|
+
* Program identifier
|
|
10
|
+
*/
|
|
11
|
+
program_id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Result of the execution
|
|
14
|
+
*/
|
|
15
|
+
result: ProofResult;
|
|
16
|
+
/**
|
|
17
|
+
* Public outputs (including binding context)
|
|
18
|
+
*/
|
|
19
|
+
public: PublicOutputs;
|
|
20
|
+
/**
|
|
21
|
+
* Zero-knowledge proof
|
|
22
|
+
*/
|
|
23
|
+
zk: ZKProof;
|
|
24
|
+
/**
|
|
25
|
+
* Optional execution summary (if disclosure level permits)
|
|
26
|
+
*/
|
|
27
|
+
summary?: ExecutionSummary;
|
|
28
|
+
/**
|
|
29
|
+
* Optional evidence references (if disclosure level permits)
|
|
30
|
+
*/
|
|
31
|
+
evidence_refs?: EvidenceReference[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result of proof execution
|
|
35
|
+
*/
|
|
36
|
+
type ProofResult = 'pass' | 'fail' | 'partial';
|
|
37
|
+
/**
|
|
38
|
+
* Public outputs that are revealed (not zero-knowledge)
|
|
39
|
+
*/
|
|
40
|
+
interface PublicOutputs extends BindingContext {
|
|
41
|
+
/**
|
|
42
|
+
* Schema identifier for public outputs validation
|
|
43
|
+
*/
|
|
44
|
+
schema: string;
|
|
45
|
+
/**
|
|
46
|
+
* Hash of the outputs (for integrity)
|
|
47
|
+
*/
|
|
48
|
+
outputs_hash?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Hash of the verifying key used
|
|
51
|
+
*/
|
|
52
|
+
vk_hash: string;
|
|
53
|
+
/**
|
|
54
|
+
* Timestamp when proof was generated
|
|
55
|
+
*/
|
|
56
|
+
timestamp?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Program-specific public outputs
|
|
59
|
+
*/
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Zero-knowledge proof data
|
|
64
|
+
*/
|
|
65
|
+
interface ZKProof {
|
|
66
|
+
/**
|
|
67
|
+
* ZK proof scheme (e.g., 'stark', 'snark', 'groth16', 'plonk', 'bulletproofs')
|
|
68
|
+
*/
|
|
69
|
+
scheme: ZKScheme;
|
|
70
|
+
/**
|
|
71
|
+
* Circuit identifier
|
|
72
|
+
*/
|
|
73
|
+
circuit_id: string;
|
|
74
|
+
/**
|
|
75
|
+
* Hash of the verifying key
|
|
76
|
+
*/
|
|
77
|
+
vk_hash: string;
|
|
78
|
+
/**
|
|
79
|
+
* Base64-encoded proof bytes
|
|
80
|
+
*/
|
|
81
|
+
proof_b64: string;
|
|
82
|
+
/**
|
|
83
|
+
* Optional metadata about the proof
|
|
84
|
+
*/
|
|
85
|
+
metadata?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Supported zero-knowledge proof schemes
|
|
89
|
+
*/
|
|
90
|
+
type ZKScheme = 'stark' | 'snark' | 'groth16' | 'plonk' | 'bulletproofs' | 'schnorr' | string;
|
|
91
|
+
/**
|
|
92
|
+
* Summary of execution (if disclosure permits)
|
|
93
|
+
*/
|
|
94
|
+
interface ExecutionSummary {
|
|
95
|
+
/**
|
|
96
|
+
* High-level evidence summary (e.g., ["constraint_A_met", "constraint_B_met"])
|
|
97
|
+
*/
|
|
98
|
+
evidence_summary?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Execution metrics (e.g., runtime, memory used)
|
|
101
|
+
*/
|
|
102
|
+
metrics?: Record<string, number>;
|
|
103
|
+
/**
|
|
104
|
+
* Relevant timestamps
|
|
105
|
+
*/
|
|
106
|
+
timestamps?: Record<string, string>;
|
|
107
|
+
/**
|
|
108
|
+
* Step-by-step execution trace (boolean flags)
|
|
109
|
+
*/
|
|
110
|
+
steps?: Record<string, boolean>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Reference to encrypted evidence stored externally
|
|
114
|
+
*/
|
|
115
|
+
interface EvidenceReference {
|
|
116
|
+
/**
|
|
117
|
+
* Unique identifier for this evidence reference
|
|
118
|
+
*/
|
|
119
|
+
id: string;
|
|
120
|
+
/**
|
|
121
|
+
* Format is always by-reference
|
|
122
|
+
*/
|
|
123
|
+
format: 'by-reference';
|
|
124
|
+
/**
|
|
125
|
+
* Media type of the evidence
|
|
126
|
+
*/
|
|
127
|
+
media_type: string;
|
|
128
|
+
/**
|
|
129
|
+
* Reference data
|
|
130
|
+
*/
|
|
131
|
+
data: {
|
|
132
|
+
/**
|
|
133
|
+
* Links where evidence can be retrieved (IPFS, HTTP, etc.)
|
|
134
|
+
*/
|
|
135
|
+
links: string[];
|
|
136
|
+
/**
|
|
137
|
+
* Encryption algorithm
|
|
138
|
+
*/
|
|
139
|
+
alg: string;
|
|
140
|
+
/**
|
|
141
|
+
* Key reference for decryption
|
|
142
|
+
*/
|
|
143
|
+
keyref: string;
|
|
144
|
+
/**
|
|
145
|
+
* Optional digest for integrity verification
|
|
146
|
+
*/
|
|
147
|
+
digest?: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Result of proof verification by the requester
|
|
152
|
+
*/
|
|
153
|
+
interface VerificationResult {
|
|
154
|
+
/**
|
|
155
|
+
* Whether the proof verified successfully
|
|
156
|
+
*/
|
|
157
|
+
verified: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Timestamp of verification
|
|
160
|
+
*/
|
|
161
|
+
timestamp: Date;
|
|
162
|
+
/**
|
|
163
|
+
* DID of the verifier
|
|
164
|
+
*/
|
|
165
|
+
verifier_did?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Any verification errors
|
|
168
|
+
*/
|
|
169
|
+
errors?: string[];
|
|
170
|
+
/**
|
|
171
|
+
* Optional receipt issued after successful verification
|
|
172
|
+
*/
|
|
173
|
+
receipt?: ExecutionReceipt;
|
|
174
|
+
/**
|
|
175
|
+
* Additional verification metadata
|
|
176
|
+
*/
|
|
177
|
+
metadata?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Receipt issued after successful proof verification (can be a VC)
|
|
181
|
+
*/
|
|
182
|
+
interface ExecutionReceipt {
|
|
183
|
+
/**
|
|
184
|
+
* Unique receipt identifier
|
|
185
|
+
*/
|
|
186
|
+
receipt_id: string;
|
|
187
|
+
/**
|
|
188
|
+
* Hash of the proof that was verified
|
|
189
|
+
*/
|
|
190
|
+
proof_hash: string;
|
|
191
|
+
/**
|
|
192
|
+
* When the receipt was issued
|
|
193
|
+
*/
|
|
194
|
+
issued_at: string;
|
|
195
|
+
/**
|
|
196
|
+
* DID of the issuer (requester/verifier)
|
|
197
|
+
*/
|
|
198
|
+
issuer_did: string;
|
|
199
|
+
/**
|
|
200
|
+
* Session ID for audit trail
|
|
201
|
+
*/
|
|
202
|
+
session_id: string;
|
|
203
|
+
/**
|
|
204
|
+
* Program that was executed
|
|
205
|
+
*/
|
|
206
|
+
program_id: string;
|
|
207
|
+
/**
|
|
208
|
+
* Result of the execution
|
|
209
|
+
*/
|
|
210
|
+
result: ProofResult;
|
|
211
|
+
/**
|
|
212
|
+
* Expiration time for the receipt
|
|
213
|
+
*/
|
|
214
|
+
expires_at?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Additional receipt claims
|
|
217
|
+
*/
|
|
218
|
+
[key: string]: unknown;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Challenge specification for interactive programs
|
|
222
|
+
*/
|
|
223
|
+
interface ChallengeSpec {
|
|
224
|
+
/**
|
|
225
|
+
* Steps to be performed
|
|
226
|
+
*/
|
|
227
|
+
steps?: ChallengeStep[];
|
|
228
|
+
/**
|
|
229
|
+
* Time-to-live for the challenge
|
|
230
|
+
*/
|
|
231
|
+
ttl_s?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Sequence number (for multi-round challenges)
|
|
234
|
+
*/
|
|
235
|
+
sequence?: number;
|
|
236
|
+
/**
|
|
237
|
+
* Custom challenge data
|
|
238
|
+
*/
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Individual challenge step
|
|
243
|
+
*/
|
|
244
|
+
interface ChallengeStep {
|
|
245
|
+
/**
|
|
246
|
+
* Action to perform
|
|
247
|
+
*/
|
|
248
|
+
action: string;
|
|
249
|
+
/**
|
|
250
|
+
* Payload for the action
|
|
251
|
+
*/
|
|
252
|
+
payload?: unknown;
|
|
253
|
+
/**
|
|
254
|
+
* Expected result
|
|
255
|
+
*/
|
|
256
|
+
expected?: unknown;
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
export { ChallengeSpec, ChallengeStep, EvidenceReference, ExecutionReceipt, ExecutionSummary, ProofArtifact, ProofResult, PublicOutputs, VerificationResult, ZKProof, ZKScheme };
|
|
260
|
+
//# sourceMappingURL=ProofArtifact.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProofArtifact.d.mts","names":[],"sources":["../../src/models/ProofArtifact.ts"],"mappings":";;;;;AAKA;UAAiB,aAAA;;;;EAIf,UAAA;EAoBU;;;EAfV,MAAA,EAAQ,WAAA;EALR;;;EAUA,MAAA,EAAQ,aAAA;EAAA;;;EAKR,EAAA,EAAI,OAAA;EAKM;;;EAAV,OAAA,GAAU,gBAAA;EAKuB;AAMnC;;EANE,aAAA,GAAgB,iBAAA;AAAA;;AAWlB;;KALY,WAAA;;;;UAKK,aAAA,SAAsB,cAAA;EAcrC;;;EAVA,MAAA;EAoBY;AAMd;;EArBE,YAAA;EA6CiB;;;EAxCjB,OAAA;EA8BA;;;EAzBA,SAAA;EAmCiB;;AAMnB;EANmB,CA9BhB,GAAA;AAAA;;;AAyCH;UAnCiB,OAAA;;;;EAIf,MAAA,EAAQ,QAAA;EAkDM;;;EA7Cd,UAAA;EAmCU;;;EA9BV,OAAA;EAwCQ;;;EAnCR,SAAA;EAyCgC;;;EApChC,QAAA,GAAW,MAAA;AAAA;;;;KAMD,QAAA;;;;UAKK,gBAAA;EAsEA;;;EAlEf,gBAAA;EA0FU;;;EArFV,OAAA,GAAU,MAAA;EAiEV;;;EA5DA,UAAA,GAAa,MAAA;EA2Eb;;;EAtEA,KAAA,GAAQ,MAAA;AAAA;;;AAsFV;UAhFiB,iBAAA;;;;EAIf,EAAA;EA0FA;;;EArFA,MAAA;EAyGA;;;EApGA,UAAA;EA8GY;;AAMd;EA/GE,IAAA;IAmHQ;;;IA/GN,KAAA;IAoHF;;;IA/GE,GAAA;IAyHU;AAMd;;IA1HI,MAAA;IA0H0B;;;IArH1B,MAAA;EAAA;AAAA;;;;UAOa,kBAAA;;;;EAIf,QAAA;;;;EAKA,SAAA,EAAW,IAAA;;;;EAKX,YAAA;;;;EAKA,MAAA;;;;EAKA,OAAA,GAAU,gBAAA;;;;EAKV,QAAA,GAAW,MAAA;AAAA;;;;UAMI,gBAAA;;;;EAIf,UAAA;;;;EAKA,UAAA;;;;EAKA,SAAA;;;;EAKA,UAAA;;;;EAKA,UAAA;;;;EAKA,UAAA;;;;EAKA,MAAA,EAAQ,WAAA;;;;EAKR,UAAA;;;;GAKC,GAAA;AAAA;;;;UAMc,aAAA;;;;EAIf,KAAA,GAAQ,aAAA;;;;EAKR,KAAA;;;;EAKA,QAAA;;;;GAKC,GAAA;AAAA;;;;UAMc,aAAA;;;;EAIf,MAAA;;;;EAKA,OAAA;;;;EAKA,QAAA;AAAA"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { BindingContext } from "../models/BindingContext.mjs";
|
|
2
|
+
import { ProgramExecution } from "../models/ProgramExecution.mjs";
|
|
3
|
+
import { ProgramMetadata } from "../registry/ProgramRegistry.mjs";
|
|
4
|
+
import { ProgramExecutor, ProofVerifier } from "../executor/ProgramExecutor.mjs";
|
|
5
|
+
import { PoeProgram } from "./PoeProgram.mjs";
|
|
6
|
+
import { AgentContext } from "@credo-ts/core";
|
|
7
|
+
|
|
8
|
+
//#region src/programs/AppAttestationProgram.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Proof bundle the on-device prover hands to the executor.
|
|
11
|
+
*
|
|
12
|
+
* Produced by `react-native-poe-proofs.generateAppAttestationProofPOE` on the
|
|
13
|
+
* mobile prover. The credo-ts executor in this package is platform-agnostic —
|
|
14
|
+
* it just takes the bundle and packages it into a PoE `ProofArtifact`.
|
|
15
|
+
*/
|
|
16
|
+
interface AppAttestationProverResult {
|
|
17
|
+
proofJson: string;
|
|
18
|
+
publicInputs: string[];
|
|
19
|
+
isGenuine: boolean;
|
|
20
|
+
appCommitment: string;
|
|
21
|
+
seKeyCommitment: string;
|
|
22
|
+
deviceCommitment: string;
|
|
23
|
+
bootCommitment: string;
|
|
24
|
+
patchCommitment: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Callback the executor uses to obtain a proof from whichever prover is wired up.
|
|
28
|
+
*
|
|
29
|
+
* The credo-ts package can't directly import `react-native-poe-proofs` because
|
|
30
|
+
* that would force a React Native dependency even for verifier-only Node
|
|
31
|
+
* deployments. Instead, the host app passes a `proofProvider` callback at
|
|
32
|
+
* program-construction time:
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { generateAppAttestationProofPOE } from 'react-native-poe-proofs'
|
|
36
|
+
*
|
|
37
|
+
* new AppAttestationProgram({
|
|
38
|
+
* proofProvider: async ({ bindingContext, minPatchLevel, platformOptions }) => {
|
|
39
|
+
* return await generateAppAttestationProofPOE({
|
|
40
|
+
* nonce: bigintFromHex(bindingContext.nonce),
|
|
41
|
+
* contextHash: bigintFromHex(bindingContext.context_hash),
|
|
42
|
+
* sessionId: bigintFromHex(bindingContext.session_id),
|
|
43
|
+
* minPatchLevel,
|
|
44
|
+
* proofTimestamp: Math.floor(Date.now() / 1000),
|
|
45
|
+
* ...platformOptions,
|
|
46
|
+
* })
|
|
47
|
+
* },
|
|
48
|
+
* })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
type AppAttestationProofProvider = (args: AppAttestationExecuteArgs) => Promise<AppAttestationProverResult>;
|
|
52
|
+
interface AppAttestationExecuteArgs {
|
|
53
|
+
bindingContext: BindingContext;
|
|
54
|
+
minPatchLevel: number;
|
|
55
|
+
platformOptions?: Record<string, unknown>;
|
|
56
|
+
execution: ProgramExecution;
|
|
57
|
+
}
|
|
58
|
+
interface AppAttestationProgramOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Override the program version (defaults to '1.0.0').
|
|
61
|
+
*/
|
|
62
|
+
version?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Override the program ID (defaults to 'ajna.app-attestation.v1').
|
|
65
|
+
*/
|
|
66
|
+
programId?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Minimum acceptable OS patch level (e.g. 202401 for Jan 2024).
|
|
69
|
+
* Defaults to 202401.
|
|
70
|
+
*/
|
|
71
|
+
defaultMinPatchLevel?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Override the vendored vkey (e.g. to test against a different trusted setup).
|
|
74
|
+
* If omitted, the verifier uses the JSON imported from `./vkeys/`.
|
|
75
|
+
*/
|
|
76
|
+
verifyingKey?: unknown;
|
|
77
|
+
/**
|
|
78
|
+
* Whitelist of acceptable vk_hashes. Defaults to `[sha256(canonical(vkey))]`,
|
|
79
|
+
* which is the same value the program publishes via `getMetadata().allowed_vk_hashes`.
|
|
80
|
+
*/
|
|
81
|
+
allowedVkHashes?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Optional proof provider that bridges to a real prover (e.g. the mobile bridge).
|
|
84
|
+
* If omitted, this program is registered as **verifier-only**.
|
|
85
|
+
*/
|
|
86
|
+
proofProvider?: AppAttestationProofProvider;
|
|
87
|
+
/**
|
|
88
|
+
* Override the snarkjs.groth16 verifier. Defaults to dynamic-importing the
|
|
89
|
+
* `snarkjs` package at first use. Passing your own is mostly for testing.
|
|
90
|
+
*/
|
|
91
|
+
groth16Verifier?: (vkey: unknown, publicSignals: string[], proof: unknown) => Promise<boolean>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* SHA-256 of the canonical (sorted-key) JSON encoding of `value`. Returns a
|
|
95
|
+
* lowercase `0x`-prefixed hex string. Used as the `vk_hash` published in the
|
|
96
|
+
* program metadata and in every proof artifact.
|
|
97
|
+
*/
|
|
98
|
+
declare function canonicalVkHash(value: unknown): string;
|
|
99
|
+
/**
|
|
100
|
+
* The order in which the on-device prover emits public outputs must match the
|
|
101
|
+
* order in which the Groth16 verifier feeds them to `snarkjs.groth16.verify`.
|
|
102
|
+
*
|
|
103
|
+
* Per `circuits/attestation/app_attestation.circom`:
|
|
104
|
+
*
|
|
105
|
+
* ```
|
|
106
|
+
* Public outputs (auto-public):
|
|
107
|
+
* [0] is_genuine
|
|
108
|
+
* [1] out_app_commit
|
|
109
|
+
* [2] out_se_key_commit
|
|
110
|
+
* [3] out_device_commit
|
|
111
|
+
* [4] out_boot_commit
|
|
112
|
+
* [5] out_patch_commit
|
|
113
|
+
* [6] out_timestamp
|
|
114
|
+
*
|
|
115
|
+
* Public inputs:
|
|
116
|
+
* [7] expected_nonce_commit
|
|
117
|
+
* [8] expected_context_commit
|
|
118
|
+
* [9] expected_session_commit
|
|
119
|
+
* [10] expected_app_commit
|
|
120
|
+
* [11] expected_se_key_commit
|
|
121
|
+
* [12] expected_verdict_commit
|
|
122
|
+
* [13] expected_device_commit
|
|
123
|
+
* [14] expected_boot_commit
|
|
124
|
+
* [15] expected_patch_commit
|
|
125
|
+
* [16] min_patch_level
|
|
126
|
+
* [17] proof_timestamp
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare const PUBLIC_INPUT_INDEX: {
|
|
130
|
+
readonly isGenuine: 0;
|
|
131
|
+
readonly outAppCommit: 1;
|
|
132
|
+
readonly outSeKeyCommit: 2;
|
|
133
|
+
readonly outDeviceCommit: 3;
|
|
134
|
+
readonly outBootCommit: 4;
|
|
135
|
+
readonly outPatchCommit: 5;
|
|
136
|
+
readonly outTimestamp: 6;
|
|
137
|
+
readonly expectedNonceCommit: 7;
|
|
138
|
+
readonly expectedContextCommit: 8;
|
|
139
|
+
readonly expectedSessionCommit: 9;
|
|
140
|
+
readonly expectedAppCommit: 10;
|
|
141
|
+
readonly expectedSeKeyCommit: 11;
|
|
142
|
+
readonly expectedVerdictCommit: 12;
|
|
143
|
+
readonly expectedDeviceCommit: 13;
|
|
144
|
+
readonly expectedBootCommit: 14;
|
|
145
|
+
readonly expectedPatchCommit: 15;
|
|
146
|
+
readonly minPatchLevel: 16;
|
|
147
|
+
readonly proofTimestamp: 17;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* PoE program implementing `ajna.app-attestation.v1` — cryptographic device
|
|
151
|
+
* attestation as a Proof of Execution.
|
|
152
|
+
*
|
|
153
|
+
* **Prover side** (mobile, RN): supply a `proofProvider` callback that calls
|
|
154
|
+
* `react-native-poe-proofs.generateAppAttestationProofPOE`. The callback
|
|
155
|
+
* orchestrates the AndroidKeyStore + Play Integrity (or DCAppAttestService)
|
|
156
|
+
* collectors, runs the Rust verifier on-device, and returns a Groth16 proof.
|
|
157
|
+
*
|
|
158
|
+
* **Verifier side** (Node): the verifier runs snarkjs.groth16.verify against
|
|
159
|
+
* the vendored verifying key, asserts `is_genuine === '1'`, checks the binding
|
|
160
|
+
* triple matches the expected context, validates the vk_hash whitelist, and
|
|
161
|
+
* confirms the program's commitments are echoed correctly.
|
|
162
|
+
*/
|
|
163
|
+
declare class AppAttestationProgram extends PoeProgram {
|
|
164
|
+
readonly programId: string;
|
|
165
|
+
readonly version: string;
|
|
166
|
+
private readonly vkey;
|
|
167
|
+
private readonly allowedVkHashes;
|
|
168
|
+
private readonly publishedVkHash;
|
|
169
|
+
private readonly defaultMinPatchLevel;
|
|
170
|
+
private readonly proofProvider?;
|
|
171
|
+
private readonly groth16Verify;
|
|
172
|
+
constructor(options?: AppAttestationProgramOptions);
|
|
173
|
+
getMetadata(): ProgramMetadata;
|
|
174
|
+
createExecutor(_context: AgentContext): ProgramExecutor | undefined;
|
|
175
|
+
createVerifier(_context: AgentContext): ProofVerifier;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { AppAttestationExecuteArgs, AppAttestationProgram, AppAttestationProgramOptions, AppAttestationProofProvider, AppAttestationProverResult, PUBLIC_INPUT_INDEX, canonicalVkHash };
|
|
179
|
+
//# sourceMappingURL=AppAttestationProgram.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppAttestationProgram.d.mts","names":[],"sources":["../../src/programs/AppAttestationProgram.ts"],"mappings":";;;;;;;;;;;AAyBA;;;;UAAiB,0BAAA;EACf,SAAA;EACA,YAAA;EACA,SAAA;EACA,aAAA;EACA,eAAA;EACA,gBAAA;EACA,cAAA;EACA,eAAA;AAAA;AA4BF;;;;;;;;;;;;;;AAIA;;;;;;;;;;;AAJA,KAAY,2BAAA,IACV,IAAA,EAAM,yBAAA,KACH,OAAA,CAAQ,0BAAA;AAAA,UAEI,yBAAA;EACf,cAAA,EAAgB,cAAA;EAChB,aAAA;EACA,eAAA,GAAkB,MAAA;EAClB,SAAA,EAAW,gBAAA;AAAA;AAAA,UAGI,4BAAA;;;;EAIf,OAAA;EAWA;;;EANA,SAAA;EAwBgB;;;;EAlBhB,oBAAA;EA4BK;;;AAYP;EAlCE,YAAA;;;;AAqFF;EA/EE,eAAA;;;;;EAMA,aAAA,GAAgB,2BAAA;;;;;EAMhB,eAAA,IACE,IAAA,WACA,aAAA,YACA,KAAA,cACG,OAAA;AAAA;;;;;;iBAYS,eAAA,CAAgB,KAAA;;;;;;AAwGhC;;;;;;;;;;;;;;;;;;;;;;;;;cArDa,kBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqDA,qBAAA,SAA8B,UAAA;EAAA,SACzB,SAAA;EAAA,SACA,OAAA;EAAA,iBAEC,IAAA;EAAA,iBACA,eAAA;EAAA,iBACA,eAAA;EAAA,iBACA,oBAAA;EAAA,iBACA,aAAA;EAAA,iBACA,aAAA;cAME,OAAA,GAAS,4BAAA;EAcrB,WAAA,CAAA,GAAe,eAAA;EAiBf,cAAA,CAAe,QAAA,EAAU,YAAA,GAAe,eAAA;EA4ExC,cAAA,CAAe,QAAA,EAAU,YAAA,GAAe,aAAA;AAAA"}
|