@coderifts/sdk 3.13.2 → 3.14.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/README.md +49 -0
- package/dist/cjs/authorize.d.ts +176 -0
- package/dist/cjs/authorize.d.ts.map +1 -0
- package/dist/cjs/authorize.js +139 -0
- package/dist/cjs/authorize.js.map +1 -0
- package/dist/cjs/client.d.ts +31 -3
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +35 -5
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +22 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/vendor/package.json +1 -0
- package/dist/cjs/vendor/receipt-verifier/VENDOR.sha256 +41 -0
- package/dist/cjs/vendor/receipt-verifier/arity.js +53 -0
- package/dist/cjs/vendor/receipt-verifier/evidence-root.js +188 -0
- package/dist/cjs/vendor/receipt-verifier/verified-execution-binding.js +507 -0
- package/dist/cjs/vendor/receipt-verifier/verify-evidence.js +410 -0
- package/dist/cjs/vendor/receipt-verifier/verify-grant.js +597 -0
- package/dist/cjs/vendor/receipt-verifier/verify-prove-transcript.js +72 -0
- package/dist/cjs/vendor/receipt-verifier/verify.d.ts +31 -0
- package/dist/cjs/vendor/receipt-verifier/verify.js +454 -0
- package/dist/cjs/verify-receipt-local.d.ts +69 -0
- package/dist/cjs/verify-receipt-local.d.ts.map +1 -0
- package/dist/cjs/verify-receipt-local.js +103 -0
- package/dist/cjs/verify-receipt-local.js.map +1 -0
- package/dist/esm/authorize.d.ts +176 -0
- package/dist/esm/authorize.d.ts.map +1 -0
- package/dist/esm/authorize.js +135 -0
- package/dist/esm/authorize.js.map +1 -0
- package/dist/esm/client.d.ts +31 -3
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +35 -5
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/vendor/package.json +1 -0
- package/dist/esm/vendor/receipt-verifier/VENDOR.sha256 +41 -0
- package/dist/esm/vendor/receipt-verifier/arity.js +53 -0
- package/dist/esm/vendor/receipt-verifier/evidence-root.js +188 -0
- package/dist/esm/vendor/receipt-verifier/verified-execution-binding.js +507 -0
- package/dist/esm/vendor/receipt-verifier/verify-evidence.js +410 -0
- package/dist/esm/vendor/receipt-verifier/verify-grant.js +597 -0
- package/dist/esm/vendor/receipt-verifier/verify-prove-transcript.js +72 -0
- package/dist/esm/vendor/receipt-verifier/verify.d.ts +31 -0
- package/dist/esm/vendor/receipt-verifier/verify.js +454 -0
- package/dist/esm/verify-receipt-local.d.ts +69 -0
- package/dist/esm/verify-receipt-local.d.ts.map +1 -0
- package/dist/esm/verify-receipt-local.js +97 -0
- package/dist/esm/verify-receipt-local.js.map +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @coderifts/sdk
|
|
2
2
|
|
|
3
|
+
## Verifying a receipt offline
|
|
4
|
+
|
|
5
|
+
`verifyReceipt` runs **locally**: the same vendored receipt-verifier core the public CLI and the
|
|
6
|
+
conformance measure run, in process, over bytes already in memory plus a keyring **you** pin. No
|
|
7
|
+
network, no API key, full Ed25519.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { verifyReceipt } from '@coderifts/sdk';
|
|
11
|
+
|
|
12
|
+
const r = verifyReceipt(token, { keyring: pinnedKeys });
|
|
13
|
+
if (!r.valid) throw new Error(`${r.status}: ${r.reason}`);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The keyring is required and is **never fetched** by this package. A verifier that downloads the key it is about to
|
|
17
|
+
trust has verified nothing an attacker on the path could not arrange — pin the keys once, as a
|
|
18
|
+
deployment decision, and hand them in.
|
|
19
|
+
|
|
20
|
+
### The server verify is a MIRROR, not the proof
|
|
21
|
+
|
|
22
|
+
`client.verifyReceiptViaServer(token, intended)` POSTs the receipt to CodeRifts and reports what
|
|
23
|
+
CodeRifts says. It is the only path that can see **revocation** and the issuer's clock, which no
|
|
24
|
+
local verifier can know — and it is not a verification you performed: the bytes travelled and the
|
|
25
|
+
thing you are trusting is the endpoint.
|
|
26
|
+
|
|
27
|
+
If the two disagree, both are facts: the local answer is what the signature says, the server's is
|
|
28
|
+
what the issuer currently says. Only the first is a proof you hold.
|
|
29
|
+
|
|
30
|
+
> `client.verifyReceipt` is a **deprecated alias** of `verifyReceiptViaServer`. It sat on a network
|
|
31
|
+
> call in a package whose readers were told they could verify without CodeRifts, and a name is read
|
|
32
|
+
> more often than a docstring.
|
|
33
|
+
|
|
34
|
+
### What a local `valid: true` does not say
|
|
35
|
+
|
|
36
|
+
Carried on every verdict as `does_not_prove`, so it travels with the answer:
|
|
37
|
+
|
|
38
|
+
- **not authorization.** A valid signature is authenticity. Whether the receipt permits the action
|
|
39
|
+
you are about to take is `verifyReceiptViaServer(token, intended)` or `authorize()`.
|
|
40
|
+
- **not revocation.** A key compromised a minute ago still verifies locally. Nothing local can know.
|
|
41
|
+
- **not one run.** This checks ONE token; "these tokens came from one run" is a property of a set
|
|
42
|
+
(`cr.evidence.root.v1`).
|
|
43
|
+
|
|
44
|
+
| I want to… | Use |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| **verify a receipt offline** | `verifyReceipt(token, { keyring })` — local, this package |
|
|
47
|
+
| check revocation / the issuer's clock | `client.verifyReceiptViaServer(...)` — a mirror |
|
|
48
|
+
| ask "does this authorize my action?" | `client.verifyReceiptViaServer(token, intended)` |
|
|
49
|
+
| decide authorized **and** committed | `authorize(...)` |
|
|
50
|
+
| verify offline in Python | `pip install coderifts-verifier` |
|
|
51
|
+
|
|
3
52
|
Agent Governance SDK for the [CodeRifts](https://coderifts.com) API. Validate API changes before tool invocations in AI agent infrastructure (LangChain, AutoGen, Copilot, Claude, Grok, etc.).
|
|
4
53
|
|
|
5
54
|
## Installation
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* authorize() — the AUTHORIZATION question, as a first-class SDK surface (1463).
|
|
3
|
+
*
|
|
4
|
+
* ── WHY THIS IS NOT verifyExecutionGrant ────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* They answer different questions, and conflating them is how a caller ends up treating a verified
|
|
7
|
+
* token as permission:
|
|
8
|
+
*
|
|
9
|
+
* verifyExecutionGrant is THIS TOKEN authentic, current and bound to what I intended?
|
|
10
|
+
* One signature, one answer. Unchanged by this file.
|
|
11
|
+
* authorize() may this change be treated as authorized AND committed?
|
|
12
|
+
* Four independent authorities, and only their INTERSECTION.
|
|
13
|
+
*
|
|
14
|
+
* A grant can verify perfectly and still not authorize a commit: nothing attested that the commit
|
|
15
|
+
* happened, or the tokens are not shown to be one run, or the provider never witnessed it. Those
|
|
16
|
+
* are different facts with different remedies, and a boolean loses all of them — which is why the
|
|
17
|
+
* result carries a NAMED state.
|
|
18
|
+
*
|
|
19
|
+
* ── IT QUOTES, IT DOES NOT RECOMPUTE ────────────────────────────────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* The verdict comes from the vendored `verifiedExecutionBinding` (receipt-verifier ce5fd34), the
|
|
22
|
+
* same predicate the guard, Prove, conformance and the contract-gate quote. A TS caller therefore
|
|
23
|
+
* reads the same vocabulary those four print. This file only SHAPES inputs: PEM strings and plain
|
|
24
|
+
* objects in, the core's decision out.
|
|
25
|
+
*
|
|
26
|
+
* ── WHAT IT DOES NOT DO ─────────────────────────────────────────────────────────────────────
|
|
27
|
+
*
|
|
28
|
+
* No network, no key discovery, no clock beyond the one you pass. Every input is supplied by the
|
|
29
|
+
* caller. And a `true` here is not a claim that the provider merged anything: `provider_witness`
|
|
30
|
+
* is an unsigned readback unless you say otherwise, which is what RECORDED_UNWITNESSED names.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The shortfall vocabulary, shared with the guard, Prove, conformance and the contract-gate.
|
|
34
|
+
* Ordered by severity: the state returned is the MOST serious thing that is wrong.
|
|
35
|
+
*/
|
|
36
|
+
export type AuthorizationState = 'AUTHORIZED_AND_COMMITTED'
|
|
37
|
+
/** The receipt or the issuer grant did not verify — nothing downstream is worth reading. */
|
|
38
|
+
| 'UNAUTHORIZED'
|
|
39
|
+
/** Authorized, but no executor attestation binds this grant to a commit. */
|
|
40
|
+
| 'COMMIT_UNPROVEN'
|
|
41
|
+
/** Authorized and committed, but the tokens are not shown to come from ONE run. */
|
|
42
|
+
| 'ONE_RUN_UNPROVEN'
|
|
43
|
+
/** Everything above holds, and no provider signed a witness of it. */
|
|
44
|
+
| 'RECORDED_UNWITNESSED'
|
|
45
|
+
/**
|
|
46
|
+
* A CUSTOM authority set was satisfied — and this is deliberately NOT the global claim.
|
|
47
|
+
*
|
|
48
|
+
* A caller that names its own `required[]` asks a narrower question, and the core will not
|
|
49
|
+
* answer a narrower question with the widest word. Read `requirements_satisfied` for "my set
|
|
50
|
+
* passed"; read `authorized_and_committed` only for the closed-profile claim.
|
|
51
|
+
*/
|
|
52
|
+
| 'CUSTOM_REQUIREMENTS_SATISFIED'
|
|
53
|
+
/** The evidence is in order and the change was not committed. */
|
|
54
|
+
| 'NOT_COMMITTED';
|
|
55
|
+
/** The four independent authorities. Only their intersection yields success. */
|
|
56
|
+
export type AuthorityName = 'issuer_grant' | 'executor_attestation' | 'one_run_root' | 'provider_witness';
|
|
57
|
+
export interface AuthorityResult {
|
|
58
|
+
ok: boolean;
|
|
59
|
+
/** Whether THIS call demanded it — an authority you did not require cannot fail you. */
|
|
60
|
+
required: boolean;
|
|
61
|
+
detail: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AuthorizeResult {
|
|
64
|
+
/** True only when every REQUIRED authority holds and the change was committed. */
|
|
65
|
+
authorized_and_committed: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Did the set THIS CALLER asked for pass? True for a satisfied closed profile and for a
|
|
68
|
+
* satisfied custom aggregation alike — so a caller that only wants its own answer never has
|
|
69
|
+
* to reach for the global one because it was the only boolean available.
|
|
70
|
+
*/
|
|
71
|
+
requirements_satisfied: boolean;
|
|
72
|
+
state: AuthorizationState;
|
|
73
|
+
authorities: Record<AuthorityName, AuthorityResult>;
|
|
74
|
+
/** One line per unmet required authority, in the core's words. */
|
|
75
|
+
shortfalls: string[];
|
|
76
|
+
/** Carried verbatim from the core, so a caller cannot read success as more than it is. */
|
|
77
|
+
does_not_prove: string[];
|
|
78
|
+
}
|
|
79
|
+
/** A pinned issuer key registry, in the shape `.well-known/coderifts-keys.json` uses. */
|
|
80
|
+
export interface PinnedKeyring {
|
|
81
|
+
keys: Array<{
|
|
82
|
+
kid: string;
|
|
83
|
+
public_key_pem: string;
|
|
84
|
+
status?: string;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export interface AuthorizeInput {
|
|
88
|
+
/**
|
|
89
|
+
* The decision receipt's verification result. `verified` is YOUR determination — this call
|
|
90
|
+
* does not re-verify it, and passing `true` for an unverified receipt is the one way to make
|
|
91
|
+
* this function lie for you.
|
|
92
|
+
*/
|
|
93
|
+
receipt: {
|
|
94
|
+
/**
|
|
95
|
+
* YOUR determination, accepted only as a custom caller's own. Supplying this alone can no
|
|
96
|
+
* longer produce `authorized_and_committed`: the core marks the result caller-asserted.
|
|
97
|
+
*/
|
|
98
|
+
verified: boolean;
|
|
99
|
+
/** The receipt's exact bytes. With a key source below, THE CORE verifies them. */
|
|
100
|
+
token?: string;
|
|
101
|
+
keyring?: PinnedKeyring | null;
|
|
102
|
+
publicKeyPem?: string;
|
|
103
|
+
expectedKid?: string | null;
|
|
104
|
+
now?: number;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* THE EXACT BYTES THE ISSUER SIGNED. Not a grant read back out of a tool result: a caller who
|
|
108
|
+
* lets the executed tool hand back its own authorization has already lost.
|
|
109
|
+
*/
|
|
110
|
+
grant: {
|
|
111
|
+
token: string;
|
|
112
|
+
keyring?: PinnedKeyring | null;
|
|
113
|
+
publicKeyPem?: string;
|
|
114
|
+
expectedKid?: string | null;
|
|
115
|
+
intended?: Record<string, unknown>;
|
|
116
|
+
now?: number;
|
|
117
|
+
};
|
|
118
|
+
/** The executor's commit attestation, and the customer-pinned executor registry. */
|
|
119
|
+
attestation?: {
|
|
120
|
+
token: string | null;
|
|
121
|
+
registry?: unknown;
|
|
122
|
+
};
|
|
123
|
+
/** A cr.prove.artifact.v1 carrying a cr.evidence.root.v1, and the executor key it is signed with. */
|
|
124
|
+
evidenceRoot?: {
|
|
125
|
+
artifact: Record<string, unknown>;
|
|
126
|
+
executorPublicKeyPem: string;
|
|
127
|
+
sidecars?: Record<string, string>;
|
|
128
|
+
} | null;
|
|
129
|
+
/** Only `signed: true` makes this authority hold; an unsigned readback never does. */
|
|
130
|
+
providerReadback?: {
|
|
131
|
+
signed: boolean;
|
|
132
|
+
} | null;
|
|
133
|
+
committed: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* A CLOSED, VERSIONED assurance profile — the only way to reach `authorized_and_committed`.
|
|
136
|
+
*
|
|
137
|
+
* ── THE MEASURED GAP THIS CLOSES ────────────────────────────────────────────────────────
|
|
138
|
+
*
|
|
139
|
+
* The core reserves the global claim for a profile whose authority set the caller cannot
|
|
140
|
+
* shorten. This surface did not pass `profile` through AT ALL, so an SDK caller holding a
|
|
141
|
+
* complete capture — grant, attestation and a one-run evidence root — could not ask for that
|
|
142
|
+
* claim by any means. Every answer was `CUSTOM_REQUIREMENTS_SATISFIED`, which is the honest
|
|
143
|
+
* name for a narrower question, and here it was the only name available.
|
|
144
|
+
*
|
|
145
|
+
* A profile's set is NOT editable: passing `profile` and `required` together is refused by the
|
|
146
|
+
* core rather than resolved by precedence, because that asks two different questions at once.
|
|
147
|
+
*/
|
|
148
|
+
profile?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Which authorities this caller demands, when it is aggregating its own set. Defaults to
|
|
151
|
+
* issuer_grant + executor_attestation — the pair a holder of a grant and an attestation can
|
|
152
|
+
* actually establish. Ask for more only when you hold the evidence for it, or the answer will
|
|
153
|
+
* name a shortfall about evidence you were never going to supply.
|
|
154
|
+
*
|
|
155
|
+
* A satisfied custom set reads `CUSTOM_REQUIREMENTS_SATISFIED`, never the global claim. That
|
|
156
|
+
* is not a downgrade: it is the difference between "the set I chose passed" and "this run is
|
|
157
|
+
* authorized and committed", and only a closed profile can say the second.
|
|
158
|
+
*/
|
|
159
|
+
required?: AuthorityName[];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Decide whether a change may be treated as authorized and committed.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* const r = authorize({
|
|
166
|
+
* receipt: { verified: true },
|
|
167
|
+
* grant: { token: grantToken, keyring: issuerKeys },
|
|
168
|
+
* attestation: { token: attestToken, registry: executorKeys },
|
|
169
|
+
* committed: true,
|
|
170
|
+
* });
|
|
171
|
+
* if (!r.authorized_and_committed) throw new Error(`${r.state}: ${r.shortfalls.join('; ')}`);
|
|
172
|
+
*/
|
|
173
|
+
export declare function authorize(input: AuthorizeInput): AuthorizeResult;
|
|
174
|
+
/** The states, as values, for callers that switch on them. */
|
|
175
|
+
export declare const AUTHORIZATION_STATE: Record<string, AuthorizationState>;
|
|
176
|
+
//# sourceMappingURL=authorize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../src/authorize.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GACxB,0BAA0B;AAC5B,4FAA4F;GAC1F,cAAc;AAChB,4EAA4E;GAC1E,iBAAiB;AACnB,mFAAmF;GACjF,kBAAkB;AACpB,sEAAsE;GACpE,sBAAsB;AACxB;;;;;;GAMG;GACD,+BAA+B;AACjC,iEAAiE;GAC/D,eAAe,CAAC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AAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,oFAAoF;IACpF,WAAW,CAAC,EAAE;QACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,qGAAqG;IACrG,YAAY,CAAC,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC,GAAG,IAAI,CAAC;IACT,sFAAsF;IACtF,gBAAgB,CAAC,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAgEhE;AAED,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAQjE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck — this package does not ship @types/node; crypto/Buffer are Node 18+ globals.
|
|
3
|
+
/**
|
|
4
|
+
* authorize() — the AUTHORIZATION question, as a first-class SDK surface (1463).
|
|
5
|
+
*
|
|
6
|
+
* ── WHY THIS IS NOT verifyExecutionGrant ────────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* They answer different questions, and conflating them is how a caller ends up treating a verified
|
|
9
|
+
* token as permission:
|
|
10
|
+
*
|
|
11
|
+
* verifyExecutionGrant is THIS TOKEN authentic, current and bound to what I intended?
|
|
12
|
+
* One signature, one answer. Unchanged by this file.
|
|
13
|
+
* authorize() may this change be treated as authorized AND committed?
|
|
14
|
+
* Four independent authorities, and only their INTERSECTION.
|
|
15
|
+
*
|
|
16
|
+
* A grant can verify perfectly and still not authorize a commit: nothing attested that the commit
|
|
17
|
+
* happened, or the tokens are not shown to be one run, or the provider never witnessed it. Those
|
|
18
|
+
* are different facts with different remedies, and a boolean loses all of them — which is why the
|
|
19
|
+
* result carries a NAMED state.
|
|
20
|
+
*
|
|
21
|
+
* ── IT QUOTES, IT DOES NOT RECOMPUTE ────────────────────────────────────────────────────────
|
|
22
|
+
*
|
|
23
|
+
* The verdict comes from the vendored `verifiedExecutionBinding` (receipt-verifier ce5fd34), the
|
|
24
|
+
* same predicate the guard, Prove, conformance and the contract-gate quote. A TS caller therefore
|
|
25
|
+
* reads the same vocabulary those four print. This file only SHAPES inputs: PEM strings and plain
|
|
26
|
+
* objects in, the core's decision out.
|
|
27
|
+
*
|
|
28
|
+
* ── WHAT IT DOES NOT DO ─────────────────────────────────────────────────────────────────────
|
|
29
|
+
*
|
|
30
|
+
* No network, no key discovery, no clock beyond the one you pass. Every input is supplied by the
|
|
31
|
+
* caller. And a `true` here is not a claim that the provider merged anything: `provider_witness`
|
|
32
|
+
* is an unsigned readback unless you say otherwise, which is what RECORDED_UNWITNESSED names.
|
|
33
|
+
*/
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.AUTHORIZATION_STATE = void 0;
|
|
36
|
+
exports.authorize = authorize;
|
|
37
|
+
const crypto_1 = require("crypto");
|
|
38
|
+
function toKeyringMap(keyring) {
|
|
39
|
+
if (!keyring || !Array.isArray(keyring.keys) || keyring.keys.length === 0)
|
|
40
|
+
return null;
|
|
41
|
+
const m = new Map();
|
|
42
|
+
for (const k of keyring.keys) {
|
|
43
|
+
if (!k || typeof k.kid !== 'string' || typeof k.public_key_pem !== 'string')
|
|
44
|
+
continue;
|
|
45
|
+
m.set(k.kid, {
|
|
46
|
+
publicKey: (0, crypto_1.createPublicKey)(k.public_key_pem),
|
|
47
|
+
status: k.status || 'active',
|
|
48
|
+
retired_at: null,
|
|
49
|
+
compromised_at: null,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return m.size > 0 ? m : null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decide whether a change may be treated as authorized and committed.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const r = authorize({
|
|
59
|
+
* receipt: { verified: true },
|
|
60
|
+
* grant: { token: grantToken, keyring: issuerKeys },
|
|
61
|
+
* attestation: { token: attestToken, registry: executorKeys },
|
|
62
|
+
* committed: true,
|
|
63
|
+
* });
|
|
64
|
+
* if (!r.authorized_and_committed) throw new Error(`${r.state}: ${r.shortfalls.join('; ')}`);
|
|
65
|
+
*/
|
|
66
|
+
function authorize(input) {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
68
|
+
const { verifiedExecutionBinding } = require('./vendor/receipt-verifier/verified-execution-binding.js');
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
70
|
+
const { verifyExecutionAttestation } = require('./execution-attestation.js');
|
|
71
|
+
const g = input.grant || {};
|
|
72
|
+
const att = input.attestation;
|
|
73
|
+
const root = input.evidenceRoot;
|
|
74
|
+
return verifiedExecutionBinding({
|
|
75
|
+
// ── THE RECEIPT, VERIFIED BY THE CORE WHEN THE CALLER SUPPLIES IT ────────────────
|
|
76
|
+
//
|
|
77
|
+
// `receipt: { verified: true }` was the caller's word, and this function's own doc-comment
|
|
78
|
+
// called it "the one way to make this function lie for you". The core now refuses to build
|
|
79
|
+
// the global claim on it: with a token and a keyring it verifies the receipt itself, and
|
|
80
|
+
// without them the result is marked caller-asserted and cannot reach
|
|
81
|
+
// AUTHORIZED_AND_COMMITTED.
|
|
82
|
+
//
|
|
83
|
+
// Both shapes are still accepted, because a caller that genuinely verified elsewhere is
|
|
84
|
+
// entitled to say so — what changed is that saying so no longer buys the strongest word.
|
|
85
|
+
receipt: input.receipt && input.receipt.token
|
|
86
|
+
? {
|
|
87
|
+
token: input.receipt.token,
|
|
88
|
+
keyring: toKeyringMap(input.receipt.keyring),
|
|
89
|
+
...(input.receipt.publicKeyPem
|
|
90
|
+
? { publicKey: (0, crypto_1.createPublicKey)(input.receipt.publicKeyPem) } : {}),
|
|
91
|
+
expectedKid: input.receipt.expectedKid ?? null,
|
|
92
|
+
...(Number.isFinite(input.receipt.now) ? { now: input.receipt.now } : {}),
|
|
93
|
+
}
|
|
94
|
+
: { verified: !!(input.receipt && input.receipt.verified === true) },
|
|
95
|
+
grant: {
|
|
96
|
+
token: g.token || '',
|
|
97
|
+
keyring: toKeyringMap(g.keyring),
|
|
98
|
+
...(g.publicKeyPem ? { publicKey: (0, crypto_1.createPublicKey)(g.publicKeyPem) } : {}),
|
|
99
|
+
expectedKid: g.expectedKid ?? null,
|
|
100
|
+
...(g.intended ? { intended: g.intended } : {}),
|
|
101
|
+
...(Number.isFinite(g.now) ? { now: g.now } : {}),
|
|
102
|
+
},
|
|
103
|
+
...(att
|
|
104
|
+
? {
|
|
105
|
+
attestation: {
|
|
106
|
+
token: att.token,
|
|
107
|
+
registry: att.registry,
|
|
108
|
+
// Handed in rather than reimplemented: the core holds no attestation format
|
|
109
|
+
// knowledge of its own, and this SDK already owns that verifier.
|
|
110
|
+
verify: verifyExecutionAttestation,
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
: {}),
|
|
114
|
+
...(root
|
|
115
|
+
? {
|
|
116
|
+
evidenceRoot: {
|
|
117
|
+
artifact: root.artifact,
|
|
118
|
+
executorKey: (0, crypto_1.createPublicKey)(root.executorPublicKeyPem),
|
|
119
|
+
sidecars: root.sidecars,
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
: {}),
|
|
123
|
+
...(input.providerReadback ? { providerReadback: input.providerReadback } : {}),
|
|
124
|
+
committed: input.committed === true,
|
|
125
|
+
...(input.profile ? { profile: input.profile } : {}),
|
|
126
|
+
...(input.required ? { required: input.required } : {}),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/** The states, as values, for callers that switch on them. */
|
|
130
|
+
exports.AUTHORIZATION_STATE = Object.freeze({
|
|
131
|
+
AUTHORIZED_AND_COMMITTED: 'AUTHORIZED_AND_COMMITTED',
|
|
132
|
+
UNAUTHORIZED: 'UNAUTHORIZED',
|
|
133
|
+
COMMIT_UNPROVEN: 'COMMIT_UNPROVEN',
|
|
134
|
+
ONE_RUN_UNPROVEN: 'ONE_RUN_UNPROVEN',
|
|
135
|
+
RECORDED_UNWITNESSED: 'RECORDED_UNWITNESSED',
|
|
136
|
+
CUSTOM_REQUIREMENTS_SATISFIED: 'CUSTOM_REQUIREMENTS_SATISFIED',
|
|
137
|
+
NOT_COMMITTED: 'NOT_COMMITTED',
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=authorize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../src/authorize.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;;AAyKH,8BAgEC;AAvOD,mCAAyC;AA4IzC,SAAS,YAAY,CAAC,OAAyC;IAC3D,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvF,MAAM,CAAC,GAAG,IAAI,GAAG,EAAmB,CAAC;IACrC,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,IAAI,OAAO,C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|
|
80
80
|
authorizeChangeSet(req: PreflightChangeSetBody, opts?: PreflightRequestOptions): Promise<AuthorizeChangeSetResponse>;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
82
|
+
* A CONVENIENCE MIRROR, and NOT the offline proof.
|
|
83
|
+
*
|
|
84
|
+
* ── READ THIS BEFORE QUOTING ITS ANSWER ─────────────────────────────────────────────────
|
|
85
|
+
*
|
|
86
|
+
* This sends the receipt to CodeRifts and reports what CodeRifts says about it. That is
|
|
87
|
+
* genuinely useful — it is the only path that can see REVOCATION and the issuer's clock, which
|
|
88
|
+
* no local verifier can know — and it is NOT a verification you performed. The bytes travelled,
|
|
89
|
+
* the answer came back, and the thing you are trusting is the endpoint.
|
|
90
|
+
*
|
|
91
|
+
* **The proof is `verifyReceipt()` from the package root**: the same vendored core the public
|
|
92
|
+
* receipt-verifier and the conformance CLI run, in process, over bytes already in memory, with
|
|
93
|
+
* a keyring you pinned. No network, no key, full Ed25519.
|
|
94
|
+
*
|
|
95
|
+
* Use this one to ask the questions local verification cannot answer. Use the local one to
|
|
96
|
+
* establish that the receipt is authentic. If the two disagree, the local answer is what the
|
|
97
|
+
* signature says and this one is what the issuer currently says — both are facts, and only the
|
|
98
|
+
* first is a proof you hold.
|
|
99
|
+
*
|
|
100
|
+
* (Renamed from `verifyReceipt`. The old name sat on a network call in a package whose readers
|
|
101
|
+
* were being told they could verify without CodeRifts, and a name is read more often than a
|
|
102
|
+
* docstring. `verifyReceipt` on the client remains as a deprecated alias for one release.)
|
|
103
|
+
*
|
|
104
|
+
* No API key is required — this is a public endpoint (the Authorization header is sent for
|
|
105
|
+
* consistency but ignored server-side). POST /api/v1/verify-receipt.
|
|
85
106
|
*
|
|
86
107
|
* Two questions, and which one you get depends on whether you pass `intended`:
|
|
87
108
|
*
|
|
@@ -99,6 +120,13 @@ export declare class CodeRifts {
|
|
|
99
120
|
* @param token the chain-receipt token
|
|
100
121
|
* @param intended optional intended context; any subset of its fields may be supplied
|
|
101
122
|
*/
|
|
123
|
+
verifyReceiptViaServer(token: string, intended?: VerifyReceiptIntendedContext): Promise<VerifyReceiptResponse>;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Renamed to `verifyReceiptViaServer` — it is a network call and a convenience
|
|
126
|
+
* mirror, not the offline proof. The offline proof is `verifyReceipt()` exported from the
|
|
127
|
+
* package root, which runs the vendored core locally. Kept for one release; behaviour
|
|
128
|
+
* unchanged.
|
|
129
|
+
*/
|
|
102
130
|
verifyReceipt(token: string, intended?: VerifyReceiptIntendedContext): Promise<VerifyReceiptResponse>;
|
|
103
131
|
/**
|
|
104
132
|
* Look up a stored decision by decision_id or fingerprint; returns the stored
|
package/dist/cjs/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,sBAAsB,EAAmB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAKnmB,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBACrB,OAAO,EAAE,gBAAgB;YASvB,OAAO;IA0CrB;;;;;OAKG;IACG,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO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;OAOG;IACG,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQ1H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACG,sBAAsB,CACxB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,4BAA4B,GACxC,OAAO,CAAC,qBAAqB,CAAC;IAajC;;;;;OAKG;IACG,aAAa,CACf,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,4BAA4B,GACxC,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;OAGG;IACG,kBAAkB,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAGxF"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -286,11 +286,32 @@ class CodeRifts {
|
|
|
286
286
|
preflight_mode: 'authorize',
|
|
287
287
|
}, opts);
|
|
288
288
|
}
|
|
289
|
-
// ─── 9.
|
|
289
|
+
// ─── 9. verifyReceiptViaServer ─────────────────────────────────────────
|
|
290
290
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
291
|
+
* A CONVENIENCE MIRROR, and NOT the offline proof.
|
|
292
|
+
*
|
|
293
|
+
* ── READ THIS BEFORE QUOTING ITS ANSWER ─────────────────────────────────────────────────
|
|
294
|
+
*
|
|
295
|
+
* This sends the receipt to CodeRifts and reports what CodeRifts says about it. That is
|
|
296
|
+
* genuinely useful — it is the only path that can see REVOCATION and the issuer's clock, which
|
|
297
|
+
* no local verifier can know — and it is NOT a verification you performed. The bytes travelled,
|
|
298
|
+
* the answer came back, and the thing you are trusting is the endpoint.
|
|
299
|
+
*
|
|
300
|
+
* **The proof is `verifyReceipt()` from the package root**: the same vendored core the public
|
|
301
|
+
* receipt-verifier and the conformance CLI run, in process, over bytes already in memory, with
|
|
302
|
+
* a keyring you pinned. No network, no key, full Ed25519.
|
|
303
|
+
*
|
|
304
|
+
* Use this one to ask the questions local verification cannot answer. Use the local one to
|
|
305
|
+
* establish that the receipt is authentic. If the two disagree, the local answer is what the
|
|
306
|
+
* signature says and this one is what the issuer currently says — both are facts, and only the
|
|
307
|
+
* first is a proof you hold.
|
|
308
|
+
*
|
|
309
|
+
* (Renamed from `verifyReceipt`. The old name sat on a network call in a package whose readers
|
|
310
|
+
* were being told they could verify without CodeRifts, and a name is read more often than a
|
|
311
|
+
* docstring. `verifyReceipt` on the client remains as a deprecated alias for one release.)
|
|
312
|
+
*
|
|
313
|
+
* No API key is required — this is a public endpoint (the Authorization header is sent for
|
|
314
|
+
* consistency but ignored server-side). POST /api/v1/verify-receipt.
|
|
294
315
|
*
|
|
295
316
|
* Two questions, and which one you get depends on whether you pass `intended`:
|
|
296
317
|
*
|
|
@@ -308,7 +329,7 @@ class CodeRifts {
|
|
|
308
329
|
* @param token the chain-receipt token
|
|
309
330
|
* @param intended optional intended context; any subset of its fields may be supplied
|
|
310
331
|
*/
|
|
311
|
-
async
|
|
332
|
+
async verifyReceiptViaServer(token, intended) {
|
|
312
333
|
// Only the fields the caller actually supplied are sent. An absent field must stay ABSENT,
|
|
313
334
|
// not null: the server treats "no context" as signature-only, and a null would otherwise be
|
|
314
335
|
// read as an intent the caller never stated.
|
|
@@ -321,6 +342,15 @@ class CodeRifts {
|
|
|
321
342
|
}
|
|
322
343
|
return this.request('POST', '/api/v1/verify-receipt', body);
|
|
323
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* @deprecated Renamed to `verifyReceiptViaServer` — it is a network call and a convenience
|
|
347
|
+
* mirror, not the offline proof. The offline proof is `verifyReceipt()` exported from the
|
|
348
|
+
* package root, which runs the vendored core locally. Kept for one release; behaviour
|
|
349
|
+
* unchanged.
|
|
350
|
+
*/
|
|
351
|
+
async verifyReceipt(token, intended) {
|
|
352
|
+
return this.verifyReceiptViaServer(token, intended);
|
|
353
|
+
}
|
|
324
354
|
// ─── 10. getDecisionDetails ────────────────────────────────────────────
|
|
325
355
|
/**
|
|
326
356
|
* Look up a stored decision by decision_id or fingerprint; returns the stored
|
package/dist/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAIA,2CAAgF;AAChF,+CAAyE;AACzE,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,MAAa,SAAS;IACD,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,OAAO,CAAS;IACjC,YAAY,OAAyB;QACjC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC;IACtD,CAAC;IACD,0EAA0E;IAClE,KAAK,CAAC,OAAO,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc,EAAE,YAAqC;QACxG,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBACzB,MAAM;gBACN,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,UAAU,IAA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E,SAAS,EAAE,2CAA2C;QACtD,GAAG,EAAE,2DAA2D;QAChE,KAAK,EAAE,0DAA0D;QACjE,UAAU,EAAE,qEAAqE;QACjF,gBAAgB,EAAE,mCAAmC;KACxD,CAAC;IACF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,KAAK,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export { readDecision } from './decision.js';
|
|
|
20
20
|
export type { ReadDecisionResult } from './decision.js';
|
|
21
21
|
export { CLOCK_SKEW_LEEWAY_MS, expiryLeewayMs, declaresDestructiveProduction, isReceiptExpired, isIssuedInFuture, } from './leeway.js';
|
|
22
22
|
export type { ExpiryLeewayContext } from './leeway.js';
|
|
23
|
+
export { authorize, AUTHORIZATION_STATE } from './authorize.js';
|
|
24
|
+
export { verifyReceipt } from './verify-receipt-local.js';
|
|
25
|
+
export type { LocalReceiptVerdict, VerifyReceiptLocalOptions } from './verify-receipt-local.js';
|
|
26
|
+
export type { AuthorizeInput, AuthorizeResult, AuthorizationState, AuthorityName, AuthorityResult, PinnedKeyring, } from './authorize.js';
|
|
23
27
|
export { verifyExecutionGrant, computeScopeHash, afterPayloadCanonical, receiptDigest, GRANT_VERSION, GRANT_VERSION_V2, GRANT_SIGNING_PREFIX, } from './execution-grant.js';
|
|
24
28
|
export type { ExecutionGrantIntended, VerifyExecutionGrantResult, GrantStatus, ExecutionGrantV2, } from './execution-grant.js';
|
|
25
29
|
export { verifyExecutionAttestation, attestSigningInput, ATTEST_VERSION, ATTEST_SIGNING_PREFIX, ATTEST_ENVELOPE_TAG, } from './execution-attestation.js';
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa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BAAoB,EACpB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,eAAe,EACf,aAAa,EACb,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAG1B,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,YAAY,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.MONITOR_ATTEST_ENVELOPE_TAG = exports.MONITOR_ATTEST_SIGNING_PREFIX = exports.MONITOR_ATTEST_VERSION = exports.monitorAttestSigningInput = exports.verifyMonitoringAttestation = exports.ATTEST_ENVELOPE_TAG = exports.ATTEST_SIGNING_PREFIX = exports.ATTEST_VERSION = exports.attestSigningInput = exports.verifyExecutionAttestation = exports.GRANT_SIGNING_PREFIX = exports.GRANT_VERSION_V2 = exports.GRANT_VERSION = exports.receiptDigest = exports.afterPayloadCanonical = exports.computeScopeHash = exports.verifyExecutionGrant = exports.isIssuedInFuture = exports.isReceiptExpired = exports.declaresDestructiveProduction = exports.expiryLeewayMs = exports.CLOCK_SKEW_LEEWAY_MS = exports.readDecision = exports.AuthError = exports.RateLimitError = exports.TimeoutError = exports.ApiError = exports.CodeRiftsError = exports.resetPolicyWarnForTests = exports.warnPolicyAbsentOnce = exports.observePolicyPresence = exports.detectPolicyPresence = exports.policyPresenceOf = exports.withPolicy = exports.POLICY_ABSENT_WARN = exports.POLICY_MARKER = exports.CODERIFTS_POLICY = exports.CodeRifts = void 0;
|
|
17
|
+
exports.MONITOR_ATTEST_ENVELOPE_TAG = exports.MONITOR_ATTEST_SIGNING_PREFIX = exports.MONITOR_ATTEST_VERSION = exports.monitorAttestSigningInput = exports.verifyMonitoringAttestation = exports.ATTEST_ENVELOPE_TAG = exports.ATTEST_SIGNING_PREFIX = exports.ATTEST_VERSION = exports.attestSigningInput = exports.verifyExecutionAttestation = exports.GRANT_SIGNING_PREFIX = exports.GRANT_VERSION_V2 = exports.GRANT_VERSION = exports.receiptDigest = exports.afterPayloadCanonical = exports.computeScopeHash = exports.verifyExecutionGrant = exports.verifyReceipt = exports.AUTHORIZATION_STATE = exports.authorize = exports.isIssuedInFuture = exports.isReceiptExpired = exports.declaresDestructiveProduction = exports.expiryLeewayMs = exports.CLOCK_SKEW_LEEWAY_MS = exports.readDecision = exports.AuthError = exports.RateLimitError = exports.TimeoutError = exports.ApiError = exports.CodeRiftsError = exports.resetPolicyWarnForTests = exports.warnPolicyAbsentOnce = exports.observePolicyPresence = exports.detectPolicyPresence = exports.policyPresenceOf = exports.withPolicy = exports.POLICY_ABSENT_WARN = exports.POLICY_MARKER = exports.CODERIFTS_POLICY = exports.CodeRifts = void 0;
|
|
18
18
|
var client_js_1 = require("./client.js");
|
|
19
19
|
Object.defineProperty(exports, "CodeRifts", { enumerable: true, get: function () { return client_js_1.CodeRifts; } });
|
|
20
20
|
var policy_js_1 = require("./policy.js");
|
|
@@ -41,6 +41,27 @@ Object.defineProperty(exports, "expiryLeewayMs", { enumerable: true, get: functi
|
|
|
41
41
|
Object.defineProperty(exports, "declaresDestructiveProduction", { enumerable: true, get: function () { return leeway_js_1.declaresDestructiveProduction; } });
|
|
42
42
|
Object.defineProperty(exports, "isReceiptExpired", { enumerable: true, get: function () { return leeway_js_1.isReceiptExpired; } });
|
|
43
43
|
Object.defineProperty(exports, "isIssuedInFuture", { enumerable: true, get: function () { return leeway_js_1.isIssuedInFuture; } });
|
|
44
|
+
// ── THE AUTHORIZATION QUESTION (1463) ────────────────────────────────────────────────────────
|
|
45
|
+
//
|
|
46
|
+
// ADDITIVE. `verifyExecutionGrant` below is unchanged and still answers "is this token authentic,
|
|
47
|
+
// current and bound to what I intended". `authorize` answers a different question — "may this be
|
|
48
|
+
// treated as authorized AND committed" — by quoting the shared core predicate, so a TS caller
|
|
49
|
+
// reads the same named states the guard, Prove, conformance and the contract-gate print.
|
|
50
|
+
var authorize_js_1 = require("./authorize.js");
|
|
51
|
+
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_js_1.authorize; } });
|
|
52
|
+
Object.defineProperty(exports, "AUTHORIZATION_STATE", { enumerable: true, get: function () { return authorize_js_1.AUTHORIZATION_STATE; } });
|
|
53
|
+
// ── THE OFFLINE PROOF ───────────────────────────────────────────────────────────────────────
|
|
54
|
+
//
|
|
55
|
+
// `verifyReceipt` here is LOCAL: the vendored receipt-verifier core, in process, over bytes
|
|
56
|
+
// already in memory plus a keyring the caller pinned. No network, no API key, full Ed25519.
|
|
57
|
+
//
|
|
58
|
+
// It is exported from the package ROOT deliberately. The only `verifyReceipt` this SDK had was a
|
|
59
|
+
// method on the client that POSTs to CodeRifts — useful, and not a verification the caller
|
|
60
|
+
// performed. A reader told "verify offline, without us" and handed that method has been told
|
|
61
|
+
// something the package could not do, and a NAME is read more often than a docstring.
|
|
62
|
+
// `client.verifyReceiptViaServer()` is the mirror, and says so.
|
|
63
|
+
var verify_receipt_local_js_1 = require("./verify-receipt-local.js");
|
|
64
|
+
Object.defineProperty(exports, "verifyReceipt", { enumerable: true, get: function () { return verify_receipt_local_js_1.verifyReceipt; } });
|
|
44
65
|
var execution_grant_js_1 = require("./execution-grant.js");
|
|
45
66
|
Object.defineProperty(exports, "verifyExecutionGrant", { enumerable: true, get: function () { return execution_grant_js_1.verifyExecutionGrant; } });
|
|
46
67
|
Object.defineProperty(exports, "computeScopeHash", { enumerable: true, get: function () { return execution_grant_js_1.computeScopeHash; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,yCAUqB;AATjB,6GAAA,gBAAgB,OAAA;AAChB,0GAAA,aAAa,OAAA;AACb,+GAAA,kBAAkB,OAAA;AAClB,uGAAA,UAAU,OAAA;AACV,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AAO3B,yCAAgG;AAAvF,2GAAA,cAAc,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,sGAAA,SAAS,OAAA;AAC1E,6CAA6C;AAApC,2GAAA,YAAY,OAAA;AAErB,yCAMqB;AALjB,iHAAA,oBAAoB,OAAA;AACpB,2GAAA,cAAc,OAAA;AACd,0HAAA,6BAA6B,OAAA;AAC7B,6GAAA,gBAAgB,OAAA;AAChB,6GAAA,gBAAgB,OAAA;AAGpB,2DAQ8B;AAP1B,0HAAA,oBAAoB,OAAA;AACpB,sHAAA,gBAAgB,OAAA;AAChB,2HAAA,qBAAqB,OAAA;AACrB,mHAAA,aAAa,OAAA;AACb,mHAAA,aAAa,OAAA;AACb,sHAAA,gBAAgB,OAAA;AAChB,0HAAA,oBAAoB,OAAA;AAQxB,uEAMoC;AALhC,sIAAA,0BAA0B,OAAA;AAC1B,8HAAA,kBAAkB,OAAA;AAClB,0HAAA,cAAc,OAAA;AACd,iIAAA,qBAAqB,OAAA;AACrB,+HAA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