@violetclaire/popcorn-mcp 0.1.3 → 0.1.5
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/README.md +55 -18
- package/dist/packages/mcp/src/core.d.ts +1 -1
- package/dist/packages/mcp/src/core.js +14 -2
- package/dist/packages/mcp/src/core.js.map +1 -1
- package/dist/packages/mcp/src/index.js +19 -2
- package/dist/packages/mcp/src/index.js.map +1 -1
- package/dist/packages/mcp/src/server.js +10 -2
- package/dist/packages/mcp/src/server.js.map +1 -1
- package/dist/packages/mcp/src/v2-interface.d.ts +34 -0
- package/dist/packages/mcp/src/v2-interface.js +81 -0
- package/dist/packages/mcp/src/v2-interface.js.map +1 -0
- package/dist/packages/mcp/src/v2-schema.d.ts +3 -0
- package/dist/packages/mcp/src/v2-schema.js +27 -0
- package/dist/packages/mcp/src/v2-schema.js.map +1 -0
- package/dist/verify/typescript/src/v2.d.ts +192 -0
- package/dist/verify/typescript/src/v2.js +554 -0
- package/dist/verify/typescript/src/v2.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export type PopcornJsonWebKey = JsonWebKey & {
|
|
2
|
+
kid?: string;
|
|
3
|
+
};
|
|
4
|
+
export type JsonWebKeySet = {
|
|
5
|
+
keys: PopcornJsonWebKey[];
|
|
6
|
+
};
|
|
7
|
+
export type TemporalReceipt = {
|
|
8
|
+
anchor_id: string;
|
|
9
|
+
node_id: string;
|
|
10
|
+
protocol_id: string;
|
|
11
|
+
request_received_at_utc: string;
|
|
12
|
+
observed_at_utc: string;
|
|
13
|
+
measurement_at_utc: string;
|
|
14
|
+
unix_time_milliseconds: number;
|
|
15
|
+
valid_until_utc: string;
|
|
16
|
+
freshness_window_ms: number;
|
|
17
|
+
server_processing_duration_ms: number;
|
|
18
|
+
post_anchor_processing_duration_ms: number;
|
|
19
|
+
validity_at_measurement_ms: number;
|
|
20
|
+
payment_identifier: string;
|
|
21
|
+
payment_transaction: string | null;
|
|
22
|
+
evidence_scope: {
|
|
23
|
+
type: string;
|
|
24
|
+
caller_bound: boolean;
|
|
25
|
+
task_bound: boolean;
|
|
26
|
+
authorization_granted: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type PopcornResponse = {
|
|
30
|
+
temporal_receipt: TemporalReceipt;
|
|
31
|
+
temporal_attestation: {
|
|
32
|
+
format?: string;
|
|
33
|
+
algorithm?: string;
|
|
34
|
+
key_id?: string;
|
|
35
|
+
compact_jws: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type MonotonicObservation = {
|
|
39
|
+
paid_request_start_monotonic_ms: number;
|
|
40
|
+
paid_response_receive_monotonic_ms: number;
|
|
41
|
+
decision_monotonic_ms?: number;
|
|
42
|
+
};
|
|
43
|
+
export type ExecutionWindowUtc = {
|
|
44
|
+
opens_at_utc: string;
|
|
45
|
+
closes_at_utc: string;
|
|
46
|
+
};
|
|
47
|
+
export type VerifiedTemporalEvidence = {
|
|
48
|
+
signature_verified: true;
|
|
49
|
+
key_id: string;
|
|
50
|
+
temporal_receipt: TemporalReceipt;
|
|
51
|
+
paid_request_rtt_ms: number;
|
|
52
|
+
network_uncertainty_ms: number;
|
|
53
|
+
remaining_validity_at_receipt_ms: number;
|
|
54
|
+
remaining_validity_now_ms: number;
|
|
55
|
+
temporal_interval_now_utc: {
|
|
56
|
+
earliest: string;
|
|
57
|
+
latest: string;
|
|
58
|
+
};
|
|
59
|
+
execution_window?: {
|
|
60
|
+
eligible: boolean;
|
|
61
|
+
next_action: "continue_task" | "request_new_temporal_anchor";
|
|
62
|
+
reason: "verified_interval_within_execution_window" | "temporal_evidence_expired" | "verified_interval_not_within_execution_window";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export type Sha256Digest = {
|
|
66
|
+
algorithm: "sha-256";
|
|
67
|
+
value: string;
|
|
68
|
+
};
|
|
69
|
+
export type WitnessCommitment = {
|
|
70
|
+
payload_digest: Sha256Digest;
|
|
71
|
+
nonce: string;
|
|
72
|
+
previous_attestation_digest: Sha256Digest | null;
|
|
73
|
+
};
|
|
74
|
+
export type WitnessReceipt = {
|
|
75
|
+
receipt_id: string;
|
|
76
|
+
tain: string;
|
|
77
|
+
node_id: string;
|
|
78
|
+
protocol_id: string;
|
|
79
|
+
request_received_at_utc: string;
|
|
80
|
+
witnessed_at_utc: string;
|
|
81
|
+
statement_created_at_utc: string;
|
|
82
|
+
unix_time_milliseconds: number;
|
|
83
|
+
clock_accuracy_radius_ms: number;
|
|
84
|
+
witness_window_utc: {
|
|
85
|
+
earliest: string;
|
|
86
|
+
latest: string;
|
|
87
|
+
};
|
|
88
|
+
server_processing_duration_ms: number;
|
|
89
|
+
post_witness_processing_duration_ms: number;
|
|
90
|
+
commitment: WitnessCommitment;
|
|
91
|
+
payment_identifier: string;
|
|
92
|
+
payment_transaction: string | null;
|
|
93
|
+
evidence_scope: {
|
|
94
|
+
type: string;
|
|
95
|
+
payload_disclosed: boolean;
|
|
96
|
+
caller_identity_proven: boolean;
|
|
97
|
+
recipient_delivery_proven: boolean;
|
|
98
|
+
action_execution_proven: boolean;
|
|
99
|
+
nonce_uniqueness_enforced: boolean;
|
|
100
|
+
replay_prevented: boolean;
|
|
101
|
+
authorization_granted: boolean;
|
|
102
|
+
external_atomic_clock_alignment_proven: boolean;
|
|
103
|
+
clock_accuracy_independently_verified: boolean;
|
|
104
|
+
payer_authorization_bound_to_commitment: boolean;
|
|
105
|
+
};
|
|
106
|
+
issuing_origin: string;
|
|
107
|
+
issuance_endpoint: string;
|
|
108
|
+
tain_verification_uri: string;
|
|
109
|
+
contribution_license_uri: string;
|
|
110
|
+
license_terms_digest: Sha256Digest;
|
|
111
|
+
};
|
|
112
|
+
export type PopcornWitnessResponse = {
|
|
113
|
+
witness_receipt: WitnessReceipt;
|
|
114
|
+
witness_attestation: {
|
|
115
|
+
format?: string;
|
|
116
|
+
algorithm?: string;
|
|
117
|
+
key_id?: string;
|
|
118
|
+
key_set?: string;
|
|
119
|
+
compact_jws: string;
|
|
120
|
+
};
|
|
121
|
+
payment_status: "settled";
|
|
122
|
+
tain_qr_png_base64?: string;
|
|
123
|
+
tain_qr_payload?: string;
|
|
124
|
+
letterhead_uri?: string;
|
|
125
|
+
};
|
|
126
|
+
export type WitnessVerificationOptions = {
|
|
127
|
+
expected_node_id?: string;
|
|
128
|
+
expected_nonce: string;
|
|
129
|
+
expected_payload?: string | Uint8Array;
|
|
130
|
+
expected_payload_digest?: string;
|
|
131
|
+
previous_receipt?: {
|
|
132
|
+
response: PopcornWitnessResponse;
|
|
133
|
+
jwks: JsonWebKeySet;
|
|
134
|
+
verification: WitnessVerificationOptions;
|
|
135
|
+
};
|
|
136
|
+
max_clock_accuracy_radius_ms?: number;
|
|
137
|
+
};
|
|
138
|
+
export type VerifiedWitnessEvidence = {
|
|
139
|
+
signature_verified: true;
|
|
140
|
+
key_id: string;
|
|
141
|
+
witness_receipt: WitnessReceipt;
|
|
142
|
+
payload_digest_verified: true;
|
|
143
|
+
nonce_verified: true;
|
|
144
|
+
previous_attestation_digest_matched: boolean;
|
|
145
|
+
replay_key: string;
|
|
146
|
+
payment_replay_key: string;
|
|
147
|
+
witness_window_utc: {
|
|
148
|
+
earliest: string;
|
|
149
|
+
latest: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export type WitnessChainVerificationOptions = Omit<WitnessVerificationOptions, "previous_receipt">;
|
|
153
|
+
export type WitnessChainEntry = {
|
|
154
|
+
response: PopcornWitnessResponse;
|
|
155
|
+
jwks: JsonWebKeySet;
|
|
156
|
+
verification: WitnessChainVerificationOptions;
|
|
157
|
+
};
|
|
158
|
+
export type VerifiedWitnessChainEntry = {
|
|
159
|
+
index: number;
|
|
160
|
+
signed_payload_digest: string;
|
|
161
|
+
verified: VerifiedWitnessEvidence;
|
|
162
|
+
};
|
|
163
|
+
export type VerifiedWitnessChain = {
|
|
164
|
+
chain_length: number;
|
|
165
|
+
head_signed_payload_digest: string;
|
|
166
|
+
entries: VerifiedWitnessChainEntry[];
|
|
167
|
+
};
|
|
168
|
+
export type PortableScheduleExecutionWindowUtc = {
|
|
169
|
+
opens_at: string;
|
|
170
|
+
closes_at: string;
|
|
171
|
+
};
|
|
172
|
+
export type WitnessScheduleDecision = {
|
|
173
|
+
decision: "STOP" | "TIME_CHECK_PASSED" | "RECHECK";
|
|
174
|
+
authorization_granted: false;
|
|
175
|
+
reason: "witness_window_entirely_before_execution_window" | "witness_window_entirely_after_execution_window" | "witness_window_entirely_inside_execution_window" | "witness_uncertainty_crosses_execution_boundary";
|
|
176
|
+
witness_window_utc: {
|
|
177
|
+
earliest: string;
|
|
178
|
+
latest: string;
|
|
179
|
+
};
|
|
180
|
+
execution_window_utc: PortableScheduleExecutionWindowUtc;
|
|
181
|
+
};
|
|
182
|
+
export declare function digestWitnessSignedPayload(compactJws: string): Promise<string>;
|
|
183
|
+
export declare function evaluateWitnessAgainstSchedule(witnessWindowUtc: {
|
|
184
|
+
earliest: string;
|
|
185
|
+
latest: string;
|
|
186
|
+
}, executionWindowUtc: PortableScheduleExecutionWindowUtc): WitnessScheduleDecision;
|
|
187
|
+
export declare function verifyPopcornTemporalEvidence(response: PopcornResponse, jwks: JsonWebKeySet, monotonic: MonotonicObservation, options?: {
|
|
188
|
+
expected_node_id?: string;
|
|
189
|
+
execution_window_utc?: ExecutionWindowUtc;
|
|
190
|
+
}): Promise<VerifiedTemporalEvidence>;
|
|
191
|
+
export declare function verifyPopcornWitnessEvidence(response: PopcornWitnessResponse, jwks: JsonWebKeySet, options: WitnessVerificationOptions): Promise<VerifiedWitnessEvidence>;
|
|
192
|
+
export declare function verifyPopcornWitnessChain(entries: readonly WitnessChainEntry[]): Promise<VerifiedWitnessChain>;
|