verdifax 1.2.0 → 1.4.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/dist/index.d.ts CHANGED
@@ -318,8 +318,13 @@ interface DeterminismRun {
318
318
  manifest_hash: string;
319
319
  bundle_hash: string;
320
320
  duration_ms: number;
321
+ /** `ok`, `stage_error`, or the refusal or halt kind, such as
322
+ * `pepg_deny`. */
321
323
  status: string;
322
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>;
323
328
  }
324
329
  /** How the two runs of a determinism check compared. */
325
330
  interface DeterminismDiff {
@@ -327,9 +332,12 @@ interface DeterminismDiff {
327
332
  manifest_hash_differs: boolean;
328
333
  bundle_hash_differs: boolean;
329
334
  differing_fields?: string[];
335
+ /** Why there is no verdict, when neither run sealed a record. */
336
+ reason?: string;
330
337
  }
331
338
  /** Body returned by POST /execute/verify-determinism. `deterministic`
332
- * means both runs ended ok with equal manifest hashes. */
339
+ * means both runs ended the same way, completed or refused, with equal
340
+ * manifest hashes. */
333
341
  interface VerifyDeterminismResponse {
334
342
  ok: boolean;
335
343
  deterministic: boolean;
@@ -476,6 +484,8 @@ interface ListRunsParams {
476
484
  * for the full sealed manifest. */
477
485
  interface RunSummary {
478
486
  id: number;
487
+ /** The key that requested the run. */
488
+ api_key_id?: number;
479
489
  created_at: string;
480
490
  program_id: Hex64;
481
491
  route_id: string;
@@ -512,6 +522,9 @@ interface ExportRunsParams {
512
522
  /** One run in an evidence export: what the server stored, not a verdict. */
513
523
  interface ExportRow {
514
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;
515
528
  created_at: string;
516
529
  status: RunStatus;
517
530
  error_stage: string;
@@ -541,6 +554,26 @@ interface RunsExport {
541
554
  /** Rows returned, counted by status. */
542
555
  by_status: Record<string, number>;
543
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;
572
+ /** The account's whole chain of sign-offs, oldest first, as
573
+ * {@link VerdifaxClient.getSignOffHistory} returns it. Only the owner
574
+ * key's export carries it, and the SDK returns it as the server sent
575
+ * it, without checking it: check it with `verdifax-verify`. */
576
+ signoffs?: SignOffRecord[];
544
577
  }
545
578
  /** Returned by {@link VerdifaxClient.exportRunsCSV}. */
546
579
  interface RunsExportCSV {
@@ -629,6 +662,93 @@ interface AdminCreateKeyResponse {
629
662
  name: string;
630
663
  secret: string;
631
664
  hint: string;
665
+ /** The key's account, as `account-N`. */
666
+ account_id?: string;
667
+ }
668
+ /** Options for {@link VerdifaxClient.adminCreateKey}. */
669
+ interface AdminCreateKeyOptions {
670
+ /** Puts the customer key in this existing account, by its number. Without
671
+ * it the key gets an account of its own. A key never changes account. */
672
+ accountId?: number;
673
+ }
674
+ /** A key's tier. */
675
+ type KeyTier = "trial" | "production";
676
+ /** An account, a company on Verdifax, as GET /admin/accounts lists it. The
677
+ * account number is a label Verdifax assigned, not a verified company
678
+ * identity. */
679
+ interface Account {
680
+ /** `account-N`, as records seal it. */
681
+ account_id: string;
682
+ id: number;
683
+ name: string;
684
+ tier: string;
685
+ created_at: string;
686
+ /** Member keys not revoked. */
687
+ member_keys: number;
688
+ /** Owner keys not revoked. */
689
+ owner_keys: number;
690
+ /** The chain of the account's policy changes, `account-N`. */
691
+ chain_id: string;
692
+ identity?: string;
693
+ policy_scope?: string;
694
+ }
695
+ /** Returned by {@link VerdifaxClient.getAccount}. */
696
+ interface AccountInfo extends Account {
697
+ ok: boolean;
698
+ }
699
+ /** One of an account's keys, without its secret. */
700
+ interface AccountKey {
701
+ id: number;
702
+ name: string;
703
+ account_id: string;
704
+ /** True for an owner key, which manages the account and cannot run
705
+ * anything. */
706
+ owner: boolean;
707
+ tier: string;
708
+ created_at: string;
709
+ last_used_at: string;
710
+ run_count: number;
711
+ revoked: boolean;
712
+ expires_at?: string;
713
+ }
714
+ /** Returned by {@link VerdifaxClient.listAccountKeys}. */
715
+ interface AccountKeyList {
716
+ ok: boolean;
717
+ account_id: string;
718
+ keys: AccountKey[];
719
+ }
720
+ /** A new key with its secret, which is shown this once. */
721
+ interface CreatedAccountKey extends AccountKey {
722
+ ok: boolean;
723
+ secret: string;
724
+ /** True when the key needs a request key before it can run. */
725
+ request_key_required: boolean;
726
+ hint: string;
727
+ }
728
+ /** Returned by {@link VerdifaxClient.revokeAccountKey}. */
729
+ interface AccountKeyRevocation {
730
+ ok: boolean;
731
+ id: number;
732
+ revoked: boolean;
733
+ }
734
+ /** Options for {@link VerdifaxClient.createAccountKey}. */
735
+ interface CreateAccountKeyOptions {
736
+ /** RFC 3339 or YYYY-MM-DD. */
737
+ expiresAt?: string;
738
+ }
739
+ /** Options for {@link VerdifaxClient.adminCreateAccount}. */
740
+ interface AdminCreateAccountOptions {
741
+ /** `trial` when left out. */
742
+ tier?: KeyTier;
743
+ /** When the owner key expires: RFC 3339 or YYYY-MM-DD. */
744
+ expiresAt?: string;
745
+ }
746
+ /** Returned by {@link VerdifaxClient.adminCreateAccount}: the account and
747
+ * its first owner key, with the secret. */
748
+ interface AdminCreateAccountResponse {
749
+ ok: boolean;
750
+ account: Account;
751
+ owner_key: CreatedAccountKey;
632
752
  }
633
753
  /** Projection returned by {@link VerdifaxClient.adminListKeys}.
634
754
  * Secrets are NEVER surfaced, only metadata. */
@@ -640,6 +760,127 @@ interface AdminAPIKey {
640
760
  run_count: number;
641
761
  revoked: boolean;
642
762
  }
763
+ /** The kind of result a sign-off names: a completed run's record, a
764
+ * refused or halted run's receipt, or a whole job by its final step. */
765
+ type SignOffTargetKind = "record" | "receipt" | "job";
766
+ /** An approver's decision on one result. */
767
+ type SignOffDecision = "approve" | "reject";
768
+ /** The exact result a sign-off names, by what its public-log entry
769
+ * covers. */
770
+ interface SignOffTarget {
771
+ kind: SignOffTargetKind;
772
+ /** The run: for a job, the run of its final step. */
773
+ run_id: number;
774
+ /** What the result's public-log entry covers. For a record, its
775
+ * `bundle_anchor.anchored_digest` in the bundle
776
+ * {@link VerdifaxClient.getRunArtifacts} returns. For a receipt, its
777
+ * hash. For a job, the final step's record digest, read the same way
778
+ * as a record's. 64 lowercase hex characters. */
779
+ digest: Hex64;
780
+ /** The job, for a job target only. */
781
+ job_id?: string;
782
+ }
783
+ /** One sign-off, verdifax.signoff.v1, as the server records it and
784
+ * `verdifax-verify --signoff` and `--signoff-history` read it. */
785
+ interface SignOffRecord {
786
+ format: string;
787
+ /** The account's chain, `account-N`. */
788
+ chain_id: string;
789
+ sequence: number;
790
+ /** The sign-off this one follows, or 64 zeros for the account's first. */
791
+ previous_signoff_hash: Hex64;
792
+ target: SignOffTarget;
793
+ decision: SignOffDecision;
794
+ /** SHA-256 of the approver's note, when there was one. The note's text
795
+ * never reaches Verdifax. */
796
+ note_hash?: string;
797
+ /** The base64 Ed25519 public key of the approver who signed. */
798
+ approver_key: string;
799
+ /** Base64 Ed25519 signature by the approver key. */
800
+ signature: string;
801
+ signed_at: string;
802
+ nonce: string;
803
+ recorded_at: string;
804
+ signoff_hash: Hex64;
805
+ /** Where the sign-off was logged on the public log. */
806
+ anchor?: Record<string, unknown>;
807
+ }
808
+ /** What an approver signs against: the account's chain and its newest
809
+ * sign-off. Returned by {@link VerdifaxClient.getNewestSignOff}. */
810
+ interface NewestSignOff {
811
+ ok: boolean;
812
+ /** The account's chain, `account-N`. */
813
+ chain_id: string;
814
+ /** The newest sign-off's hash, or 64 zeros when there is none yet. */
815
+ newest_signoff_hash: Hex64;
816
+ /** The newest sign-off's place in the chain, 0 when there is none. */
817
+ sequence: number;
818
+ }
819
+ /** The approver key's part of a sign-off. */
820
+ interface SignOffSignature {
821
+ /** The base64 Ed25519 public key of the approver. */
822
+ approver_key: string;
823
+ /** Base64 Ed25519 signature by the approver key. */
824
+ signature: string;
825
+ /** RFC 3339 UTC with whole seconds. */
826
+ signed_at: string;
827
+ /** 16 random bytes as 32 lowercase hex characters, fresh per sign-off. */
828
+ nonce: string;
829
+ }
830
+ /** Options for {@link VerdifaxClient.signOff}. */
831
+ interface SignOffOptions {
832
+ /** The approver's note. It is hashed on this machine and only its
833
+ * SHA-256 is sent and signed: the text never reaches Verdifax. Keep the
834
+ * text yourself to show it matches the hash. */
835
+ note?: string;
836
+ /** Use the owner key's routes, /account/signoffs/newest and
837
+ * /account/signoffs, instead of a member key's. */
838
+ asOwner?: boolean;
839
+ }
840
+ /** For a method that serves both a member key's route and the owner
841
+ * key's /account route. */
842
+ interface AsOwnerOptions {
843
+ /** Use the owner key's /account route. */
844
+ asOwner?: boolean;
845
+ }
846
+ /** An approver key's public key and the proof that its holder has the
847
+ * private key, from {@link approverKeyProof}. */
848
+ interface ApproverKeyProof {
849
+ /** Base64 of the raw 32-byte public key. */
850
+ public_key: string;
851
+ /** Base64 Ed25519 signature over verdifax.approver-key.v1, a zero byte
852
+ * and the base64 public key. */
853
+ proof: string;
854
+ }
855
+ /** An approver key registered to an account. A key is not an identity:
856
+ * `name` is the label the owner gave it. */
857
+ interface Approver {
858
+ id: number;
859
+ public_key: string;
860
+ name: string;
861
+ /** The account, `account-N`. */
862
+ account_id: string;
863
+ registered_at: string;
864
+ revoked: boolean;
865
+ revoked_at?: string;
866
+ }
867
+ /** Returned by {@link VerdifaxClient.registerApprover}. */
868
+ interface ApproverRegistration extends Approver {
869
+ ok: boolean;
870
+ }
871
+ /** Returned by {@link VerdifaxClient.listApprovers}: revoked keys
872
+ * included. */
873
+ interface ApproverList {
874
+ ok: boolean;
875
+ account_id: string;
876
+ approvers: Approver[];
877
+ }
878
+ /** Returned by {@link VerdifaxClient.revokeApprover}. */
879
+ interface ApproverRevocation {
880
+ ok: boolean;
881
+ id: number;
882
+ revoked: boolean;
883
+ }
643
884
 
644
885
  /**
645
886
  * The job helper: runs the steps of one job and keeps the map of step ids
@@ -722,10 +963,12 @@ declare const MAX_BATCH_ROWS = 1000;
722
963
  * | `listDeletionReceipts(id)` | GET /runs/{id}/deletion-receipts | required |
723
964
  * | `adminErase(req)` | POST /admin/erase | required |
724
965
  * | `dcaeVerify(bundle)` | POST /dcae/verify | none |
725
- * | `adminCreateKey(name)` | POST /admin/keys | required |
966
+ * | `adminCreateKey(name, options)` | POST /admin/keys | required |
726
967
  * | `adminListKeys()` | GET /admin/keys | required |
727
968
  * | `adminRevokeKey(id)` | DELETE /admin/keys/{id} | required |
728
969
  * | `adminClearRequestKey(id)` | DELETE /admin/keys/{id}/request-key | required |
970
+ * | `adminCreateAccount(name, options)` | POST /admin/accounts | required |
971
+ * | `adminListAccounts()` | GET /admin/accounts | required |
729
972
  * | `attestClaudeResponse(...)` | POST /execute (helper) | required |
730
973
  * | `attestOpenAIResponse(...)` | POST /execute (helper) | required |
731
974
  * | `registerRequestKey()` | POST /keys/request-key | required |
@@ -737,6 +980,28 @@ declare const MAX_BATCH_ROWS = 1000;
737
980
  * | `testPolicy(req)` | POST /policies/test | required |
738
981
  * | `getPolicyHistory()` | GET /policies/history | required |
739
982
  * | `activatePolicy(documentHash)` | POST /policies/{document_hash}/activate | required |
983
+ * | `getAccount()` | GET /account | owner key |
984
+ * | `createAccountKey(name, options)` | POST /account/keys | owner key |
985
+ * | `listAccountKeys()` | GET /account/keys | owner key |
986
+ * | `revokeAccountKey(id)` | DELETE /account/keys/{id} | owner key |
987
+ * | `registerAccountRequestKey()` | POST /account/request-key | owner key |
988
+ * | `clearAccountRequestKey()` | DELETE /account/request-key | owner key |
989
+ * | `listAccountRuns(params)` | GET /account/runs | owner key |
990
+ * | `exportAccountRuns(params)` | GET /account/runs/export | owner key |
991
+ * | `exportAccountRunsCSV(params)` | GET /account/runs/export?format=csv | owner key |
992
+ * | `uploadAccountPolicy(document)` | POST /account/policies | owner key |
993
+ * | `listAccountPolicies()` | GET /account/policies | owner key |
994
+ * | `getAccountPolicy(documentHash)` | GET /account/policies/{document_hash} | owner key |
995
+ * | `testAccountPolicy(req)` | POST /account/policies/test | owner key |
996
+ * | `getAccountPolicyHistory()` | GET /account/policies/history | owner key |
997
+ * | `activateAccountPolicy(documentHash)` | POST /account/policies/{document_hash}/activate | owner key |
998
+ * | `registerApprover(name, approver)` | POST /account/approvers | owner key |
999
+ * | `listApprovers()` | GET /account/approvers | owner key |
1000
+ * | `revokeApprover(id)` | DELETE /account/approvers/{id} | owner key |
1001
+ * | `signOff(target, decision, approverKey, options)` | POST /signoffs, or POST /account/signoffs with asOwner | required |
1002
+ * | `getNewestSignOff(options)` | GET /signoffs/newest, or GET /account/signoffs/newest with asOwner | required |
1003
+ * | `getSignOffs(runId, options)` | GET /runs/{id}/signoffs, or GET /account/runs/{id}/signoffs with asOwner | required |
1004
+ * | `getSignOffHistory()` | GET /account/signoffs/history | owner key |
740
1005
  * | `job(jobId)` | none, returns a {@link VerdifaxJob} | none |
741
1006
  *
742
1007
  * With the `signingKey` option set, every path to POST /execute carries
@@ -795,6 +1060,7 @@ declare class VerdifaxClient {
795
1060
  * that the client holds the private key. From then on the server
796
1061
  * refuses a run on this API key without a request signature. */
797
1062
  registerRequestKey(): Promise<RequestKeyRegistration>;
1063
+ private registerRequestKeyAt;
798
1064
  /** Replaces the registered key with `newSigningKey`. The new key proves
799
1065
  * itself and this client's current key approves the change. After
800
1066
  * success this client signs with the new key. If the call fails it
@@ -808,6 +1074,7 @@ declare class VerdifaxClient {
808
1074
  * unsigned requests, because the server refuses a signed run on an API
809
1075
  * key with no registered key. If the call fails it keeps the key. */
810
1076
  clearRequestKey(): Promise<void>;
1077
+ private clearRequestKeyAt;
811
1078
  /** Stores a policy document. Nothing changes until it is activated with
812
1079
  * {@link activatePolicy}. The server hashes the exact text, so this
813
1080
  * sends the string it is given unchanged and refuses anything that is
@@ -843,12 +1110,123 @@ declare class VerdifaxClient {
843
1110
  * {@link APIError} and is not retried: read the policies again and
844
1111
  * decide. */
845
1112
  activatePolicy(documentHash: Hex64): Promise<PolicyActivation>;
1113
+ private uploadPolicyAt;
1114
+ private getPolicyAt;
1115
+ private testPolicyAt;
1116
+ /** Posts the change that follows the newest one in `chain`, signed by
1117
+ * the request key when the client has one. */
1118
+ private activatePolicyAt;
1119
+ /** The owner's account: its number, name, tier, key counts and the
1120
+ * chain of its policy changes. */
1121
+ getAccount(): Promise<AccountInfo>;
1122
+ /** Creates a member key in the account. It takes the account's tier and
1123
+ * stays in the account for life. The secret is in the result this once.
1124
+ * On a trial account the key needs a request key before it can run. */
1125
+ createAccountKey(name: string, options?: CreateAccountKeyOptions): Promise<CreatedAccountKey>;
1126
+ /** Every key in the account, owner keys included, without secrets. */
1127
+ listAccountKeys(): Promise<AccountKeyList>;
1128
+ /** Revokes one of the account's member keys. A key in another account,
1129
+ * or an owner key, throws {@link NotFoundError}. */
1130
+ revokeAccountKey(keyId: number): Promise<AccountKeyRevocation>;
1131
+ /** Registers this client's public key as the owner key's request key,
1132
+ * which must sign every change to the account's policy. It works as
1133
+ * {@link registerRequestKey} does. */
1134
+ registerAccountRequestKey(): Promise<RequestKeyRegistration>;
1135
+ /** Clears the owner key's request key, as {@link clearRequestKey} does
1136
+ * for a key's own. With none registered the account's policy cannot be
1137
+ * changed. A trial owner key's request key cannot be cleared. */
1138
+ clearAccountRequestKey(): Promise<void>;
1139
+ /** The runs of every key in the account, paged as {@link listRuns}. */
1140
+ listAccountRuns(params?: ListRunsParams): Promise<{
1141
+ runs: RunSummary[];
1142
+ total: number;
1143
+ }>;
1144
+ /** The runs of every key in the account in a period, as
1145
+ * {@link exportRuns} lists a key's, with the account's number, its
1146
+ * policy documents and its chain of changes. The account's view covers
1147
+ * the runs its keys made through Verdifax, not runs made elsewhere. */
1148
+ exportAccountRuns(params?: ExportRunsParams): Promise<AccountRunsExport>;
1149
+ /** The same rows as {@link exportAccountRuns} as raw CSV text, checked
1150
+ * as {@link exportRunsCSV} checks a key's. */
1151
+ exportAccountRunsCSV(params?: ExportRunsParams): Promise<RunsExportCSV>;
1152
+ /** Stores an account policy document, as {@link uploadPolicy} stores a
1153
+ * key's. Every key in the account must pass the account's policy on top
1154
+ * of its own. Verdifax does not write, review or approve it. */
1155
+ uploadAccountPolicy(document: string): Promise<Policy>;
1156
+ /** The account's stored documents, its chain `account-N`, the newest
1157
+ * change in it and the document in force. */
1158
+ listAccountPolicies(): Promise<PolicyList>;
1159
+ /** One of the account's documents, with its exact text. */
1160
+ getAccountPolicy(documentHash: Hex64): Promise<PolicyWithDocument>;
1161
+ /** {@link testPolicy} for the account's documents. It seals nothing. */
1162
+ testAccountPolicy(req: PolicyTestRequest): Promise<PolicyTestResult>;
1163
+ /** The account's policy changes, oldest first, in the form
1164
+ * `verdifax-verify --policy-history FILE` reads. */
1165
+ getAccountPolicyHistory(): Promise<PolicyActivation[]>;
1166
+ /** Makes a stored document the account's policy in force, as
1167
+ * {@link activatePolicy} does for a key's. It reads
1168
+ * {@link listAccountPolicies} for the chain and its newest change, and
1169
+ * the owner key's request key signs the change over that chain,
1170
+ * `account-N`. The server refuses an unsigned account change, so this
1171
+ * needs the `signingKey` option and refuses to send without it. */
1172
+ activateAccountPolicy(documentHash: Hex64): Promise<PolicyActivation>;
1173
+ /** Registers an approver key to the owner's account. `approver` is the
1174
+ * approver's signing key, from which the proof is made on this machine,
1175
+ * or the `{ public_key, proof }` that {@link approverKeyProof} made on
1176
+ * the approver's own machine, so the owner need not hold the private
1177
+ * key. A proof that does not verify is refused before sending. The
1178
+ * server refuses a key that is a request key in the same account.
1179
+ * `name` is a label, not an identity. */
1180
+ registerApprover(name: string, approver: Uint8Array | KeyObject | ApproverKeyProof): Promise<ApproverRegistration>;
1181
+ /** The account's approver keys, revoked ones included. */
1182
+ listApprovers(): Promise<ApproverList>;
1183
+ /** Revokes one of the account's approver keys. Its earlier sign-offs
1184
+ * stay on the record. A key that is not an active approver in the
1185
+ * account throws {@link NotFoundError}. */
1186
+ revokeApprover(approverId: number): Promise<ApproverRevocation>;
1187
+ /** What an approver signs against: the account's chain `account-N` and
1188
+ * its newest sign-off (64 zeros when there is none yet). With
1189
+ * `asOwner` it reads the owner key's route. */
1190
+ getNewestSignOff(options?: AsOwnerOptions): Promise<NewestSignOff>;
1191
+ /** Signs an approver's decision, approve or reject, on one exact result
1192
+ * and submits it. It first reads {@link getNewestSignOff} for the
1193
+ * account's chain and its newest sign-off, then signs over them with
1194
+ * `approverKey` on this machine. The approver's private key is never
1195
+ * sent.
1196
+ *
1197
+ * `target.digest` is what the result's public-log entry covers: for a
1198
+ * record, the `bundle_anchor.anchored_digest` of the bundle
1199
+ * {@link getRunArtifacts} returns; for a receipt, its hash; for a job,
1200
+ * the final step's record digest, read as a record's, with `job_id`.
1201
+ *
1202
+ * `note` is hashed here and only its SHA-256 is sent and signed: the
1203
+ * text never reaches Verdifax. With `asOwner` it uses the owner key's
1204
+ * routes. Bad input is refused before anything is sent.
1205
+ *
1206
+ * The record the server returns must carry the signature,
1207
+ * approver_key, decision, previous_signoff_hash and target that were
1208
+ * sent, or this throws {@link VerdifaxError}.
1209
+ *
1210
+ * A later sign-off on the same result supersedes this one, and neither
1211
+ * is deleted. An HTTP 409 means the chain moved or the target is not
1212
+ * this account's result: it throws the usual {@link APIError} and is
1213
+ * not retried. */
1214
+ signOff(target: SignOffTarget, decision: SignOffDecision, approverKey: Uint8Array | KeyObject, options?: SignOffOptions): Promise<SignOffRecord>;
1215
+ /** The sign-offs on one run, oldest first, in the form
1216
+ * `verdifax-verify --signoff FILE` reads: for a member key, a run it
1217
+ * made; with `asOwner`, any run of the account. The latest is the
1218
+ * decision in force. */
1219
+ getSignOffs(runId: number, options?: AsOwnerOptions): Promise<SignOffRecord[]>;
1220
+ /** The account's whole chain of sign-offs, oldest first, in the form
1221
+ * `verdifax-verify --signoff-history FILE` reads. Needs the owner key. */
1222
+ getSignOffHistory(): Promise<SignOffRecord[]>;
846
1223
  getRun(runId: number): Promise<Run>;
847
1224
  verifyRun(runId: number): Promise<VerifyResponse>;
848
1225
  listRuns(params?: ListRunsParams): Promise<{
849
1226
  runs: RunSummary[];
850
1227
  total: number;
851
1228
  }>;
1229
+ private listRunsAt;
852
1230
  /** Searches this key's runs. `manifest_hash` matches a prefix. The
853
1231
  * server ignores a `from` or `to` it cannot parse here, unlike
854
1232
  * {@link exportRuns}, which refuses one. */
@@ -867,6 +1245,7 @@ declare class VerdifaxClient {
867
1245
  * does not send those headers, so that a cut-off export cannot pass
868
1246
  * for a complete one. */
869
1247
  exportRunsCSV(params?: ExportRunsParams): Promise<RunsExportCSV>;
1248
+ private exportCSVAt;
870
1249
  private exportPath;
871
1250
  listAttestations(params?: ListAttestationsParams): Promise<AttestationList>;
872
1251
  getAttestation(attestationId: number): Promise<Record<string, unknown>>;
@@ -897,7 +1276,16 @@ declare class VerdifaxClient {
897
1276
  listDeletionReceipts(runId: number): Promise<DeletionReceipt[]>;
898
1277
  adminErase(req: AdminEraseRequest): Promise<DeletionReceipt>;
899
1278
  dcaeVerify(bundle: DCAEProofBundle): Promise<DCAEVerdict>;
900
- adminCreateKey(name: string): Promise<AdminCreateKeyResponse>;
1279
+ /** Creates a customer key. With `accountId` the key joins that existing
1280
+ * account; without it the key gets an account of its own. A key never
1281
+ * changes account. */
1282
+ adminCreateKey(name: string, options?: AdminCreateKeyOptions): Promise<AdminCreateKeyResponse>;
1283
+ /** Creates an account and its first owner key, whose secret is in the
1284
+ * result this once. The owner key creates the member keys. The account
1285
+ * number is a label Verdifax assigned, not a verified company identity. */
1286
+ adminCreateAccount(name: string, options?: AdminCreateAccountOptions): Promise<AdminCreateAccountResponse>;
1287
+ /** Every account, with its key counts. */
1288
+ adminListAccounts(): Promise<Account[]>;
901
1289
  adminListKeys(): Promise<AdminAPIKey[]>;
902
1290
  adminRevokeKey(keyId: number): Promise<void>;
903
1291
  /** Clears the request key on an API key whose holder lost it, after a
@@ -1144,6 +1532,29 @@ declare function policyActivationApproval(signingKey: Uint8Array | KeyObject, fi
1144
1532
  signedAt?: string;
1145
1533
  nonce?: string;
1146
1534
  }): PolicyActivationSignature;
1535
+ /** The bytes an approver key signs for one sign-off, matching the
1536
+ * orchestrator's SignOffPreimage: the fields joined with single zero
1537
+ * bytes. `chain_id` and `previous_signoff_hash` come from GET
1538
+ * /signoffs/newest (or /account/signoffs/newest for the owner key), so a
1539
+ * signature cannot be moved to another account, another result or
1540
+ * another point in the chain. `target.job_id` is empty unless the target
1541
+ * is a job, and `note_hash` is empty when there is no note. */
1542
+ declare function signOffPreimage(fields: {
1543
+ chain_id: string;
1544
+ previous_signoff_hash: string;
1545
+ target: SignOffTarget;
1546
+ decision: SignOffDecision;
1547
+ note_hash: string;
1548
+ signed_at: string;
1549
+ nonce: string;
1550
+ }): Buffer;
1551
+ /** The approver key's base64 public key and its proof: its signature over
1552
+ * verdifax.approver-key.v1, a zero byte and the base64 public key, which
1553
+ * shows its holder has the private key. The approver can run this on
1554
+ * their own machine and give the result to the account's owner, who
1555
+ * registers it with {@link VerdifaxClient.registerApprover}, so the owner
1556
+ * never holds the approver's private key. */
1557
+ declare function approverKeyProof(approverKey: Uint8Array | KeyObject): ApproverKeyProof;
1147
1558
 
1148
1559
  /**
1149
1560
  * Input-validation helpers, mirrors the Python SDK's
@@ -1229,4 +1640,4 @@ declare class APIKeyRequiredError extends VerdifaxError {
1229
1640
  constructor();
1230
1641
  }
1231
1642
 
1232
- 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, 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 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 };
1643
+ 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 Approver, type ApproverKeyProof, type ApproverList, type ApproverRegistration, type ApproverRevocation, type AsOwnerOptions, 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, type NewestSignOff, 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 SignOffDecision, type SignOffOptions, type SignOffRecord, type SignOffSignature, type SignOffTarget, type SignOffTargetKind, type SignedRequestBody, VerdifaxClient, VerdifaxError, VerdifaxJob, type VerdifaxVersion, type VerifyDeterminismResponse, type VerifyResponse, approverKeyProof, captureEnvironment, cresReceiptHash, dcaeClosureHash, dseDispatchHash, formatProviderPayload, fromEnv, generateRequestKeyPair, policyActivationApproval, policyActivationPreimage, requestKeyChangeApproval, requestKeyChangePreimage, requestKeyRegistrationBody, requestSignaturePreimage, requestSignaturePreimageV2, signOffPreimage, signRequest, signRequestV2, validateHex64, validateJobName, validateRouteId };