verdifax 1.1.0 → 1.3.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 +131 -4
- package/dist/index.d.mts +394 -6
- package/dist/index.d.ts +394 -6
- package/dist/index.js +566 -17
- package/dist/index.mjs +563 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,10 +71,117 @@ interface ExecuteRequest {
|
|
|
71
71
|
/** Places this run in a job map. Not accepted by a determinism check,
|
|
72
72
|
* which runs twice. */
|
|
73
73
|
job?: JobLink;
|
|
74
|
+
/** What this request declares for the rules of an active customer policy
|
|
75
|
+
* to read. Unknown keys and values outside the lists are refused before
|
|
76
|
+
* sending. */
|
|
77
|
+
policy_context?: PolicyContext;
|
|
78
|
+
/** The policy hash this request expects to run under. When another policy
|
|
79
|
+
* is active the server refuses the run with HTTP 409. */
|
|
80
|
+
expected_policy_hash?: Hex64;
|
|
74
81
|
/** A version 1 signature for an unsigned client to send. A client with
|
|
75
82
|
* the `signingKey` option sends version 2 and drops this field. */
|
|
76
83
|
request_signature?: RequestSignature;
|
|
77
84
|
}
|
|
85
|
+
/** Who the attested actor is, for a policy rule to read. */
|
|
86
|
+
type PolicyActorType = "agent" | "user" | "service" | "system";
|
|
87
|
+
/** What the request acts on, for a policy rule to read. */
|
|
88
|
+
type PolicyObjectType = "text" | "transaction" | "code" | "data" | "model" | "file";
|
|
89
|
+
/** A classification level, for a policy rule to read. */
|
|
90
|
+
type PolicyClassification = "PUBLIC" | "INTERNAL" | "CONFIDENTIAL" | "RESTRICTED" | "TOP_SECRET" | "TS_SCI";
|
|
91
|
+
/** The facts a request declares for the rules of a customer policy. These
|
|
92
|
+
* are the caller's own statements: a rule on them judges what was
|
|
93
|
+
* declared, and cannot show that it is true. Every key is optional, and
|
|
94
|
+
* the client refuses any other key before sending, because a misspelt key
|
|
95
|
+
* would be dropped and a rule on it would read its zero value.
|
|
96
|
+
*
|
|
97
|
+
* `actor_type`, `mfa_satisfied` and `session_age_seconds` describe the
|
|
98
|
+
* attested actor, so a request that sets one of them must also carry an
|
|
99
|
+
* `attested_context` naming the actor, for example its `actor_id`. */
|
|
100
|
+
interface PolicyContext {
|
|
101
|
+
actor_type?: PolicyActorType;
|
|
102
|
+
mfa_satisfied?: boolean;
|
|
103
|
+
/** A non-negative whole number of seconds. */
|
|
104
|
+
session_age_seconds?: number;
|
|
105
|
+
object_type?: PolicyObjectType;
|
|
106
|
+
/** At most 256 bytes of UTF-8. */
|
|
107
|
+
object_id?: string;
|
|
108
|
+
classification?: PolicyClassification;
|
|
109
|
+
}
|
|
110
|
+
/** A stored policy document, as POST /policies and GET /policies return
|
|
111
|
+
* it. */
|
|
112
|
+
interface Policy {
|
|
113
|
+
policy_id: string;
|
|
114
|
+
policy_version: string;
|
|
115
|
+
policy_hash: Hex64;
|
|
116
|
+
/** SHA-256 of the exact text that was uploaded. */
|
|
117
|
+
document_hash: Hex64;
|
|
118
|
+
created_at: string;
|
|
119
|
+
}
|
|
120
|
+
/** Returned by {@link VerdifaxClient.getPolicy}: the stored policy and its
|
|
121
|
+
* exact text. */
|
|
122
|
+
interface PolicyWithDocument extends Policy {
|
|
123
|
+
document: string;
|
|
124
|
+
}
|
|
125
|
+
/** Returned by {@link VerdifaxClient.listPolicies}. */
|
|
126
|
+
interface PolicyList {
|
|
127
|
+
ok: boolean;
|
|
128
|
+
/** The chain of this key's policy changes, for example `api-key-7`. */
|
|
129
|
+
chain_id?: string;
|
|
130
|
+
/** The newest change, or 64 zeros when there is none yet. */
|
|
131
|
+
newest_activation_hash: Hex64;
|
|
132
|
+
/** The document in force, or empty under the built-in policy. */
|
|
133
|
+
active_document_hash: string;
|
|
134
|
+
policies: Policy[];
|
|
135
|
+
}
|
|
136
|
+
/** The argument of {@link VerdifaxClient.testPolicy}: sample inputs and
|
|
137
|
+
* exactly one of `document` or `documentHash`. */
|
|
138
|
+
interface PolicyTestRequest {
|
|
139
|
+
/** Sample inputs for the rules, passed through as given. */
|
|
140
|
+
inputs: Record<string, unknown>;
|
|
141
|
+
/** The exact text of a policy to test. */
|
|
142
|
+
document?: string;
|
|
143
|
+
/** The document hash of a policy already uploaded under this key. */
|
|
144
|
+
documentHash?: Hex64;
|
|
145
|
+
}
|
|
146
|
+
/** Returned by {@link VerdifaxClient.testPolicy}. A test seals nothing. */
|
|
147
|
+
interface PolicyTestResult {
|
|
148
|
+
ok: boolean;
|
|
149
|
+
/** Always false. */
|
|
150
|
+
sealed: boolean;
|
|
151
|
+
outcome: string;
|
|
152
|
+
fired_rule_id: string;
|
|
153
|
+
reason_code: string;
|
|
154
|
+
}
|
|
155
|
+
/** The signature of a policy activation: the request key's approval of
|
|
156
|
+
* the change. */
|
|
157
|
+
interface PolicyActivationSignature {
|
|
158
|
+
/** Base64 Ed25519 signature by the request key. */
|
|
159
|
+
signature: string;
|
|
160
|
+
/** RFC 3339 UTC with whole seconds. */
|
|
161
|
+
signed_at: string;
|
|
162
|
+
/** 16 random bytes as 32 lowercase hex characters, fresh per change. */
|
|
163
|
+
nonce: string;
|
|
164
|
+
}
|
|
165
|
+
/** One policy change, as {@link VerdifaxClient.activatePolicy} and
|
|
166
|
+
* {@link VerdifaxClient.getPolicyHistory} return it. */
|
|
167
|
+
interface PolicyActivation {
|
|
168
|
+
format: string;
|
|
169
|
+
chain_id: string;
|
|
170
|
+
sequence: number;
|
|
171
|
+
previous_activation_hash: Hex64;
|
|
172
|
+
policy_id: string;
|
|
173
|
+
policy_version: string;
|
|
174
|
+
policy_hash: Hex64;
|
|
175
|
+
document_hash: Hex64;
|
|
176
|
+
activated_at: string;
|
|
177
|
+
/** Present when the request key signed the change. */
|
|
178
|
+
signature?: PolicyActivationSignature & {
|
|
179
|
+
public_key: string;
|
|
180
|
+
};
|
|
181
|
+
activation_hash: Hex64;
|
|
182
|
+
/** Where the change was logged on the public log. */
|
|
183
|
+
anchor?: Record<string, unknown>;
|
|
184
|
+
}
|
|
78
185
|
/** Places one run in a job. `job_id` and `step_id` are 1 to 128 letters,
|
|
79
186
|
* digits, dots, underscores, colons or dashes. The client sorts both
|
|
80
187
|
* lists, removes repeats and leaves out an empty list and a false
|
|
@@ -211,8 +318,13 @@ interface DeterminismRun {
|
|
|
211
318
|
manifest_hash: string;
|
|
212
319
|
bundle_hash: string;
|
|
213
320
|
duration_ms: number;
|
|
321
|
+
/** `ok`, `stage_error`, or the refusal or halt kind, such as
|
|
322
|
+
* `pepg_deny`. */
|
|
214
323
|
status: string;
|
|
215
324
|
error?: string;
|
|
325
|
+
/** The sealed receipt of a refused or halted run. The run's manifest
|
|
326
|
+
* hash covers its hash. */
|
|
327
|
+
receipt?: Record<string, unknown>;
|
|
216
328
|
}
|
|
217
329
|
/** How the two runs of a determinism check compared. */
|
|
218
330
|
interface DeterminismDiff {
|
|
@@ -220,9 +332,12 @@ interface DeterminismDiff {
|
|
|
220
332
|
manifest_hash_differs: boolean;
|
|
221
333
|
bundle_hash_differs: boolean;
|
|
222
334
|
differing_fields?: string[];
|
|
335
|
+
/** Why there is no verdict, when neither run sealed a record. */
|
|
336
|
+
reason?: string;
|
|
223
337
|
}
|
|
224
338
|
/** Body returned by POST /execute/verify-determinism. `deterministic`
|
|
225
|
-
* means both runs ended
|
|
339
|
+
* means both runs ended the same way, completed or refused, with equal
|
|
340
|
+
* manifest hashes. */
|
|
226
341
|
interface VerifyDeterminismResponse {
|
|
227
342
|
ok: boolean;
|
|
228
343
|
deterministic: boolean;
|
|
@@ -341,6 +456,10 @@ interface AttestRequest {
|
|
|
341
456
|
causal_graph?: Record<string, unknown>;
|
|
342
457
|
/** Places this run in a job map. {@link VerdifaxJob.step} fills it in. */
|
|
343
458
|
job?: JobLink;
|
|
459
|
+
/** What this request declares for the rules of a customer policy. */
|
|
460
|
+
policy_context?: PolicyContext;
|
|
461
|
+
/** The policy hash this request expects to run under. */
|
|
462
|
+
expected_policy_hash?: Hex64;
|
|
344
463
|
}
|
|
345
464
|
/** The second argument of {@link VerdifaxJob.step}: everything
|
|
346
465
|
* {@link VerdifaxClient.attest} takes except `job`, which the helper
|
|
@@ -365,6 +484,8 @@ interface ListRunsParams {
|
|
|
365
484
|
* for the full sealed manifest. */
|
|
366
485
|
interface RunSummary {
|
|
367
486
|
id: number;
|
|
487
|
+
/** The key that requested the run. */
|
|
488
|
+
api_key_id?: number;
|
|
368
489
|
created_at: string;
|
|
369
490
|
program_id: Hex64;
|
|
370
491
|
route_id: string;
|
|
@@ -401,6 +522,9 @@ interface ExportRunsParams {
|
|
|
401
522
|
/** One run in an evidence export: what the server stored, not a verdict. */
|
|
402
523
|
interface ExportRow {
|
|
403
524
|
run_id: number;
|
|
525
|
+
/** The key that requested the run, so an account's export can be
|
|
526
|
+
* grouped by key. */
|
|
527
|
+
api_key_id?: number;
|
|
404
528
|
created_at: string;
|
|
405
529
|
status: RunStatus;
|
|
406
530
|
error_stage: string;
|
|
@@ -430,6 +554,21 @@ interface RunsExport {
|
|
|
430
554
|
/** Rows returned, counted by status. */
|
|
431
555
|
by_status: Record<string, number>;
|
|
432
556
|
runs: ExportRow[];
|
|
557
|
+
/** The key's policy documents, when it has loaded any. */
|
|
558
|
+
policy_documents?: PolicyWithDocument[];
|
|
559
|
+
/** The key's policy changes, oldest first, when it has loaded any. */
|
|
560
|
+
policy_history?: PolicyActivation[];
|
|
561
|
+
/** The key's account, as `account-N`. */
|
|
562
|
+
account_id?: string;
|
|
563
|
+
/** The account's policy documents, when it has loaded any. */
|
|
564
|
+
account_policy_documents?: PolicyWithDocument[];
|
|
565
|
+
/** The account's policy changes, oldest first, when it has loaded any. */
|
|
566
|
+
account_policy_history?: PolicyActivation[];
|
|
567
|
+
}
|
|
568
|
+
/** Returned by {@link VerdifaxClient.exportAccountRuns}: the runs of every
|
|
569
|
+
* key in the account, with the account's policy documents and changes. */
|
|
570
|
+
interface AccountRunsExport extends RunsExport {
|
|
571
|
+
account_id: string;
|
|
433
572
|
}
|
|
434
573
|
/** Returned by {@link VerdifaxClient.exportRunsCSV}. */
|
|
435
574
|
interface RunsExportCSV {
|
|
@@ -518,6 +657,93 @@ interface AdminCreateKeyResponse {
|
|
|
518
657
|
name: string;
|
|
519
658
|
secret: string;
|
|
520
659
|
hint: string;
|
|
660
|
+
/** The key's account, as `account-N`. */
|
|
661
|
+
account_id?: string;
|
|
662
|
+
}
|
|
663
|
+
/** Options for {@link VerdifaxClient.adminCreateKey}. */
|
|
664
|
+
interface AdminCreateKeyOptions {
|
|
665
|
+
/** Puts the customer key in this existing account, by its number. Without
|
|
666
|
+
* it the key gets an account of its own. A key never changes account. */
|
|
667
|
+
accountId?: number;
|
|
668
|
+
}
|
|
669
|
+
/** A key's tier. */
|
|
670
|
+
type KeyTier = "trial" | "production";
|
|
671
|
+
/** An account, a company on Verdifax, as GET /admin/accounts lists it. The
|
|
672
|
+
* account number is a label Verdifax assigned, not a verified company
|
|
673
|
+
* identity. */
|
|
674
|
+
interface Account {
|
|
675
|
+
/** `account-N`, as records seal it. */
|
|
676
|
+
account_id: string;
|
|
677
|
+
id: number;
|
|
678
|
+
name: string;
|
|
679
|
+
tier: string;
|
|
680
|
+
created_at: string;
|
|
681
|
+
/** Member keys not revoked. */
|
|
682
|
+
member_keys: number;
|
|
683
|
+
/** Owner keys not revoked. */
|
|
684
|
+
owner_keys: number;
|
|
685
|
+
/** The chain of the account's policy changes, `account-N`. */
|
|
686
|
+
chain_id: string;
|
|
687
|
+
identity?: string;
|
|
688
|
+
policy_scope?: string;
|
|
689
|
+
}
|
|
690
|
+
/** Returned by {@link VerdifaxClient.getAccount}. */
|
|
691
|
+
interface AccountInfo extends Account {
|
|
692
|
+
ok: boolean;
|
|
693
|
+
}
|
|
694
|
+
/** One of an account's keys, without its secret. */
|
|
695
|
+
interface AccountKey {
|
|
696
|
+
id: number;
|
|
697
|
+
name: string;
|
|
698
|
+
account_id: string;
|
|
699
|
+
/** True for an owner key, which manages the account and cannot run
|
|
700
|
+
* anything. */
|
|
701
|
+
owner: boolean;
|
|
702
|
+
tier: string;
|
|
703
|
+
created_at: string;
|
|
704
|
+
last_used_at: string;
|
|
705
|
+
run_count: number;
|
|
706
|
+
revoked: boolean;
|
|
707
|
+
expires_at?: string;
|
|
708
|
+
}
|
|
709
|
+
/** Returned by {@link VerdifaxClient.listAccountKeys}. */
|
|
710
|
+
interface AccountKeyList {
|
|
711
|
+
ok: boolean;
|
|
712
|
+
account_id: string;
|
|
713
|
+
keys: AccountKey[];
|
|
714
|
+
}
|
|
715
|
+
/** A new key with its secret, which is shown this once. */
|
|
716
|
+
interface CreatedAccountKey extends AccountKey {
|
|
717
|
+
ok: boolean;
|
|
718
|
+
secret: string;
|
|
719
|
+
/** True when the key needs a request key before it can run. */
|
|
720
|
+
request_key_required: boolean;
|
|
721
|
+
hint: string;
|
|
722
|
+
}
|
|
723
|
+
/** Returned by {@link VerdifaxClient.revokeAccountKey}. */
|
|
724
|
+
interface AccountKeyRevocation {
|
|
725
|
+
ok: boolean;
|
|
726
|
+
id: number;
|
|
727
|
+
revoked: boolean;
|
|
728
|
+
}
|
|
729
|
+
/** Options for {@link VerdifaxClient.createAccountKey}. */
|
|
730
|
+
interface CreateAccountKeyOptions {
|
|
731
|
+
/** RFC 3339 or YYYY-MM-DD. */
|
|
732
|
+
expiresAt?: string;
|
|
733
|
+
}
|
|
734
|
+
/** Options for {@link VerdifaxClient.adminCreateAccount}. */
|
|
735
|
+
interface AdminCreateAccountOptions {
|
|
736
|
+
/** `trial` when left out. */
|
|
737
|
+
tier?: KeyTier;
|
|
738
|
+
/** When the owner key expires: RFC 3339 or YYYY-MM-DD. */
|
|
739
|
+
expiresAt?: string;
|
|
740
|
+
}
|
|
741
|
+
/** Returned by {@link VerdifaxClient.adminCreateAccount}: the account and
|
|
742
|
+
* its first owner key, with the secret. */
|
|
743
|
+
interface AdminCreateAccountResponse {
|
|
744
|
+
ok: boolean;
|
|
745
|
+
account: Account;
|
|
746
|
+
owner_key: CreatedAccountKey;
|
|
521
747
|
}
|
|
522
748
|
/** Projection returned by {@link VerdifaxClient.adminListKeys}.
|
|
523
749
|
* Secrets are NEVER surfaced, only metadata. */
|
|
@@ -611,15 +837,38 @@ declare const MAX_BATCH_ROWS = 1000;
|
|
|
611
837
|
* | `listDeletionReceipts(id)` | GET /runs/{id}/deletion-receipts | required |
|
|
612
838
|
* | `adminErase(req)` | POST /admin/erase | required |
|
|
613
839
|
* | `dcaeVerify(bundle)` | POST /dcae/verify | none |
|
|
614
|
-
* | `adminCreateKey(name)` | POST /admin/keys | required |
|
|
840
|
+
* | `adminCreateKey(name, options)` | POST /admin/keys | required |
|
|
615
841
|
* | `adminListKeys()` | GET /admin/keys | required |
|
|
616
842
|
* | `adminRevokeKey(id)` | DELETE /admin/keys/{id} | required |
|
|
617
843
|
* | `adminClearRequestKey(id)` | DELETE /admin/keys/{id}/request-key | required |
|
|
844
|
+
* | `adminCreateAccount(name, options)` | POST /admin/accounts | required |
|
|
845
|
+
* | `adminListAccounts()` | GET /admin/accounts | required |
|
|
618
846
|
* | `attestClaudeResponse(...)` | POST /execute (helper) | required |
|
|
619
847
|
* | `attestOpenAIResponse(...)` | POST /execute (helper) | required |
|
|
620
848
|
* | `registerRequestKey()` | POST /keys/request-key | required |
|
|
621
849
|
* | `rotateRequestKey(newSigningKey)` | POST /keys/request-key | required |
|
|
622
850
|
* | `clearRequestKey()` | DELETE /keys/request-key | required |
|
|
851
|
+
* | `uploadPolicy(document)` | POST /policies | required |
|
|
852
|
+
* | `listPolicies()` | GET /policies | required |
|
|
853
|
+
* | `getPolicy(documentHash)` | GET /policies/{document_hash} | required |
|
|
854
|
+
* | `testPolicy(req)` | POST /policies/test | required |
|
|
855
|
+
* | `getPolicyHistory()` | GET /policies/history | required |
|
|
856
|
+
* | `activatePolicy(documentHash)` | POST /policies/{document_hash}/activate | required |
|
|
857
|
+
* | `getAccount()` | GET /account | owner key |
|
|
858
|
+
* | `createAccountKey(name, options)` | POST /account/keys | owner key |
|
|
859
|
+
* | `listAccountKeys()` | GET /account/keys | owner key |
|
|
860
|
+
* | `revokeAccountKey(id)` | DELETE /account/keys/{id} | owner key |
|
|
861
|
+
* | `registerAccountRequestKey()` | POST /account/request-key | owner key |
|
|
862
|
+
* | `clearAccountRequestKey()` | DELETE /account/request-key | owner key |
|
|
863
|
+
* | `listAccountRuns(params)` | GET /account/runs | owner key |
|
|
864
|
+
* | `exportAccountRuns(params)` | GET /account/runs/export | owner key |
|
|
865
|
+
* | `exportAccountRunsCSV(params)` | GET /account/runs/export?format=csv | owner key |
|
|
866
|
+
* | `uploadAccountPolicy(document)` | POST /account/policies | owner key |
|
|
867
|
+
* | `listAccountPolicies()` | GET /account/policies | owner key |
|
|
868
|
+
* | `getAccountPolicy(documentHash)` | GET /account/policies/{document_hash} | owner key |
|
|
869
|
+
* | `testAccountPolicy(req)` | POST /account/policies/test | owner key |
|
|
870
|
+
* | `getAccountPolicyHistory()` | GET /account/policies/history | owner key |
|
|
871
|
+
* | `activateAccountPolicy(documentHash)` | POST /account/policies/{document_hash}/activate | owner key |
|
|
623
872
|
* | `job(jobId)` | none, returns a {@link VerdifaxJob} | none |
|
|
624
873
|
*
|
|
625
874
|
* With the `signingKey` option set, every path to POST /execute carries
|
|
@@ -658,8 +907,9 @@ declare class VerdifaxClient {
|
|
|
658
907
|
* signing key each row carries its own signature and nonce. A row
|
|
659
908
|
* that fails comes back in `results` with `ok: false`, so the call
|
|
660
909
|
* does not throw for it. The rows are not checked here, except a job
|
|
661
|
-
* block,
|
|
662
|
-
* any other bad row
|
|
910
|
+
* block, a `policy_context` and an `expected_policy_hash`, which are
|
|
911
|
+
* refused before anything is sent: the server reports any other bad row
|
|
912
|
+
* in that row's result.
|
|
663
913
|
*
|
|
664
914
|
* This is one POST and it is never retried. After a timeout the
|
|
665
915
|
* server may have run some or all of the rows. */
|
|
@@ -677,6 +927,7 @@ declare class VerdifaxClient {
|
|
|
677
927
|
* that the client holds the private key. From then on the server
|
|
678
928
|
* refuses a run on this API key without a request signature. */
|
|
679
929
|
registerRequestKey(): Promise<RequestKeyRegistration>;
|
|
930
|
+
private registerRequestKeyAt;
|
|
680
931
|
/** Replaces the registered key with `newSigningKey`. The new key proves
|
|
681
932
|
* itself and this client's current key approves the change. After
|
|
682
933
|
* success this client signs with the new key. If the call fails it
|
|
@@ -690,12 +941,109 @@ declare class VerdifaxClient {
|
|
|
690
941
|
* unsigned requests, because the server refuses a signed run on an API
|
|
691
942
|
* key with no registered key. If the call fails it keeps the key. */
|
|
692
943
|
clearRequestKey(): Promise<void>;
|
|
944
|
+
private clearRequestKeyAt;
|
|
945
|
+
/** Stores a policy document. Nothing changes until it is activated with
|
|
946
|
+
* {@link activatePolicy}. The server hashes the exact text, so this
|
|
947
|
+
* sends the string it is given unchanged and refuses anything that is
|
|
948
|
+
* not a string: serializing an object here would change the hash.
|
|
949
|
+
* Verdifax does not write, review or approve a customer's policy. */
|
|
950
|
+
uploadPolicy(document: string): Promise<Policy>;
|
|
951
|
+
/** This key's stored documents, with the chain its changes belong to,
|
|
952
|
+
* the newest change in it (64 zeros when there is none yet) and the
|
|
953
|
+
* document in force (empty under the built-in policy). */
|
|
954
|
+
listPolicies(): Promise<PolicyList>;
|
|
955
|
+
/** One stored document, with its exact text as `document`. */
|
|
956
|
+
getPolicy(documentHash: Hex64): Promise<PolicyWithDocument>;
|
|
957
|
+
/** Shows which rule would fire on sample inputs, for a document given as
|
|
958
|
+
* text or one already stored, named by its hash: exactly one of the two.
|
|
959
|
+
* It seals nothing. */
|
|
960
|
+
testPolicy(req: PolicyTestRequest): Promise<PolicyTestResult>;
|
|
961
|
+
/** This key's policy changes, oldest first, as the list the server sends.
|
|
962
|
+
* Save it as JSON, for example with
|
|
963
|
+
* `writeFileSync("policy-history.json", JSON.stringify(history))`, and
|
|
964
|
+
* check it with `verdifax-verify --policy-history policy-history.json`. */
|
|
965
|
+
getPolicyHistory(): Promise<PolicyActivation[]>;
|
|
966
|
+
/** Makes a stored document the policy in force and returns the change
|
|
967
|
+
* record. It first reads GET /policies for the chain and its newest
|
|
968
|
+
* change, then names that change as the one this follows. With the
|
|
969
|
+
* `signingKey` option the request key signs the change, which the server
|
|
970
|
+
* requires while a request key is registered.
|
|
971
|
+
*
|
|
972
|
+
* Rolling back is activating an earlier document: it is one more change
|
|
973
|
+
* in the chain, so the change it undoes stays on the record.
|
|
974
|
+
*
|
|
975
|
+
* An HTTP 409 means the chain moved because another change came first,
|
|
976
|
+
* or the document is not yet effective. It throws the usual
|
|
977
|
+
* {@link APIError} and is not retried: read the policies again and
|
|
978
|
+
* decide. */
|
|
979
|
+
activatePolicy(documentHash: Hex64): Promise<PolicyActivation>;
|
|
980
|
+
private uploadPolicyAt;
|
|
981
|
+
private getPolicyAt;
|
|
982
|
+
private testPolicyAt;
|
|
983
|
+
/** Posts the change that follows the newest one in `chain`, signed by
|
|
984
|
+
* the request key when the client has one. */
|
|
985
|
+
private activatePolicyAt;
|
|
986
|
+
/** The owner's account: its number, name, tier, key counts and the
|
|
987
|
+
* chain of its policy changes. */
|
|
988
|
+
getAccount(): Promise<AccountInfo>;
|
|
989
|
+
/** Creates a member key in the account. It takes the account's tier and
|
|
990
|
+
* stays in the account for life. The secret is in the result this once.
|
|
991
|
+
* On a trial account the key needs a request key before it can run. */
|
|
992
|
+
createAccountKey(name: string, options?: CreateAccountKeyOptions): Promise<CreatedAccountKey>;
|
|
993
|
+
/** Every key in the account, owner keys included, without secrets. */
|
|
994
|
+
listAccountKeys(): Promise<AccountKeyList>;
|
|
995
|
+
/** Revokes one of the account's member keys. A key in another account,
|
|
996
|
+
* or an owner key, throws {@link NotFoundError}. */
|
|
997
|
+
revokeAccountKey(keyId: number): Promise<AccountKeyRevocation>;
|
|
998
|
+
/** Registers this client's public key as the owner key's request key,
|
|
999
|
+
* which must sign every change to the account's policy. It works as
|
|
1000
|
+
* {@link registerRequestKey} does. */
|
|
1001
|
+
registerAccountRequestKey(): Promise<RequestKeyRegistration>;
|
|
1002
|
+
/** Clears the owner key's request key, as {@link clearRequestKey} does
|
|
1003
|
+
* for a key's own. With none registered the account's policy cannot be
|
|
1004
|
+
* changed. A trial owner key's request key cannot be cleared. */
|
|
1005
|
+
clearAccountRequestKey(): Promise<void>;
|
|
1006
|
+
/** The runs of every key in the account, paged as {@link listRuns}. */
|
|
1007
|
+
listAccountRuns(params?: ListRunsParams): Promise<{
|
|
1008
|
+
runs: RunSummary[];
|
|
1009
|
+
total: number;
|
|
1010
|
+
}>;
|
|
1011
|
+
/** The runs of every key in the account in a period, as
|
|
1012
|
+
* {@link exportRuns} lists a key's, with the account's number, its
|
|
1013
|
+
* policy documents and its chain of changes. The account's view covers
|
|
1014
|
+
* the runs its keys made through Verdifax, not runs made elsewhere. */
|
|
1015
|
+
exportAccountRuns(params?: ExportRunsParams): Promise<AccountRunsExport>;
|
|
1016
|
+
/** The same rows as {@link exportAccountRuns} as raw CSV text, checked
|
|
1017
|
+
* as {@link exportRunsCSV} checks a key's. */
|
|
1018
|
+
exportAccountRunsCSV(params?: ExportRunsParams): Promise<RunsExportCSV>;
|
|
1019
|
+
/** Stores an account policy document, as {@link uploadPolicy} stores a
|
|
1020
|
+
* key's. Every key in the account must pass the account's policy on top
|
|
1021
|
+
* of its own. Verdifax does not write, review or approve it. */
|
|
1022
|
+
uploadAccountPolicy(document: string): Promise<Policy>;
|
|
1023
|
+
/** The account's stored documents, its chain `account-N`, the newest
|
|
1024
|
+
* change in it and the document in force. */
|
|
1025
|
+
listAccountPolicies(): Promise<PolicyList>;
|
|
1026
|
+
/** One of the account's documents, with its exact text. */
|
|
1027
|
+
getAccountPolicy(documentHash: Hex64): Promise<PolicyWithDocument>;
|
|
1028
|
+
/** {@link testPolicy} for the account's documents. It seals nothing. */
|
|
1029
|
+
testAccountPolicy(req: PolicyTestRequest): Promise<PolicyTestResult>;
|
|
1030
|
+
/** The account's policy changes, oldest first, in the form
|
|
1031
|
+
* `verdifax-verify --policy-history FILE` reads. */
|
|
1032
|
+
getAccountPolicyHistory(): Promise<PolicyActivation[]>;
|
|
1033
|
+
/** Makes a stored document the account's policy in force, as
|
|
1034
|
+
* {@link activatePolicy} does for a key's. It reads
|
|
1035
|
+
* {@link listAccountPolicies} for the chain and its newest change, and
|
|
1036
|
+
* the owner key's request key signs the change over that chain,
|
|
1037
|
+
* `account-N`. The server refuses an unsigned account change, so this
|
|
1038
|
+
* needs the `signingKey` option and refuses to send without it. */
|
|
1039
|
+
activateAccountPolicy(documentHash: Hex64): Promise<PolicyActivation>;
|
|
693
1040
|
getRun(runId: number): Promise<Run>;
|
|
694
1041
|
verifyRun(runId: number): Promise<VerifyResponse>;
|
|
695
1042
|
listRuns(params?: ListRunsParams): Promise<{
|
|
696
1043
|
runs: RunSummary[];
|
|
697
1044
|
total: number;
|
|
698
1045
|
}>;
|
|
1046
|
+
private listRunsAt;
|
|
699
1047
|
/** Searches this key's runs. `manifest_hash` matches a prefix. The
|
|
700
1048
|
* server ignores a `from` or `to` it cannot parse here, unlike
|
|
701
1049
|
* {@link exportRuns}, which refuses one. */
|
|
@@ -714,6 +1062,7 @@ declare class VerdifaxClient {
|
|
|
714
1062
|
* does not send those headers, so that a cut-off export cannot pass
|
|
715
1063
|
* for a complete one. */
|
|
716
1064
|
exportRunsCSV(params?: ExportRunsParams): Promise<RunsExportCSV>;
|
|
1065
|
+
private exportCSVAt;
|
|
717
1066
|
private exportPath;
|
|
718
1067
|
listAttestations(params?: ListAttestationsParams): Promise<AttestationList>;
|
|
719
1068
|
getAttestation(attestationId: number): Promise<Record<string, unknown>>;
|
|
@@ -744,7 +1093,16 @@ declare class VerdifaxClient {
|
|
|
744
1093
|
listDeletionReceipts(runId: number): Promise<DeletionReceipt[]>;
|
|
745
1094
|
adminErase(req: AdminEraseRequest): Promise<DeletionReceipt>;
|
|
746
1095
|
dcaeVerify(bundle: DCAEProofBundle): Promise<DCAEVerdict>;
|
|
747
|
-
|
|
1096
|
+
/** Creates a customer key. With `accountId` the key joins that existing
|
|
1097
|
+
* account; without it the key gets an account of its own. A key never
|
|
1098
|
+
* changes account. */
|
|
1099
|
+
adminCreateKey(name: string, options?: AdminCreateKeyOptions): Promise<AdminCreateKeyResponse>;
|
|
1100
|
+
/** Creates an account and its first owner key, whose secret is in the
|
|
1101
|
+
* result this once. The owner key creates the member keys. The account
|
|
1102
|
+
* number is a label Verdifax assigned, not a verified company identity. */
|
|
1103
|
+
adminCreateAccount(name: string, options?: AdminCreateAccountOptions): Promise<AdminCreateAccountResponse>;
|
|
1104
|
+
/** Every account, with its key counts. */
|
|
1105
|
+
adminListAccounts(): Promise<Account[]>;
|
|
748
1106
|
adminListKeys(): Promise<AdminAPIKey[]>;
|
|
749
1107
|
adminRevokeKey(keyId: number): Promise<void>;
|
|
750
1108
|
/** Clears the request key on an API key whose holder lost it, after a
|
|
@@ -763,6 +1121,8 @@ declare class VerdifaxClient {
|
|
|
763
1121
|
response: string;
|
|
764
1122
|
govern?: boolean;
|
|
765
1123
|
job?: JobLink;
|
|
1124
|
+
policy_context?: PolicyContext;
|
|
1125
|
+
expected_policy_hash?: Hex64;
|
|
766
1126
|
}): Promise<ExecuteResponse>;
|
|
767
1127
|
/** Convenience for attesting an OpenAI API response. `govern` works as
|
|
768
1128
|
* in {@link attestClaudeResponse}. */
|
|
@@ -774,6 +1134,8 @@ declare class VerdifaxClient {
|
|
|
774
1134
|
response: string;
|
|
775
1135
|
govern?: boolean;
|
|
776
1136
|
job?: JobLink;
|
|
1137
|
+
policy_context?: PolicyContext;
|
|
1138
|
+
expected_policy_hash?: Hex64;
|
|
777
1139
|
}): Promise<ExecuteResponse>;
|
|
778
1140
|
private attestProviderResponse;
|
|
779
1141
|
private request;
|
|
@@ -838,6 +1200,9 @@ declare function captureEnvironment(options?: CaptureEnvironmentOptions): Reprod
|
|
|
838
1200
|
* Text with an unpaired surrogate has no UTF-8 form and is refused.
|
|
839
1201
|
*/
|
|
840
1202
|
declare function formatProviderPayload(provider: string, prompt: string, response: string): string;
|
|
1203
|
+
/** Every top-level key a run request may hold. Any other key is refused
|
|
1204
|
+
* before sending, so a misspelt field cannot be silently dropped. */
|
|
1205
|
+
declare const EXECUTE_FIELDS: readonly string[];
|
|
841
1206
|
|
|
842
1207
|
/**
|
|
843
1208
|
* The three canonical hash formulas from the Verdifax orchestrator, so a
|
|
@@ -961,6 +1326,29 @@ declare function requestKeyChangeApproval(currentSigningKey: Uint8Array | KeyObj
|
|
|
961
1326
|
signedAt?: string;
|
|
962
1327
|
nonce?: string;
|
|
963
1328
|
}): RequestKeyChange;
|
|
1329
|
+
/** The bytes the request key signs to make a stored policy document the
|
|
1330
|
+
* one in force, matching the orchestrator's PolicyActivationPreimage.
|
|
1331
|
+
* `chain_id` and `previous_activation_hash` come from GET /policies, so a
|
|
1332
|
+
* signature cannot be used on another key's chain, another document or
|
|
1333
|
+
* another point in the chain. */
|
|
1334
|
+
declare function policyActivationPreimage(fields: {
|
|
1335
|
+
chain_id: string;
|
|
1336
|
+
document_hash: string;
|
|
1337
|
+
previous_activation_hash: string;
|
|
1338
|
+
signed_at: string;
|
|
1339
|
+
nonce: string;
|
|
1340
|
+
}): Buffer;
|
|
1341
|
+
/** The request key's approval of a policy change, the `signature` value of
|
|
1342
|
+
* POST /policies/{document_hash}/activate. `signedAt` and `nonce` default
|
|
1343
|
+
* to the current time and fresh random bytes. */
|
|
1344
|
+
declare function policyActivationApproval(signingKey: Uint8Array | KeyObject, fields: {
|
|
1345
|
+
chain_id: string;
|
|
1346
|
+
document_hash: string;
|
|
1347
|
+
previous_activation_hash: string;
|
|
1348
|
+
}, options?: {
|
|
1349
|
+
signedAt?: string;
|
|
1350
|
+
nonce?: string;
|
|
1351
|
+
}): PolicyActivationSignature;
|
|
964
1352
|
|
|
965
1353
|
/**
|
|
966
1354
|
* Input-validation helpers, mirrors the Python SDK's
|
|
@@ -1046,4 +1434,4 @@ declare class APIKeyRequiredError extends VerdifaxError {
|
|
|
1046
1434
|
constructor();
|
|
1047
1435
|
}
|
|
1048
1436
|
|
|
1049
|
-
export { APIError, APIKeyRequiredError, type AdminAPIKey, type AdminCreateKeyResponse, type AdminEraseRequest, type AttestRequest, type AttestationList, AuthError, CRES_ENGINE_VERSION, CRES_PREIMAGE_VERSION, type ClientConfig, type DCAEProofBundle, type DCAEVerdict, DCAE_PREIMAGE_VERSION, DSE_FORMULA_VERSION, type DeletionReceipt, type DeterminismDiff, type DeterminismRun, type ExecuteBatchResponse, type ExecuteBatchResult, type ExecuteRequest, type ExecuteResponse, type ExecutionManifest, type ExportRow, type ExportRunsParams, type FormulaEra, type Health, type Hex64, type JobLink, type JobStepOptions, type ListAttestationsParams, type ListRunsParams, MAX_BATCH_ROWS, NotFoundError, type PDFFormat, RUN_STATUSES, type ReproducibilityContext, type RequestKeyChange, type RequestKeyPair, type RequestKeyRegistration, type RequestKeyRegistrationBody, type RequestSignature, type RequestSignatureV2, type Run, type RunStats, type RunStatus, type RunSummary, type RunsExport, type RunsExportCSV, type SearchRunsParams, type SignedRequestBody, VerdifaxClient, VerdifaxError, VerdifaxJob, type VerdifaxVersion, type VerifyDeterminismResponse, type VerifyResponse, captureEnvironment, cresReceiptHash, dcaeClosureHash, dseDispatchHash, formatProviderPayload, fromEnv, generateRequestKeyPair, requestKeyChangeApproval, requestKeyChangePreimage, requestKeyRegistrationBody, requestSignaturePreimage, requestSignaturePreimageV2, signRequest, signRequestV2, validateHex64, validateJobName, validateRouteId };
|
|
1437
|
+
export { APIError, APIKeyRequiredError, type Account, type AccountInfo, type AccountKey, type AccountKeyList, type AccountKeyRevocation, type AccountRunsExport, type AdminAPIKey, type AdminCreateAccountOptions, type AdminCreateAccountResponse, type AdminCreateKeyOptions, type AdminCreateKeyResponse, type AdminEraseRequest, type AttestRequest, type AttestationList, AuthError, CRES_ENGINE_VERSION, CRES_PREIMAGE_VERSION, type ClientConfig, type CreateAccountKeyOptions, type CreatedAccountKey, type DCAEProofBundle, type DCAEVerdict, DCAE_PREIMAGE_VERSION, DSE_FORMULA_VERSION, type DeletionReceipt, type DeterminismDiff, type DeterminismRun, EXECUTE_FIELDS, type ExecuteBatchResponse, type ExecuteBatchResult, type ExecuteRequest, type ExecuteResponse, type ExecutionManifest, type ExportRow, type ExportRunsParams, type FormulaEra, type Health, type Hex64, type JobLink, type JobStepOptions, type KeyTier, type ListAttestationsParams, type ListRunsParams, MAX_BATCH_ROWS, NotFoundError, type PDFFormat, type Policy, type PolicyActivation, type PolicyActivationSignature, type PolicyActorType, type PolicyClassification, type PolicyContext, type PolicyList, type PolicyObjectType, type PolicyTestRequest, type PolicyTestResult, type PolicyWithDocument, RUN_STATUSES, type ReproducibilityContext, type RequestKeyChange, type RequestKeyPair, type RequestKeyRegistration, type RequestKeyRegistrationBody, type RequestSignature, type RequestSignatureV2, type Run, type RunStats, type RunStatus, type RunSummary, type RunsExport, type RunsExportCSV, type SearchRunsParams, type SignedRequestBody, VerdifaxClient, VerdifaxError, VerdifaxJob, type VerdifaxVersion, type VerifyDeterminismResponse, type VerifyResponse, captureEnvironment, cresReceiptHash, dcaeClosureHash, dseDispatchHash, formatProviderPayload, fromEnv, generateRequestKeyPair, policyActivationApproval, policyActivationPreimage, requestKeyChangeApproval, requestKeyChangePreimage, requestKeyRegistrationBody, requestSignaturePreimage, requestSignaturePreimageV2, signRequest, signRequestV2, validateHex64, validateJobName, validateRouteId };
|