@pacspace-io/sdk 0.9.0 → 0.15.2

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.
Files changed (152) hide show
  1. package/README.md +53 -132
  2. package/dist/blinding-file.d.ts +13 -0
  3. package/dist/blinding-file.d.ts.map +1 -0
  4. package/dist/blinding-guard.d.ts +7 -0
  5. package/dist/blinding-guard.d.ts.map +1 -0
  6. package/dist/blinding.d.ts +32 -0
  7. package/dist/blinding.d.ts.map +1 -0
  8. package/dist/client.d.ts +28 -4
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/fingerprint.d.ts +26 -5
  11. package/dist/fingerprint.d.ts.map +1 -1
  12. package/dist/index.d.ts +35 -35
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +7366 -186
  15. package/dist/index.js.map +7 -1
  16. package/dist/inputs.txt +132 -0
  17. package/dist/records-crypto-libraries.json +42 -0
  18. package/dist/records-crypto-types/proof/hiding-commitment-v1.d.ts +19 -0
  19. package/dist/records-crypto-types/proof/jcs.d.ts +4 -0
  20. package/dist/records-crypto-types/proof/layout-document-v1.d.ts +72 -0
  21. package/dist/records-crypto-types/proof/ledger-head-v1.d.ts +22 -0
  22. package/dist/records-crypto-types/proof/merkle-v2.d.ts +5 -0
  23. package/dist/records-crypto-types/proof/payload-ref-v1.d.ts +17 -0
  24. package/dist/records-crypto-types/proof/seal-input.d.ts +2 -0
  25. package/dist/records-crypto-types/proof/semantic-receipt-v2.d.ts +89 -0
  26. package/dist/records-crypto-types/proof/semantic-receipt-v3.d.ts +20 -0
  27. package/dist/records-crypto-types/proof/slot-encoding-v1.d.ts +169 -0
  28. package/dist/records-crypto-types/records/flag-threads-v1.d.ts +53 -0
  29. package/dist/records-crypto-types/records/labels.d.ts +37 -0
  30. package/dist/records-crypto-types/records/reader-crypto-v1.d.ts +198 -0
  31. package/dist/records-crypto-types/records/reader-link-v1.d.ts +164 -0
  32. package/dist/records-crypto-types/records/shared-record-ack-v2.d.ts +72 -0
  33. package/dist/records-crypto-types/records/signed-acknowledgment-v1.d.ts +38 -0
  34. package/dist/records-crypto-types/records/signed-acknowledgment-v2.d.ts +12 -0
  35. package/dist/records-crypto-types/records/trail-index-v1.d.ts +89 -0
  36. package/dist/records-crypto-types/records/trail-rule.d.ts +54 -0
  37. package/dist/records-crypto-types/records-crypto/asymmetric/ack-flag-notes-v1.d.ts +57 -0
  38. package/dist/records-crypto-types/records-crypto/asymmetric/flag-notes-v1.d.ts +55 -0
  39. package/dist/records-crypto-types/records-crypto/asymmetric/index.d.ts +4 -0
  40. package/dist/records-crypto-types/records-crypto/asymmetric/reader-wraps-v1.d.ts +83 -0
  41. package/dist/records-crypto-types/records-crypto/asymmetric/records-asymmetric-v1.d.ts +201 -0
  42. package/dist/records-crypto-types/records-crypto/base64url.d.ts +3 -0
  43. package/dist/records-crypto-types/records-crypto/blinding-file.d.ts +16 -0
  44. package/dist/records-crypto-types/records-crypto/blinding-value.d.ts +10 -0
  45. package/dist/records-crypto-types/records-crypto/bundle-entry.d.ts +2 -0
  46. package/dist/records-crypto-types/records-crypto/disclosure-envelope-v1.d.ts +42 -0
  47. package/dist/records-crypto-types/records-crypto/held-file.d.ts +17 -0
  48. package/dist/records-crypto-types/records-crypto/hmac-node.d.ts +8 -0
  49. package/dist/records-crypto-types/records-crypto/hmac-web.d.ts +8 -0
  50. package/dist/records-crypto-types/records-crypto/index.d.ts +13 -0
  51. package/dist/records-crypto-types/records-crypto/platform-crypto.d.ts +9 -0
  52. package/dist/records-crypto-types/records-crypto/record-disclosure-v1.d.ts +171 -0
  53. package/dist/records-crypto-types/records-crypto/record-hash-v2.d.ts +49 -0
  54. package/dist/records-crypto-types/records-crypto/record-hash-v3.d.ts +36 -0
  55. package/dist/records-crypto-types/records-crypto/records-encryption-v1.d.ts +185 -0
  56. package/dist/records-crypto-types/records-crypto/wrap-shapes-v1.d.ts +23 -0
  57. package/dist/records-crypto.d.ts +1 -0
  58. package/dist/records-crypto.js +16105 -0
  59. package/dist/records-crypto.js.map +7 -0
  60. package/dist/records-encryption/base64url.d.ts +5 -0
  61. package/dist/records-encryption/base64url.d.ts.map +1 -0
  62. package/dist/records-encryption/encrypted-records.d.ts +338 -0
  63. package/dist/records-encryption/encrypted-records.d.ts.map +1 -0
  64. package/dist/records-encryption/index.d.ts +14 -0
  65. package/dist/records-encryption/index.d.ts.map +1 -0
  66. package/dist/records-encryption/keys.d.ts +40 -0
  67. package/dist/records-encryption/keys.d.ts.map +1 -0
  68. package/dist/records-encryption/loader.d.ts +15 -0
  69. package/dist/records-encryption/loader.d.ts.map +1 -0
  70. package/dist/records-encryption/pin-store-file.d.ts +8 -0
  71. package/dist/records-encryption/pin-store-file.d.ts.map +1 -0
  72. package/dist/records-encryption/pin-store.d.ts +17 -0
  73. package/dist/records-encryption/pin-store.d.ts.map +1 -0
  74. package/dist/records-encryption/transport.d.ts +23 -0
  75. package/dist/records-encryption/transport.d.ts.map +1 -0
  76. package/dist/records-encryption/words.d.ts +40 -0
  77. package/dist/records-encryption/words.d.ts.map +1 -0
  78. package/dist/records-encryption/workspace-secret.d.ts +9 -0
  79. package/dist/records-encryption/workspace-secret.d.ts.map +1 -0
  80. package/dist/resources/records.d.ts +112 -2
  81. package/dist/resources/records.d.ts.map +1 -1
  82. package/dist/types/common.d.ts +0 -8
  83. package/dist/types/common.d.ts.map +1 -1
  84. package/dist/types/config.d.ts +7 -5
  85. package/dist/types/config.d.ts.map +1 -1
  86. package/dist/types/records-encryption.d.ts +136 -0
  87. package/dist/types/records-encryption.d.ts.map +1 -0
  88. package/dist/types/records.d.ts +171 -20
  89. package/dist/types/records.d.ts.map +1 -1
  90. package/dist/types/verify.d.ts +84 -0
  91. package/dist/types/verify.d.ts.map +1 -0
  92. package/dist/webhooks/index.d.ts +1 -1
  93. package/dist/webhooks/index.d.ts.map +1 -1
  94. package/dist/webhooks/index.js +229 -5
  95. package/dist/webhooks/index.js.map +7 -1
  96. package/dist/webhooks/types.d.ts +15 -7
  97. package/dist/webhooks/types.d.ts.map +1 -1
  98. package/dist/workspace-secret-file.d.ts +18 -0
  99. package/dist/workspace-secret-file.d.ts.map +1 -0
  100. package/package.json +16 -13
  101. package/dist/client.js +0 -553
  102. package/dist/client.js.map +0 -1
  103. package/dist/errors/index.js +0 -223
  104. package/dist/errors/index.js.map +0 -1
  105. package/dist/fingerprint.js +0 -132
  106. package/dist/fingerprint.js.map +0 -1
  107. package/dist/resources/balance.d.ts +0 -384
  108. package/dist/resources/balance.d.ts.map +0 -1
  109. package/dist/resources/balance.js +0 -1120
  110. package/dist/resources/balance.js.map +0 -1
  111. package/dist/resources/customers.d.ts +0 -33
  112. package/dist/resources/customers.d.ts.map +0 -1
  113. package/dist/resources/customers.js +0 -26
  114. package/dist/resources/customers.js.map +0 -1
  115. package/dist/resources/internal/batch-transport.d.ts +0 -65
  116. package/dist/resources/internal/batch-transport.d.ts.map +0 -1
  117. package/dist/resources/internal/batch-transport.js +0 -42
  118. package/dist/resources/internal/batch-transport.js.map +0 -1
  119. package/dist/resources/receipts.d.ts +0 -46
  120. package/dist/resources/receipts.d.ts.map +0 -1
  121. package/dist/resources/receipts.js +0 -133
  122. package/dist/resources/receipts.js.map +0 -1
  123. package/dist/resources/records.js +0 -232
  124. package/dist/resources/records.js.map +0 -1
  125. package/dist/resources/submission.d.ts +0 -79
  126. package/dist/resources/submission.d.ts.map +0 -1
  127. package/dist/resources/submission.js +0 -398
  128. package/dist/resources/submission.js.map +0 -1
  129. package/dist/types/balance.d.ts +0 -966
  130. package/dist/types/balance.d.ts.map +0 -1
  131. package/dist/types/balance.js +0 -3
  132. package/dist/types/balance.js.map +0 -1
  133. package/dist/types/common.js +0 -3
  134. package/dist/types/common.js.map +0 -1
  135. package/dist/types/config.js +0 -3
  136. package/dist/types/config.js.map +0 -1
  137. package/dist/types/records.js +0 -5
  138. package/dist/types/records.js.map +0 -1
  139. package/dist/types/submission.d.ts +0 -125
  140. package/dist/types/submission.d.ts.map +0 -1
  141. package/dist/types/submission.js +0 -3
  142. package/dist/types/submission.js.map +0 -1
  143. package/dist/utils/polling.d.ts +0 -32
  144. package/dist/utils/polling.d.ts.map +0 -1
  145. package/dist/utils/polling.js +0 -52
  146. package/dist/utils/polling.js.map +0 -1
  147. package/dist/utils/retry.js +0 -21
  148. package/dist/utils/retry.js.map +0 -1
  149. package/dist/webhooks/types.js +0 -3
  150. package/dist/webhooks/types.js.map +0 -1
  151. package/dist/webhooks/verify.js +0 -191
  152. package/dist/webhooks/verify.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ export declare const LABEL_PAIR_RE: RegExp;
2
+ export declare const LABELS_MAX = 10;
3
+ export declare const LABEL_KEY_RE: RegExp;
4
+ export declare const LABEL_VALUE_RE: RegExp;
5
+ export declare const BLINDED_LABEL_RE: RegExp;
6
+ export type PlainLabels = Record<string, string>;
7
+ export type BlindedLabels = {
8
+ b: string[];
9
+ };
10
+ export type StoredLabels = PlainLabels | BlindedLabels;
11
+ export declare function parseLabels(input: unknown): PlainLabels;
12
+ export declare function labelsUnreadable(input: unknown): boolean;
13
+ export type LabelsCheck = {
14
+ ok: true;
15
+ kind: 'plain';
16
+ labels: PlainLabels;
17
+ } | {
18
+ ok: true;
19
+ kind: 'blinded';
20
+ labels: string[];
21
+ } | {
22
+ ok: false;
23
+ code: 'RECORD_LABELS_INVALID';
24
+ };
25
+ export declare function checkLabels(input: unknown): LabelsCheck;
26
+ export type LabelsMerge = {
27
+ ok: true;
28
+ labels: StoredLabels;
29
+ changed: boolean;
30
+ } | {
31
+ ok: false;
32
+ code: 'RECORD_LABEL_CONFLICT' | 'RECORD_LABELS_INVALID';
33
+ };
34
+ export declare function isBlindedLabels(stored: unknown): stored is BlindedLabels;
35
+ export declare function mergeLabels(stored: unknown, incoming: Exclude<LabelsCheck, {
36
+ ok: false;
37
+ }>): LabelsMerge;
@@ -0,0 +1,198 @@
1
+ import { type RecordDisclosure } from '../records-crypto/record-disclosure-v1';
2
+ import type { SigningPublicKeyJwkV1 } from './signed-acknowledgment-v1';
3
+ export declare const READER_CRYPTO_LABELS_V1: {
4
+ readonly deviceId: "pacspace:reader-device:v1";
5
+ readonly proofKey: "pacspace:device-proof-key:v1";
6
+ readonly deviceProof: "pacspace:device-proof:v1";
7
+ readonly deviceConfirmed: "pacspace:device-confirmed:v1";
8
+ readonly deviceApproval: "pacspace:device-approval:v1";
9
+ readonly signedRequest: "pacspace:signed-request:v1";
10
+ readonly deviceDisconnect: "pacspace:device-disconnect:v1";
11
+ readonly sealedNote: "pacspace:sealed-note:v1";
12
+ readonly workspaceKey: "pacspace:workspace-key:v1";
13
+ };
14
+ export declare const SEALED_NOTE_SCHEMA_V1: "sealed-note/v1";
15
+ export declare const SAMPLE_METHOD_V1: "pacspace-sample/v1";
16
+ export declare const DEVICE_XWING_PUBLIC_KEY_BYTES_V1 = 1216;
17
+ export declare const DEVICE_P256_SPKI_BYTES_V1 = 91;
18
+ export declare const DEVICE_CODE_DIGITS_V1 = 40;
19
+ export declare const LINK_KEY_BYTES_V1 = 32;
20
+ export declare const SAMPLE_SEED_HEX_V1: RegExp;
21
+ export declare const SEALED_NOTE_MAX_CHARS_V1 = 65536;
22
+ export type ReaderCryptoCodeV1 = 'READER_BINDING_INVALID' | 'READER_DEVICE_KEYS_INVALID' | 'READER_KEY_INVALID' | 'SEALED_NOTE_MALFORMED';
23
+ export declare class ReaderCryptoError extends Error {
24
+ readonly code: ReaderCryptoCodeV1;
25
+ constructor(code: ReaderCryptoCodeV1);
26
+ }
27
+ export declare function linkKeyBindingV1(handle: string, epoch: number): string;
28
+ export declare function revealBindingV1(handle: string, epoch: number, recordKey: string): string;
29
+ export declare function answerKeyBindingV1(handle: string, requestRef: string): string;
30
+ export declare function answerEntryBindingV1(handle: string, requestRef: string, number: number, seq: number): string;
31
+ export type NoteScopeV1 = {
32
+ handle: string;
33
+ } | {
34
+ trailRuleOf: string;
35
+ };
36
+ export interface NoteNameV1 {
37
+ scope: NoteScopeV1;
38
+ kind: string;
39
+ ref: string;
40
+ n: number;
41
+ }
42
+ export declare function noteKeyBindingV1(name: NoteNameV1): string;
43
+ export declare function noteAdditionalDataV1(name: NoteNameV1): string;
44
+ export declare function ackFlagNotesKeyNameV1(handle: string, checkRef: string): NoteNameV1;
45
+ export declare function ackFlagNoteNameV1(handle: string, checkRef: string, record: number, entry: number): NoteNameV1;
46
+ export declare function ackNoteNameV1(handle: string, checkRef: string): NoteNameV1;
47
+ export interface DevicePublicKeysV1 {
48
+ xwingPublicKey: Uint8Array;
49
+ p256Jwk: SigningPublicKeyJwkV1;
50
+ mldsaPublicKey: Uint8Array;
51
+ }
52
+ export declare function p256SpkiOfJwkV1(jwk: SigningPublicKeyJwkV1): Promise<Uint8Array>;
53
+ export declare function deviceIdV1(keys: DevicePublicKeysV1): Promise<string>;
54
+ export declare function deviceCodeV1(deviceId: string): string;
55
+ export declare function proofKeyV1(linkKey: Uint8Array): Promise<Uint8Array>;
56
+ export declare function deviceProofV1(proofKey: Uint8Array | CryptoKey, handle: string, epoch: number, deviceId: string): Promise<string>;
57
+ export declare function confirmationTagV1(proofKey: Uint8Array | CryptoKey, handle: string, epoch: number, deviceId: string): Promise<string>;
58
+ export interface ReaderLinkKeysV1 {
59
+ revealKey: CryptoKey;
60
+ proofKey: CryptoKey;
61
+ }
62
+ export declare function readerLinkKeysV1(linkKey: Uint8Array): Promise<ReaderLinkKeysV1>;
63
+ export declare function workspaceKeyTagV1(proofKey: Uint8Array | CryptoKey, handle: string, epoch: number, keyId: string): Promise<string>;
64
+ export declare function servedWorkspaceKeyV1(input: {
65
+ proofKey: Uint8Array | CryptoKey;
66
+ handle: string;
67
+ epoch: number;
68
+ publicKey: Uint8Array;
69
+ tag: unknown;
70
+ }): Promise<{
71
+ ok: true;
72
+ keyId: string;
73
+ } | {
74
+ ok: false;
75
+ code: 'WORKSPACE_KEY_NOT_TAGGED';
76
+ }>;
77
+ export declare function servedDevicesV1(input: {
78
+ proofKey: Uint8Array | CryptoKey;
79
+ handle: string;
80
+ epoch: number;
81
+ devices: unknown;
82
+ }): Promise<{
83
+ ok: true;
84
+ devices: Array<{
85
+ deviceId: string;
86
+ xwingPublicKey: Uint8Array;
87
+ }>;
88
+ } | {
89
+ ok: false;
90
+ code: 'DEVICE_NOT_TAGGED';
91
+ }>;
92
+ export declare function approvalMessageV1(handle: string, epoch: number, newDeviceId: string): string;
93
+ export declare function signedRequestDigestV1(body: Readonly<Record<string, unknown>>): Promise<string>;
94
+ export declare function signedRequestMessageV1(handle: string, epoch: number, deviceId: string, requestDigest: string): string;
95
+ export declare function disconnectMessageV1(handle: string, epoch: number, deviceId: string): string;
96
+ export declare function sameHex64V1(a: unknown, b: unknown): boolean;
97
+ export declare function revealRecordV1(input: {
98
+ disclosure: RecordDisclosure;
99
+ linkKey: Uint8Array;
100
+ handle: string;
101
+ epoch: number;
102
+ recordKey: string;
103
+ }): Promise<string>;
104
+ export declare function openRevealV1(input: {
105
+ envelope: string;
106
+ linkKey: Uint8Array | CryptoKey;
107
+ handle: string;
108
+ epoch: number;
109
+ recordKey: string;
110
+ }): Promise<{
111
+ ok: true;
112
+ disclosure: unknown;
113
+ } | {
114
+ ok: false;
115
+ code: import("../records-crypto/disclosure-envelope-v1").DisclosureEnvelopeRefusalV1;
116
+ reason: string;
117
+ }>;
118
+ export declare function sealAnswerEntryV1(input: {
119
+ disclosure: RecordDisclosure;
120
+ answerKey: Uint8Array;
121
+ handle: string;
122
+ requestRef: string;
123
+ number: number;
124
+ seq: number;
125
+ }): Promise<string>;
126
+ export declare function openAnswerEntryV1(input: {
127
+ envelope: string;
128
+ answerKey: Uint8Array;
129
+ handle: string;
130
+ requestRef: string;
131
+ number: number;
132
+ seq: number;
133
+ recordHashVersion: 1 | 2 | 3;
134
+ }): Promise<{
135
+ ok: true;
136
+ disclosure: RecordDisclosure;
137
+ } | {
138
+ ok: false;
139
+ code: string;
140
+ }>;
141
+ export declare function shownFieldsV1(disclosure: RecordDisclosure): Map<number, string[]>;
142
+ export declare function shownFieldsMatchV1(disclosure: RecordDisclosure, seq: number, declared: readonly string[]): boolean;
143
+ export declare function disclosureDigestV1(envelope: string): Promise<string>;
144
+ export interface SealedNoteV1 {
145
+ schema: typeof SEALED_NOTE_SCHEMA_V1;
146
+ iv: string;
147
+ ct: string;
148
+ }
149
+ export declare function readSealedNoteShapeV1(value: unknown): {
150
+ ok: true;
151
+ iv: Uint8Array;
152
+ ct: Uint8Array;
153
+ } | {
154
+ ok: false;
155
+ code: 'SEALED_NOTE_MALFORMED';
156
+ };
157
+ export declare function sealNoteV1(text: string, name: NoteNameV1): Promise<{
158
+ note: SealedNoteV1;
159
+ key: Uint8Array;
160
+ }>;
161
+ export declare function openNoteV1(input: {
162
+ note: unknown;
163
+ key: Uint8Array;
164
+ name: NoteNameV1;
165
+ }): Promise<{
166
+ ok: true;
167
+ text: string;
168
+ } | {
169
+ ok: false;
170
+ code: 'SEALED_NOTE_MALFORMED' | 'SEALED_NOTE_AUTH_FAILED';
171
+ }>;
172
+ export declare function sealedNoteDigestV1(note: SealedNoteV1): Promise<string>;
173
+ export declare function newSampleSeedV1(): string;
174
+ export declare function sampleDrawerV1(seed: string): {
175
+ next(size: number): Promise<number>;
176
+ rejected: number[];
177
+ };
178
+ export type SampleSpreadV1 = 'any' | 'records' | 'days';
179
+ export interface SamplePoolRecordV1 {
180
+ number: number;
181
+ entries: number;
182
+ openedOn: string;
183
+ }
184
+ export interface SamplePickV1 {
185
+ number: number;
186
+ seq: number;
187
+ }
188
+ export declare function samplePoolV1(records: readonly SamplePoolRecordV1[], leftOut: readonly SamplePickV1[]): Array<SamplePickV1 & {
189
+ openedOn: string;
190
+ }>;
191
+ export declare function samplePoolDigestV1(records: readonly SamplePoolRecordV1[]): Promise<string>;
192
+ export declare function drawSampleV1(input: {
193
+ seed: string;
194
+ records: readonly SamplePoolRecordV1[];
195
+ leftOut: readonly SamplePickV1[];
196
+ n: number;
197
+ spread: SampleSpreadV1;
198
+ }): Promise<SamplePickV1[]>;
@@ -0,0 +1,164 @@
1
+ import { type PayloadDigestV1 } from './trail-index-v1';
2
+ import type { SharedRecordAckBodyV2 } from './shared-record-ack-v2';
3
+ export declare const READER_LINK_RECORD_TYPE = "machine-action-record";
4
+ export declare const SHARE_REFERENCE_PATTERN: RegExp;
5
+ export declare const SHARE_REFERENCE_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
6
+ export declare const SHARE_CODE_PATTERN: RegExp;
7
+ export declare const SHARE_CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
8
+ export declare const SHARE_CODE_TRIES = 5;
9
+ export type ReaderLinkKind = 'link-made' | 'allowance-changed' | 'link-extended' | 'person-added' | 'person-removed' | 'link-key-changed' | 'workspace-key-changed' | 'record-revealed' | 'link-turned-off' | 'device-added' | 'device-confirmed' | 'device-removed' | 'request' | 'answer' | 'acknowledgment' | 'flag' | 'flag-message';
10
+ export interface ReaderLinkContentV1 {
11
+ title: string;
12
+ kind: ReaderLinkKind;
13
+ occurredAt: string;
14
+ actorId: string;
15
+ payloads: PayloadDigestV1[];
16
+ references?: Array<{
17
+ recordKey: string;
18
+ seq: number;
19
+ }>;
20
+ }
21
+ export type RevealModeV1 = 'seals' | 'fields' | 'all';
22
+ export type AnswersByV1 = 'people' | 'agent';
23
+ export interface ReaderLinkTermsV1 {
24
+ reference: string;
25
+ allowance: number | null;
26
+ endsOn: string;
27
+ reveal: {
28
+ mode: RevealModeV1;
29
+ fields: string[];
30
+ time: boolean;
31
+ };
32
+ answers: {
33
+ by: AnswersByV1;
34
+ fields: string[];
35
+ };
36
+ responseDays: number | null;
37
+ }
38
+ export declare function readerLinkEntityId(shareId: string): string;
39
+ export declare function shareEventIdempotencyKey(shareId: string, seq: number): string;
40
+ export declare function linkMadeContentV1(input: ReaderLinkTermsV1 & {
41
+ workspaceKeyTag?: string | null;
42
+ at: Date;
43
+ }): ReaderLinkContentV1;
44
+ export declare function workspaceKeyTagPayloadV1(epoch: number, workspaceKeyTag: string): PayloadDigestV1;
45
+ export declare function allowanceChangedContentV1(input: {
46
+ allowance: number | null;
47
+ from: number | null;
48
+ at: Date;
49
+ }): ReaderLinkContentV1;
50
+ export declare function linkExtendedContentV1(input: {
51
+ endsOn: string;
52
+ at: Date;
53
+ }): ReaderLinkContentV1;
54
+ export declare function personChangedContentV1(input: {
55
+ change: 'added' | 'removed';
56
+ count: number;
57
+ epoch: number;
58
+ at: Date;
59
+ }): ReaderLinkContentV1;
60
+ export declare function linkKeyChangedContentV1(input: {
61
+ epoch: number;
62
+ workspaceKeyTag?: string | null;
63
+ at: Date;
64
+ }): ReaderLinkContentV1;
65
+ export declare function workspaceKeyChangedContentV1(input: {
66
+ epoch: number;
67
+ workspaceKeyTag: string;
68
+ at: Date;
69
+ }): ReaderLinkContentV1;
70
+ export declare function workspaceKeyTagCommittedV1(entries: ReadonlyArray<{
71
+ seq: number;
72
+ content: unknown;
73
+ }>, committedEntries: number, epoch: number, tag: string): boolean;
74
+ export declare function lastWorkspaceKeyTagDigestV1(entries: ReadonlyArray<{
75
+ seq: number;
76
+ content: unknown;
77
+ }>, committedEntries: number, epoch: number): string | null;
78
+ export declare function recordRevealedContentV1(input: {
79
+ number: number;
80
+ recordKey: string;
81
+ lastSeq: number;
82
+ envelope: string;
83
+ at: Date;
84
+ }): ReaderLinkContentV1;
85
+ export declare function linkTurnedOffContentV1(input: {
86
+ at: Date;
87
+ }): ReaderLinkContentV1;
88
+ export type DeviceConfirmedByV1 = 'code' | 'proof' | 'device';
89
+ export type DeviceKindV1 = 'browser' | 'agent';
90
+ export declare function deviceChangedContentV1(input: {
91
+ change: 'added' | 'confirmed' | 'removed';
92
+ code: string;
93
+ kind: DeviceKindV1;
94
+ confirmedBy: DeviceConfirmedByV1 | null;
95
+ at: Date;
96
+ }): ReaderLinkContentV1;
97
+ export interface RequestItemV1 {
98
+ number: number;
99
+ seq: number;
100
+ seal: string;
101
+ picked: 'random' | 'chosen' | 'mismatch';
102
+ }
103
+ export interface RequestSampleV1 {
104
+ method: 'pacspace-sample/v1';
105
+ seed: string;
106
+ poolDigest: string;
107
+ poolSize: number;
108
+ leftOut: Array<{
109
+ number: number;
110
+ seq: number;
111
+ }>;
112
+ spread: 'any' | 'records' | 'days';
113
+ removed: Array<{
114
+ number: number;
115
+ seq: number;
116
+ }>;
117
+ }
118
+ export interface RequestManifestV1 {
119
+ ref: string;
120
+ items: RequestItemV1[];
121
+ sample: RequestSampleV1 | null;
122
+ question: string | null;
123
+ beyond: number;
124
+ dueOn: string | null;
125
+ }
126
+ export declare function requestContentV1(input: {
127
+ manifest: RequestManifestV1;
128
+ recordKeys: ReadonlyMap<number, string>;
129
+ at: Date;
130
+ }): ReaderLinkContentV1;
131
+ export type AnswerDeclineV1 = {
132
+ kind: 'legal_hold' | 'personal_data' | 'beyond_sample' | 'past_retention';
133
+ } | {
134
+ kind: 'other';
135
+ note: string;
136
+ };
137
+ export type AnswerItemV1 = {
138
+ number: number;
139
+ seq: number;
140
+ outcome: 'shown';
141
+ declaredFields: string[];
142
+ disclosureDigest: string;
143
+ } | {
144
+ number: number;
145
+ seq: number;
146
+ outcome: 'declined';
147
+ reason: AnswerDeclineV1;
148
+ };
149
+ export interface AnswerManifestV1 {
150
+ ref: string;
151
+ items: AnswerItemV1[];
152
+ replyDigest: string | null;
153
+ sentBy: 'person' | 'agent';
154
+ }
155
+ export declare function answerContentV1(input: {
156
+ manifest: AnswerManifestV1;
157
+ at: Date;
158
+ }): ReaderLinkContentV1;
159
+ export declare const ACKNOWLEDGMENT_REF_PATTERN: RegExp;
160
+ export declare function acknowledgmentContentV1(input: {
161
+ ref: string;
162
+ body: SharedRecordAckBodyV2;
163
+ at: Date;
164
+ }): ReaderLinkContentV1;
@@ -0,0 +1,72 @@
1
+ import { type SealedNoteV1 } from './reader-crypto-v1';
2
+ export declare const SHARED_RECORD_ACK_SCHEMA_V2: "shared-record-ack/v2";
3
+ export declare const SHARED_RECORD_ACK_SIGNING_LABEL_V2 = "pacspace:shared-record-ack:v2";
4
+ export declare const SHARED_RECORD_ACK_MAX_CHARS_V2: number;
5
+ export declare const SHARED_RECORD_ACK_NOTE_MAX_V2 = 2000;
6
+ export declare const SHARED_RECORD_ACK_FLAG_NOTE_MAX_V2 = 500;
7
+ export declare const SHARED_RECORD_ACK_SEALED_FLAG_NOTE_MAX_CHARS_V2: number;
8
+ export declare const SHARED_RECORD_ACK_SEALED_NOTE_MAX_CHARS_V2: number;
9
+ export declare const SHARED_RECORD_ACK_LIST_MAX_V2 = 100;
10
+ export declare const SHARED_RECORD_ACK_SAMPLES_MAX_V2 = 20;
11
+ export declare const SHARED_RECORD_ACK_FLAG_RESULTS_V2: readonly ["matches", "does-not-match", "copy-differs"];
12
+ export type SharedRecordAckFlagResultV2 = (typeof SHARED_RECORD_ACK_FLAG_RESULTS_V2)[number];
13
+ export interface SharedRecordAckEntryV2 {
14
+ record: number;
15
+ entry: number;
16
+ }
17
+ export interface SharedRecordAckBodyV2 {
18
+ schema: typeof SHARED_RECORD_ACK_SCHEMA_V2;
19
+ reference: string;
20
+ deviceId: string;
21
+ keyId: string;
22
+ check: {
23
+ ref: string;
24
+ on: string;
25
+ };
26
+ sealHistoryDigest: string;
27
+ disclosureDigest: string | null;
28
+ counts: {
29
+ records: number;
30
+ entries: number;
31
+ matched: number;
32
+ notMatched: number;
33
+ };
34
+ sample: Array<{
35
+ request: string;
36
+ method: 'pacspace-sample/v1';
37
+ seed: string;
38
+ picks: SharedRecordAckEntryV2[];
39
+ }>;
40
+ answers: {
41
+ shown: number;
42
+ declined: number;
43
+ };
44
+ mismatches: SharedRecordAckEntryV2[];
45
+ flags: Array<SharedRecordAckEntryV2 & {
46
+ result: SharedRecordAckFlagResultV2;
47
+ note: string | SealedNoteV1 | null;
48
+ }>;
49
+ declaredFields: Array<{
50
+ request: string;
51
+ asDeclared: boolean;
52
+ }>;
53
+ note: string | SealedNoteV1 | null;
54
+ signedAt: string;
55
+ }
56
+ export interface SharedRecordAckEnvelopeV2 {
57
+ body: SharedRecordAckBodyV2;
58
+ signature: string;
59
+ mldsaSignature: string;
60
+ }
61
+ export declare function readSharedRecordAckFlagTextV2(value: unknown): string | null;
62
+ export declare function readSharedRecordAckNoteTextV2(value: unknown): string | null;
63
+ export declare const isSealedFlagNoteV2: (n: string | SealedNoteV1 | null) => n is SealedNoteV1;
64
+ export declare const ackNotesV2: (body: Pick<SharedRecordAckBodyV2, "note" | "flags">) => Array<string | SealedNoteV1 | null>;
65
+ export declare function readSharedRecordAckV2(value: unknown): {
66
+ ok: true;
67
+ body: SharedRecordAckBodyV2;
68
+ } | {
69
+ ok: false;
70
+ problem: string;
71
+ };
72
+ export declare function sharedRecordAckMessageV2(body: SharedRecordAckBodyV2): string;
@@ -0,0 +1,38 @@
1
+ export declare const SIGNED_ACKNOWLEDGMENT_ALG_V1: "ES256";
2
+ export interface SigningPublicKeyJwkV1 {
3
+ kty: 'EC';
4
+ crv: 'P-256';
5
+ x: string;
6
+ y: string;
7
+ }
8
+ export interface SignedEnvelopeV1 {
9
+ alg: typeof SIGNED_ACKNOWLEDGMENT_ALG_V1;
10
+ publicKey: SigningPublicKeyJwkV1;
11
+ signature: string;
12
+ signedAt: string;
13
+ }
14
+ export interface AcknowledgmentSignedBodyV1 {
15
+ handle: string;
16
+ seq: number;
17
+ matched: boolean;
18
+ missing: boolean;
19
+ historyDigest: string;
20
+ signedAt: string;
21
+ }
22
+ export interface ClaimSignedBodyV1 {
23
+ customerId: string;
24
+ period: string;
25
+ balance: number;
26
+ signedAt: string;
27
+ }
28
+ export declare function canonicalAcknowledgmentBodyV1(body: AcknowledgmentSignedBodyV1): string;
29
+ export interface CycleConfirmationBodyV1 {
30
+ checkpointId: string;
31
+ customerId: string;
32
+ period: string;
33
+ balance: number;
34
+ }
35
+ export declare function canonicalCycleConfirmationBodyV1(body: CycleConfirmationBodyV1): string;
36
+ export declare function canonicalClaimBodyV1(body: ClaimSignedBodyV1): string;
37
+ export declare function signingKeyThumbprintInputV1(key: SigningPublicKeyJwkV1): string;
38
+ export declare function isSignedEnvelopeV1(value: unknown): value is SignedEnvelopeV1;
@@ -0,0 +1,12 @@
1
+ import type { AcknowledgmentSignedBodyV1, SigningPublicKeyJwkV1 } from './signed-acknowledgment-v1';
2
+ export declare const SIGNED_ACKNOWLEDGMENT_ALGS_V2: readonly ["ES256", "ML-DSA-65"];
3
+ export declare const ACKNOWLEDGMENT_KEY_ID_LABEL_V2 = "pacspace:ack-key-id:v1";
4
+ export declare const MLDSA65_PUBLIC_KEY_BYTES = 1952;
5
+ export declare const MLDSA65_SIGNATURE_BYTES = 3309;
6
+ export declare const ES256_PUBLIC_POINT_BYTES = 65;
7
+ export interface AcknowledgmentSignedBodyV2 extends AcknowledgmentSignedBodyV1 {
8
+ keyId: string;
9
+ }
10
+ export declare function canonicalAcknowledgmentBodyV2(body: AcknowledgmentSignedBodyV2): string;
11
+ export declare function es256PublicPointV1(key: SigningPublicKeyJwkV1): Uint8Array | null;
12
+ export declare function acknowledgmentKeyIdV2(es256: SigningPublicKeyJwkV1, mldsaPublicKey: Uint8Array): Promise<string | null>;
@@ -0,0 +1,89 @@
1
+ import type { TrailRuleV1 } from './trail-rule';
2
+ export declare const TRAIL_INDEX_RECORD_TYPE = "machine-action-record";
3
+ export declare const TRAIL_INDEX_ACTOR = "pacspace";
4
+ export declare const TRAIL_RULE_SALT_BYTES = 32;
5
+ export type TrailIndexKind = 'rule-committed' | 'rule-changed' | 'scope-reworded' | 'record-joined' | 'record-removed' | 'entry-erased' | 'legal-hold-placed' | 'legal-hold-released';
6
+ export interface PayloadDigestV1 {
7
+ alg: 'sha-256';
8
+ digest: string;
9
+ byteLength: string;
10
+ }
11
+ export interface TrailIndexContentV1 {
12
+ title: string;
13
+ kind: TrailIndexKind;
14
+ occurredAt: string;
15
+ actorId: string;
16
+ payloads: PayloadDigestV1[];
17
+ description?: string;
18
+ note?: string;
19
+ references?: Array<{
20
+ recordKey: string;
21
+ seq: number;
22
+ }>;
23
+ }
24
+ export declare function trailIndexEntityId(trailId: string): string;
25
+ export declare function trailEventIdempotencyKey(trailId: string, seq: number): string;
26
+ export declare function payloadDigestV1(value: unknown): PayloadDigestV1;
27
+ export declare function trailRuleDigestInput(rule: TrailRuleV1, salt: Uint8Array): {
28
+ v: 1;
29
+ rule: TrailRuleV1;
30
+ salt: string;
31
+ };
32
+ export interface TrailJoinFactsV1 {
33
+ recordKey: string;
34
+ lastSeq: number;
35
+ lastSeal: string;
36
+ closedBy: 'code' | 'timeout';
37
+ number: number;
38
+ ruleVersion: number;
39
+ }
40
+ export declare function trailIndexTime(at: Date): string;
41
+ export declare function ruleCommittedContentV1(input: {
42
+ scope: string;
43
+ rule: TrailRuleV1;
44
+ salt: Uint8Array;
45
+ at: Date;
46
+ }): TrailIndexContentV1;
47
+ export declare function ruleChangedContentV1(input: {
48
+ rule: TrailRuleV1;
49
+ salt: Uint8Array;
50
+ reason: string;
51
+ at: Date;
52
+ }): TrailIndexContentV1;
53
+ export declare function scopeRewordedContentV1(input: {
54
+ scope: string;
55
+ reason: string;
56
+ at: Date;
57
+ }): TrailIndexContentV1;
58
+ export declare function recordJoinedContentV1(input: TrailJoinFactsV1 & {
59
+ at: Date;
60
+ }): TrailIndexContentV1;
61
+ export declare function recordRemovedContentV1(input: {
62
+ number: number;
63
+ joinedEvent: number;
64
+ recordKey: string;
65
+ lastSeq: number;
66
+ reason: string;
67
+ at: Date;
68
+ }): TrailIndexContentV1;
69
+ export declare function entryErasedContentV1(input: {
70
+ number: number;
71
+ recordKey: string;
72
+ seq: number;
73
+ reason: string;
74
+ at: Date;
75
+ }): TrailIndexContentV1;
76
+ export declare function legalHoldPlacedContentV1(input: {
77
+ holdId: string;
78
+ on: 'whole' | {
79
+ number: number;
80
+ recordKey: string;
81
+ };
82
+ reason: string;
83
+ at: Date;
84
+ }): TrailIndexContentV1;
85
+ export declare function legalHoldReleasedContentV1(input: {
86
+ holdId: string;
87
+ reason: string;
88
+ at: Date;
89
+ }): TrailIndexContentV1;
@@ -0,0 +1,54 @@
1
+ import { type BlindedLabels, type PlainLabels } from './labels';
2
+ export interface TrailRuleV1 {
3
+ v: 1;
4
+ sources: string[];
5
+ labels: PlainLabels | BlindedLabels;
6
+ from: string;
7
+ earlier: boolean;
8
+ }
9
+ export interface TrailRuleRecord {
10
+ sourceId: string | null;
11
+ openedOn: string;
12
+ labels: unknown;
13
+ }
14
+ export declare const TRAIL_RULE_WORDS: {
15
+ readonly sourcesInvalid: "Choose at least one source in this environment. Nothing was committed.";
16
+ readonly labelsUnreadable: "Write each label as a name and a value. Nothing was committed.";
17
+ readonly dayUnreadable: "Write the date as a day, a month and a year, for example 1 September 2026.";
18
+ readonly labelsOverLimit: "Labels are up to 10 key=value pairs. Keys are lowercase.";
19
+ readonly labelsBlindedHere: "This workspace encrypts its records, so a rule names labels blinded in the browser. Nothing was committed.";
20
+ readonly labelsPlainHere: "This workspace keeps its records in plain form, so a rule names labels as a name and a value. Nothing was committed.";
21
+ };
22
+ export declare function parseRuleDay(input: unknown): string | null;
23
+ export declare function formatRuleDay(iso: string): string;
24
+ export declare function ruleMatches(rule: TrailRuleV1, record: TrailRuleRecord): boolean;
25
+ export declare function ruleSame(a: TrailRuleV1, b: TrailRuleV1): boolean;
26
+ export interface RuleSaySource {
27
+ id: string;
28
+ name: string;
29
+ environment: string;
30
+ }
31
+ export declare function ruleSay(rule: TrailRuleV1, sources: readonly RuleSaySource[], labelsText?: string): string;
32
+ export type TrailRuleCheck = {
33
+ ok: true;
34
+ rule: TrailRuleV1;
35
+ } | {
36
+ ok: false;
37
+ code: 'TRAIL_RULE_INVALID';
38
+ message: string;
39
+ };
40
+ export interface TrailRuleInput {
41
+ sources?: unknown;
42
+ labels?: unknown;
43
+ from?: unknown;
44
+ earlier?: unknown;
45
+ }
46
+ export declare function checkTrailRule(input: TrailRuleInput, options: {
47
+ encrypted: boolean;
48
+ }): TrailRuleCheck;
49
+ export interface SqlFragment {
50
+ strings: string[];
51
+ values: unknown[];
52
+ }
53
+ export declare function ruleToSql(rule: TrailRuleV1, alias?: string): SqlFragment;
54
+ export declare function sqlFragmentText(fragment: SqlFragment, offset?: number): string;