@nodatachat/sdk 1.0.0 → 2.1.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.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NoDataConfig, C as ChannelCreateRequest, a as ChannelCreateResponse, b as ChannelSendRequest, c as ChannelSendResponse, d as ChannelReceiveRequest, e as ChannelReceiveResponse, W as WebhookChannelCreateRequest, f as WebhookChannelCreateResponse, g as WebhookEventsResponse, D as DeliverRequest, h as DeliverResponse, E as EvidenceQuery, i as EvidenceResponse, V as VaultCreateRequest, j as VaultCreateResponse, k as VaultReadResponse, l as EncryptRequest, m as EncryptResponse, n as DecryptRequest, o as DecryptResponse, B as BatchResult } from './types-DQh0UmSr.mjs';
2
- export { p as EvidenceEntry, q as NoDataError, P as PluginConfig, r as WebhookEvent } from './types-DQh0UmSr.mjs';
1
+ import { N as NoDataConfig, A as AgentReadRequest, a as AgentReadResponse, R as RegisterTableRequest, b as RegisterTableResponse, G as GrantRequest, c as GrantResponse, d as RevokeRequest, e as RevokeResponse, V as VaultCreateRequest, f as VaultCreateResponse, g as VaultReadResponse, E as EvidenceQuery, h as EvidenceResponse, D as DeliverRequest, i as DeliverResponse, W as WebhookChannelCreateRequest, j as WebhookChannelCreateResponse, k as WebhookEventsResponse, C as ChannelCreateRequest, l as ChannelCreateResponse, m as ChannelSendRequest, n as ChannelSendResponse, o as ChannelReceiveRequest, p as ChannelReceiveResponse, q as EncryptRequest, r as EncryptResponse, s as DecryptRequest, t as DecryptResponse, B as BatchResult, u as NoDataError, v as ComputeRequest, w as ComputeDecision, x as VerifyResult } from './types-qXK35-os.mjs';
2
+ export { y as Clearance, z as ComputeSection, F as EvidenceEntry, P as PluginConfig, H as RegisteredTable, I as WebhookEvent } from './types-qXK35-os.mjs';
3
3
 
4
4
  declare class HttpClient {
5
5
  private apiKey;
@@ -12,72 +12,182 @@ declare class HttpClient {
12
12
  private onError?;
13
13
  constructor(config: NoDataConfig);
14
14
  request<T>(method: string, path: string, body?: unknown, query?: Record<string, string>): Promise<T>;
15
+ /** Base URL the client targets · used by surfaces that auth with a
16
+ * different bearer than the API key (e.g. an agent grant token). */
17
+ get baseURL(): string;
15
18
  get<T>(path: string, query?: Record<string, string>): Promise<T>;
16
19
  post<T>(path: string, body?: unknown): Promise<T>;
17
20
  del<T>(path: string, body?: unknown): Promise<T>;
21
+ /**
22
+ * One call that never throws on an HTTP status: the Fabric doors answer a
23
+ * refusal or a held approval (403, 409, 428) with a body the caller must
24
+ * read, so the status and the whole body come back as they are. The relay
25
+ * doors wrap their answer in { data } (supabase-api ok()); both shapes unwrap.
26
+ */
27
+ raw(method: 'GET' | 'POST' | 'PATCH', path: string, body?: unknown): Promise<{
28
+ ok: boolean;
29
+ status: number;
30
+ data: Record<string, unknown>;
31
+ }>;
18
32
  }
19
33
 
20
- declare class ChannelModule {
34
+ declare class GovernanceModule {
35
+ private http;
36
+ constructor(http: HttpClient);
37
+ /** Register one of your own tables as AI-agent-readable. "Connect your
38
+ * data" — a config call, not a code change. Idempotent per table. */
39
+ registerTable(req: RegisterTableRequest): Promise<RegisterTableResponse>;
40
+ /** List your registered agent tables. */
41
+ listTables(): Promise<RegisterTableResponse>;
42
+ /** Issue an AI agent a claim-scoped grant over your data. Returns a
43
+ * grant token (shown once) the agent presents to read. */
44
+ grant(req: GrantRequest): Promise<GrantResponse>;
45
+ /** Revoke a grant by agent handle (revokes all active credentials for
46
+ * that agent) or by a specific jti. */
47
+ revoke(req: RevokeRequest): Promise<RevokeResponse>;
48
+ }
49
+ /**
50
+ * A reader bound to a single agent grant token. Authenticates with the
51
+ * grant token (NOT your API key), so this is exactly what an LLM/agent
52
+ * runtime would hold. Denied columns never decrypt server-side.
53
+ */
54
+ declare class AgentReader {
55
+ private baseURL;
56
+ private grantToken;
57
+ constructor(baseURL: string, grantToken: string);
58
+ read(req: AgentReadRequest): Promise<AgentReadResponse>;
59
+ }
60
+
61
+ declare class VaultModule {
21
62
  private http;
22
63
  constructor(http: HttpClient);
23
64
  /**
24
- * Create a secure channel for data transfer.
25
- *
26
- * Returns a channel_token that the sender uses, and optionally
27
- * a verification_code for the receiver.
65
+ * Store an encrypted blob in the vault.
66
+ * YOU encrypt client-side. Server stores blindly.
28
67
  *
29
68
  * @example
30
69
  * ```ts
31
- * // System A creates a channel
32
- * const ch = await nd.channel.create({ ttl: "1h", requireVerification: true });
33
- * // Send ch.channel_token to System B (the sender)
34
- * // Send ch.verification_code to the receiver (out-of-band)
70
+ * // Encrypt client-side, then store
71
+ * const blob = myEncrypt(sensitiveData, myKey);
72
+ * const vault = await nd.vault.create({
73
+ * label: "customer-contracts",
74
+ * encrypted_blob: blob.ciphertext,
75
+ * iv: blob.iv,
76
+ * metadata: { customer_id: "cust_123" },
77
+ * });
35
78
  * ```
36
79
  */
37
- create(req?: ChannelCreateRequest): Promise<ChannelCreateResponse>;
80
+ create(req: VaultCreateRequest): Promise<VaultCreateResponse>;
38
81
  /**
39
- * Send data through a secure channel.
40
- * Data is encrypted in transit — the server never sees plaintext.
82
+ * Retrieve an encrypted blob from the vault.
83
+ * YOU decrypt client-side.
84
+ */
85
+ read(vaultId: string): Promise<VaultReadResponse>;
86
+ /**
87
+ * Delete a vault entry (irreversible).
88
+ */
89
+ delete(vaultId: string): Promise<{
90
+ success: boolean;
91
+ }>;
92
+ /**
93
+ * Check vault service status.
94
+ */
95
+ status(): Promise<{
96
+ success: boolean;
97
+ vault_count: number;
98
+ storage_used_bytes: number;
99
+ }>;
100
+ }
101
+
102
+ declare class EvidenceModule {
103
+ private http;
104
+ constructor(http: HttpClient);
105
+ /**
106
+ * Query the audit trail.
107
+ * Returns metadata only — never content.
41
108
  *
42
109
  * @example
43
110
  * ```ts
44
- * // System B sends credit card data to System A
45
- * await nd.channel.send({
46
- * token: ch.channel_token,
47
- * data: { card: "4111111111111111", cvv: "123" },
48
- * burnAfterRead: true,
111
+ * const trail = await nd.evidence.query({
112
+ * field: "credit_card",
113
+ * action: "decrypt",
114
+ * from: "2026-03-01",
115
+ * to: "2026-03-27",
49
116
  * });
117
+ * // Shows WHO decrypted WHAT field WHEN — for SOC compliance
50
118
  * ```
51
119
  */
52
- send(req: ChannelSendRequest): Promise<ChannelSendResponse>;
120
+ query(q?: EvidenceQuery): Promise<EvidenceResponse>;
53
121
  /**
54
- * Receive data from a secure channel.
122
+ * Generate a proof certificate for a specific operation.
123
+ */
124
+ certificate(auditId: string): Promise<{
125
+ success: boolean;
126
+ certificate: {
127
+ audit_id: string;
128
+ proof_hash: string;
129
+ merkle_root: string;
130
+ timestamp: string;
131
+ algorithm: string;
132
+ };
133
+ }>;
134
+ /**
135
+ * Verify a receipt/proof hash.
136
+ */
137
+ verify(proofHash: string): Promise<{
138
+ success: boolean;
139
+ valid: boolean;
140
+ entry?: {
141
+ action: string;
142
+ field_name: string;
143
+ created_at: string;
144
+ };
145
+ }>;
146
+ }
147
+
148
+ declare class DeliverModule {
149
+ private http;
150
+ constructor(http: HttpClient);
151
+ /**
152
+ * Create a secure, self-destructing delivery.
153
+ *
154
+ * Use for: credit card numbers, passwords, API keys, PII.
155
+ * The recipient opens the link, sees the content ONCE, and it burns.
55
156
  *
56
157
  * @example
57
158
  * ```ts
58
- * // System A retrieves the data
59
- * const result = await nd.channel.receive({
60
- * token: ch.channel_token,
61
- * verificationCode: "123456",
159
+ * // Send a credit card number securely
160
+ * const d = await nd.deliver.send({
161
+ * content: "4111-1111-1111-1111",
162
+ * ttl: "1h",
163
+ * burn: true,
164
+ * maxViews: 1,
62
165
  * });
63
- * const card = JSON.parse(result.data);
166
+ * // Send d.delivery_url to the recipient
167
+ * // After they open it — gone forever
64
168
  * ```
65
169
  */
66
- receive(req: ChannelReceiveRequest): Promise<ChannelReceiveResponse>;
170
+ send(req: DeliverRequest): Promise<DeliverResponse>;
67
171
  /**
68
- * Verify a channel recipient with a code (out-of-band verification).
172
+ * Create an anonymous burn drop (no auth required on read side).
69
173
  */
70
- verify(token: string, code: string): Promise<{
174
+ burn(content: string, options?: {
175
+ ttlHours?: number;
176
+ burnAfterRead?: boolean;
177
+ availableAt?: string;
178
+ }): Promise<{
71
179
  success: boolean;
180
+ drop_id: string;
181
+ read_url: string;
182
+ expires_at: string;
72
183
  }>;
73
184
  /**
74
- * Get delivery proof (Merkle-based).
185
+ * Read a burn drop (self-destructs on read if configured).
75
186
  */
76
- proof(channelToken: string): Promise<{
187
+ read(dropId: string): Promise<{
77
188
  success: boolean;
78
- proof_hash: string;
79
- merkle_root: string;
80
- delivery_chain: string[];
189
+ content: string;
190
+ burned: boolean;
81
191
  }>;
82
192
  }
83
193
 
@@ -88,8 +198,10 @@ declare class WebhookModule {
88
198
  * Create a webhook channel.
89
199
  *
90
200
  * Returns an ingest_url — point your external system's webhook at it.
91
- * All payloads are encrypted with PBKDF2 → AES-256-GCM.
92
- * Only YOU can decrypt (using the returned secret).
201
+ * Every payload is sealed to the channel's X25519 public key (ndcb1, HPKE):
202
+ * NoData's database keeps only the public key and cannot open an event. Pass
203
+ * your own `recipient_pubkey` to keep the private key entirely on your side;
204
+ * otherwise it is derived from the returned secret (shown once, never stored).
93
205
  *
94
206
  * @example
95
207
  * ```ts
@@ -129,156 +241,890 @@ declare class WebhookModule {
129
241
  }>;
130
242
  }
131
243
 
132
- declare class DeliverModule {
244
+ declare class ChannelModule {
133
245
  private http;
134
246
  constructor(http: HttpClient);
135
247
  /**
136
- * Create a secure, self-destructing delivery.
248
+ * Create a secure channel for data transfer.
137
249
  *
138
- * Use for: credit card numbers, passwords, API keys, PII.
139
- * The recipient opens the link, sees the content ONCE, and it burns.
250
+ * Returns a channel_token that the sender uses, and optionally
251
+ * a verification_code for the receiver.
140
252
  *
141
253
  * @example
142
254
  * ```ts
143
- * // Send a credit card number securely
144
- * const d = await nd.deliver.send({
145
- * content: "4111-1111-1111-1111",
146
- * ttl: "1h",
147
- * burn: true,
148
- * maxViews: 1,
255
+ * // System A creates a channel
256
+ * const ch = await nd.channel.create({ ttl: "1h", requireVerification: true });
257
+ * // Send ch.channel_token to System B (the sender)
258
+ * // Send ch.verification_code to the receiver (out-of-band)
259
+ * ```
260
+ */
261
+ create(req?: ChannelCreateRequest): Promise<ChannelCreateResponse>;
262
+ /**
263
+ * Send data through a secure channel.
264
+ * Data is encrypted in transit — the server never sees plaintext.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * // System B sends credit card data to System A
269
+ * await nd.channel.send({
270
+ * token: ch.channel_token,
271
+ * data: { card: "4111111111111111", cvv: "123" },
272
+ * burnAfterRead: true,
149
273
  * });
150
- * // Send d.delivery_url to the recipient
151
- * // After they open it — gone forever
152
274
  * ```
153
275
  */
154
- send(req: DeliverRequest): Promise<DeliverResponse>;
276
+ send(req: ChannelSendRequest): Promise<ChannelSendResponse>;
155
277
  /**
156
- * Create an anonymous burn drop (no auth required on read side).
278
+ * Receive data from a secure channel.
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * // System A retrieves the data
283
+ * const result = await nd.channel.receive({
284
+ * token: ch.channel_token,
285
+ * verificationCode: "123456",
286
+ * });
287
+ * const card = JSON.parse(result.data);
288
+ * ```
157
289
  */
158
- burn(content: string, options?: {
159
- ttlHours?: number;
160
- burnAfterRead?: boolean;
161
- availableAt?: string;
162
- }): Promise<{
290
+ receive(req: ChannelReceiveRequest): Promise<ChannelReceiveResponse>;
291
+ /**
292
+ * Verify a channel recipient with a code (out-of-band verification).
293
+ */
294
+ verify(token: string, code: string): Promise<{
163
295
  success: boolean;
164
- drop_id: string;
165
- read_url: string;
166
- expires_at: string;
167
296
  }>;
168
297
  /**
169
- * Read a burn drop (self-destructs on read if configured).
298
+ * Get delivery proof (Merkle-based).
170
299
  */
171
- read(dropId: string): Promise<{
300
+ proof(channelToken: string): Promise<{
172
301
  success: boolean;
173
- content: string;
174
- burned: boolean;
302
+ proof_hash: string;
303
+ merkle_root: string;
304
+ delivery_chain: string[];
175
305
  }>;
176
306
  }
177
307
 
178
- declare class EvidenceModule {
308
+ type CapsuleKeyMode = 'server' | 'zk';
309
+ type CapsuleStatus = 'active' | 'frozen' | 'revoked';
310
+ type PortableMode = 'controlled' | 'standalone' | 'both';
311
+ interface CapsuleSummary {
312
+ capsule_id: string;
313
+ slug: string;
314
+ status: CapsuleStatus;
315
+ key_mode: CapsuleKeyMode;
316
+ display_name: string | null;
317
+ document_count: number;
318
+ member_count: number;
319
+ portable_mode: PortableMode;
320
+ created_at: string;
321
+ }
322
+ interface CreateCapsuleRequest {
323
+ /** Tenant-scoped opaque handle, /^[a-z0-9-]{3,64}$/, e.g. "case-4471". */
324
+ handle: string;
325
+ /** Label for your UI (not PII-safe to rely on; real contact is hashed). */
326
+ display_name?: string;
327
+ /** 'server' (default, managed keys) or 'zk' (you hold the capsule private key). */
328
+ key_mode?: CapsuleKeyMode;
329
+ /** Required when key_mode='zk': base64url X25519 public key. */
330
+ capsule_pubkey?: string;
331
+ portable_mode?: PortableMode;
332
+ /** Hashed server-side into email_hash; the plaintext never reaches storage. */
333
+ email?: string;
334
+ phone?: string;
335
+ }
336
+ interface ListCapsulesResponse {
337
+ ok: boolean;
338
+ capsules: CapsuleSummary[];
339
+ }
340
+ interface DocumentSection {
341
+ id?: string;
342
+ label: string;
343
+ /** public | internal | restricted | confidential | attorney_client | field:<col> | structure */
344
+ classification: string;
345
+ /** The section body. Encrypted at seal time; the server never stores plaintext. */
346
+ text: string;
347
+ }
348
+ interface DocumentRecipient {
349
+ email: string;
350
+ classifications: string[];
351
+ /** Optional owner-chosen passphrase that opens ONLY this recipient's classifications. */
352
+ code?: string;
353
+ }
354
+ interface AddDocumentRequest {
355
+ title?: string;
356
+ /** Convenience: a single-section document. Ignored when `sections` is provided. */
357
+ content?: string;
358
+ classification?: string;
359
+ /** Full multi-section document (a key per recipient via `recipients`). */
360
+ sections?: DocumentSection[];
361
+ recipients?: DocumentRecipient[];
362
+ /** Use the tenant zero-knowledge path (existing behavior; per-capsule zk is Phase 1). */
363
+ zero_knowledge?: boolean;
364
+ }
365
+ interface AddDocumentResponse {
366
+ ok: boolean;
367
+ capsule_id: string;
368
+ lockbox_id: string;
369
+ sections_count: number;
370
+ classifications: string[];
371
+ recipients_saved: number;
372
+ recipient_codes: Array<{
373
+ email: string;
374
+ classifications: string[];
375
+ code: string;
376
+ }>;
377
+ recipient_url: string;
378
+ bearer_token: string;
379
+ activation_code: string;
380
+ }
381
+ interface DocumentSummary {
382
+ lockbox_id: string;
383
+ title: string | null;
384
+ status: string;
385
+ issued_at: string;
386
+ recipient_count: number;
387
+ }
388
+ interface ListDocumentsResponse {
389
+ ok: boolean;
390
+ capsule_id: string;
391
+ documents: DocumentSummary[];
392
+ }
393
+ /** Document sub-resource on a capsule handle. */
394
+ declare class CapsuleDocuments {
395
+ private http;
396
+ private ref;
397
+ constructor(http: HttpClient, ref: string);
398
+ /**
399
+ * Seal a document into the capsule.
400
+ * @example
401
+ * ```ts
402
+ * await cap.documents.add({ title: 'Policy', content: '…', classification: 'confidential' });
403
+ * // or multi-section, a key per recipient:
404
+ * await cap.documents.add({ title: 'Case', sections: [...], recipients: [{ email, classifications, code }] });
405
+ * ```
406
+ */
407
+ add(req: AddDocumentRequest): Promise<AddDocumentResponse>;
408
+ /**
409
+ * List the capsule's documents (metadata only). The bearer is returned ONCE by
410
+ * `add` and never stored — to build a portable file for a document, use that
411
+ * bearer with the /api/lockbox-container/portable route (controlled) or the
412
+ * /portable client flow (standalone). Both are per-document.
413
+ */
414
+ list(): Promise<ListDocumentsResponse>;
415
+ }
416
+ interface CapsuleMember {
417
+ email: string;
418
+ classifications: string[];
419
+ has_code: boolean;
420
+ in_conversation: boolean;
421
+ }
422
+ interface AddMemberRequest {
423
+ email: string;
424
+ classifications: string[];
425
+ /** Optional owner-chosen passphrase that opens ONLY this member's classifications. */
426
+ code?: string;
427
+ /** Also provision (lazily) the member's conversation rooms. */
428
+ add_to_conversation?: boolean;
429
+ }
430
+ interface AddMemberResponse {
431
+ ok: boolean;
432
+ capsule_id: string;
433
+ member: CapsuleMember;
434
+ recipient_code?: string;
435
+ }
436
+ interface ListMembersResponse {
437
+ ok: boolean;
438
+ capsule_id: string;
439
+ members: CapsuleMember[];
440
+ }
441
+ /** Member sub-resource on a capsule handle. */
442
+ declare class CapsuleMembers {
443
+ private http;
444
+ private ref;
445
+ constructor(http: HttpClient, ref: string);
446
+ /** Grant a member access across the capsule's documents (+ optional conversation). */
447
+ add(req: AddMemberRequest): Promise<AddMemberResponse>;
448
+ /** The unified roster (document ACL ∪ conversation membership). */
449
+ list(): Promise<ListMembersResponse>;
450
+ }
451
+ interface CapsuleOpen {
452
+ lockbox_file_id: string;
453
+ device_fp: string | null;
454
+ ip_hash: string | null;
455
+ result: string;
456
+ receipt_id: string | null;
457
+ observed_at: string;
458
+ }
459
+ interface CapsuleReceipt {
460
+ id: string;
461
+ chain_index: number | null;
462
+ event_type: string;
463
+ event_hash: string | null;
464
+ chain_hmac: string | null;
465
+ created_at: string;
466
+ payload: Record<string, unknown> | null;
467
+ }
468
+ interface CapsuleAuditResponse {
469
+ ok: boolean;
470
+ capsule_id: string;
471
+ documents: number;
472
+ counts: {
473
+ opens: number;
474
+ receipts: number;
475
+ denied: number;
476
+ };
477
+ opens: CapsuleOpen[];
478
+ receipts: CapsuleReceipt[];
479
+ verification: string;
480
+ }
481
+ /** Audit sub-resource on a capsule handle. */
482
+ declare class CapsuleAudit {
483
+ private http;
484
+ private ref;
485
+ constructor(http: HttpClient, ref: string);
486
+ /** The signed audit ledger: access log (who/when/device) + chain-linked receipts. */
487
+ get(opts?: {
488
+ from?: string;
489
+ to?: string;
490
+ limit?: number;
491
+ }): Promise<CapsuleAuditResponse>;
492
+ }
493
+ interface RevokeCapsuleResponse {
494
+ ok: boolean;
495
+ capsule_id: string;
496
+ status: 'revoked';
497
+ revoked_documents: string[];
498
+ sessions_revoked: number;
499
+ receipt_id: string | null;
500
+ key_kid_blocked: boolean;
501
+ customer_frozen: boolean;
502
+ capsule_marked: boolean;
503
+ }
504
+ interface CapsuleAiGrant {
505
+ agent_id: string;
506
+ agent_name: string;
507
+ allowed_classifications: string[];
508
+ denied_classifications: string[];
509
+ documents: number;
510
+ }
511
+ interface GrantAiResponse extends CapsuleAiGrant {
512
+ ok: boolean;
513
+ capsule_id: string;
514
+ }
515
+ interface ListAiGrantsResponse {
516
+ ok: boolean;
517
+ capsule_id: string;
518
+ agents: CapsuleAiGrant[];
519
+ }
520
+ interface RevokeAiGrantResponse {
521
+ ok: boolean;
522
+ capsule_id: string;
523
+ agent_id: string;
524
+ revoked_documents: string[];
525
+ }
526
+ interface AiReadSection {
527
+ label: string;
528
+ classification: string;
529
+ text: string;
530
+ }
531
+ interface AiReadDocument {
532
+ lockbox_id: string;
533
+ title: string | null;
534
+ key_mode: 'managed' | 'zero_knowledge';
535
+ /** Only the agent's ALLOWED classifications appear; denied sections never decrypt. */
536
+ sections: AiReadSection[];
537
+ note?: string;
538
+ }
539
+ interface AiReadResponse {
540
+ ok: boolean;
541
+ capsule_id: string;
542
+ agent_id: string;
543
+ allowed_classifications: string[];
544
+ documents: AiReadDocument[];
545
+ }
546
+ /**
547
+ * AI-governance sub-resource: grant a scoped agent, then let it read ONLY its
548
+ * allowed classifications (denied sections never decrypt — deny-by-default),
549
+ * with every read audited as an AI access.
550
+ * @example
551
+ * ```ts
552
+ * const g = await cap.ai.grant({ agent_name: 'claims-bot', classifications: ['public'] });
553
+ * const read = await cap.ai.read({ agent_id: g.agent_id }); // only 'public' sections come back
554
+ * await cap.ai.revoke(g.agent_id);
555
+ * ```
556
+ */
557
+ declare class CapsuleAi {
558
+ private http;
559
+ private ref;
560
+ constructor(http: HttpClient, ref: string);
561
+ /** Grant a named agent scoped classification access. Returns its agent_id. */
562
+ grant(req: {
563
+ agent_name: string;
564
+ classifications: string[];
565
+ }): Promise<GrantAiResponse>;
566
+ /** Live agent grants: who is allowed which classifications (and denied which). */
567
+ list(): Promise<ListAiGrantsResponse>;
568
+ /** Revoke an agent across the whole capsule. */
569
+ revoke(agentId: string): Promise<RevokeAiGrantResponse>;
570
+ /** The AI READ loop: the agent gets back ONLY its allowed classifications. */
571
+ read(req: {
572
+ agent_id: string;
573
+ document_id?: string;
574
+ }): Promise<AiReadResponse>;
575
+ }
576
+ interface EmbedTokenRequest {
577
+ /** A document bearer returned by documents.add (must belong to this capsule). */
578
+ bearer: string;
579
+ /** The EXACT https origin allowed to frame it, e.g. https://portal.myfirm.com. */
580
+ allowed_origin: string;
581
+ /** Token lifetime; default 3600s, max 30 days. */
582
+ ttl_seconds?: number;
583
+ }
584
+ interface EmbedTokenResponse {
585
+ ok: boolean;
586
+ capsule_id: string;
587
+ embed_token: string;
588
+ /** Point an <iframe> at this; the raw bearer never leaves NoData's origin. */
589
+ embed_url: string;
590
+ allowed_origin: string;
591
+ expires_at: string;
592
+ }
593
+ /** A live handle to one capsule — its summary plus chainable sub-resources. */
594
+ declare class Capsule {
595
+ private http;
596
+ readonly summary: CapsuleSummary;
597
+ readonly documents: CapsuleDocuments;
598
+ readonly members: CapsuleMembers;
599
+ readonly audit: CapsuleAudit;
600
+ readonly ai: CapsuleAi;
601
+ constructor(http: HttpClient, summary: CapsuleSummary);
602
+ get id(): string;
603
+ get slug(): string;
604
+ get status(): CapsuleStatus;
605
+ /**
606
+ * Mint an origin-bound embed token for one of this capsule's documents, so you
607
+ * can frame the white-label viewer on your own site. The raw bearer stays on
608
+ * NoData's origin — the token encrypts it.
609
+ */
610
+ embed(req: EmbedTokenRequest): Promise<EmbedTokenResponse>;
611
+ /** Kill-switch: block the key, freeze the customer + sessions, revoke every doc. */
612
+ revoke(opts?: {
613
+ reason?: string;
614
+ }): Promise<RevokeCapsuleResponse>;
615
+ }
616
+ declare class CapsuleModule {
179
617
  private http;
180
618
  constructor(http: HttpClient);
181
619
  /**
182
- * Query the audit trail.
183
- * Returns metadata only — never content.
184
- *
620
+ * Mint a customer capsule (a vault is born). Returns a Capsule handle.
185
621
  * @example
186
622
  * ```ts
187
- * const trail = await nd.evidence.query({
188
- * field: "credit_card",
189
- * action: "decrypt",
190
- * from: "2026-03-01",
191
- * to: "2026-03-27",
192
- * });
193
- * // Shows WHO decrypted WHAT field WHEN — for SOC compliance
623
+ * const cap = await nd.capsules.create({ handle: 'case-4471', display_name: 'Yossi Levy' });
194
624
  * ```
195
625
  */
196
- query(q?: EvidenceQuery): Promise<EvidenceResponse>;
626
+ create(req: CreateCapsuleRequest): Promise<Capsule>;
627
+ /** Fetch a capsule handle by slug or id. */
628
+ get(idOrSlug: string): Promise<Capsule>;
629
+ /** List this org's active capsules (newest first). */
630
+ list(opts?: {
631
+ limit?: number;
632
+ }): Promise<ListCapsulesResponse>;
197
633
  /**
198
- * Generate a proof certificate for a specific operation.
634
+ * Fleet aggregates for the Control Plane — you manage a fleet, not a capsule:
635
+ * active/frozen/revoked vaults, documents, 24h activity, and AI governance totals.
199
636
  */
200
- certificate(auditId: string): Promise<{
201
- success: boolean;
202
- certificate: {
203
- audit_id: string;
204
- proof_hash: string;
205
- merkle_root: string;
206
- timestamp: string;
207
- algorithm: string;
208
- };
637
+ overview(): Promise<OverviewResponse>;
638
+ }
639
+ interface OverviewResponse {
640
+ ok: boolean;
641
+ org_id: string;
642
+ fleet: {
643
+ active_vaults: number;
644
+ frozen_vaults: number;
645
+ revoked_vaults: number;
646
+ total_documents: number;
647
+ };
648
+ activity_24h: {
649
+ opens: number;
650
+ denied: number;
651
+ };
652
+ lifetime: {
653
+ access_decisions: number;
654
+ ai_requests: number;
655
+ revocations: number;
656
+ };
657
+ ai_governance: {
658
+ agents: number;
659
+ grants_active: number;
660
+ };
661
+ }
662
+
663
+ interface CreateTenantRequest {
664
+ company_name: string;
665
+ /** /^[a-z0-9-]{3,64}$/ — unique across NoData. */
666
+ slug: string;
667
+ tier?: string;
668
+ currency?: string;
669
+ contact_email?: string;
670
+ master_key_location?: 'cloud_vault' | 'on_prem' | 'hybrid';
671
+ pii_storage_mode?: 'cloud_vault' | 'on_prem' | 'hybrid';
672
+ /** If true, mint a Capsule install token in the same call. */
673
+ capsule_install?: boolean;
674
+ }
675
+ interface CreateTenantResponse {
676
+ ok: boolean;
677
+ tenant_id: string;
678
+ tenant_console_url: string;
679
+ m365_install_url: string;
680
+ capsule_install_token: string | null;
681
+ capsule_install_token_expires_at: string | null;
682
+ receipt_id: string | null;
683
+ }
684
+ interface TenantState {
685
+ tenant: {
686
+ id: string;
687
+ name: string;
688
+ slug: string;
689
+ tier: string;
690
+ active: boolean;
691
+ kill_switch_state: string;
692
+ master_key_location: string;
693
+ pii_storage_mode: string;
694
+ created_at: string;
695
+ };
696
+ m365: {
697
+ status: string;
698
+ consent_granted_at: string | null;
699
+ } | null;
700
+ capsule: {
701
+ deployments: Array<Record<string, unknown>>;
702
+ last_scan_at: string | null;
703
+ open_findings_count: number;
704
+ };
705
+ }
706
+ declare class TenantModule {
707
+ private http;
708
+ constructor(http: HttpClient);
709
+ /**
710
+ * Provision a tenant (a whole org) programmatically. Requires a key with the
711
+ * `partner.provision_tenants` scope.
712
+ * @example
713
+ * ```ts
714
+ * const t = await nd.tenants.create({ company_name: 'Acme', slug: 'acme', capsule_install: true });
715
+ * ```
716
+ */
717
+ create(req: CreateTenantRequest): Promise<CreateTenantResponse>;
718
+ /** Read a tenant's state (M365 connection, capsule deployments, open findings). */
719
+ get(tenantId: string): Promise<TenantState>;
720
+ }
721
+
722
+ type ScanSource = 'folder' | 'drive' | 'db' | 's3';
723
+ interface EnableScanRequest {
724
+ /** Where to scan — all scanning happens locally on the agent's machine. */
725
+ source: ScanSource;
726
+ /** Local folder path (source='folder'). */
727
+ path?: string;
728
+ /** Drive folder id (source='drive'). */
729
+ folder_id?: string;
730
+ /** How to group documents into customer capsules (e.g. 'folder' = one per folder). */
731
+ per_customer?: string;
732
+ /** Override the agent's API base (defaults to the SDK baseUrl). */
733
+ api_base?: string;
734
+ }
735
+ interface EnableScanResponse {
736
+ ok: boolean;
737
+ /** Opaque scan handle (prefix of the install token). */
738
+ scan_id: string;
739
+ /** One-shot install token — shown once; enrol the agent with it. */
740
+ install_token: string;
741
+ /** Copy-paste command to run the LOCAL scan agent. */
742
+ install_command: string;
743
+ /** When the install token expires. */
744
+ expires_at: string | null;
745
+ }
746
+ interface ScanDeployment {
747
+ id: string;
748
+ status: string;
749
+ last_seen_at: string | null;
750
+ last_scan_at: string | null;
751
+ agent_version: string;
752
+ }
753
+ interface ScanStatus {
754
+ deployments: ScanDeployment[];
755
+ last_scan_at: string | null;
756
+ /** Content-free: how many sensitive-field findings the local scan surfaced. */
757
+ open_findings_count: number;
758
+ }
759
+ /**
760
+ * nd.scan — populate capsules from a LOCAL, content-blind scan.
761
+ * @example
762
+ * ```ts
763
+ * const scan = await nd.scan.enable({ source: 'folder', path: './customers', per_customer: 'folder' });
764
+ * console.log(scan.install_command); // run this — the agent scans locally, no data leaves
765
+ * const status = await nd.scan.status();
766
+ * ```
767
+ */
768
+ declare class ScanModule {
769
+ private http;
770
+ constructor(http: HttpClient);
771
+ private orgId;
772
+ /**
773
+ * Enable a LOCAL scan agent over your data. Mints a one-shot install token and
774
+ * returns the command to run the agent — which generates its own keys locally,
775
+ * scans with deterministic code (no LLM), and reports content-free findings.
776
+ * Nothing (data or keys) leaves your machine.
777
+ */
778
+ enable(req: EnableScanRequest): Promise<EnableScanResponse>;
779
+ /** Poll the local agent's status + how many content-free findings it surfaced. */
780
+ status(): Promise<ScanStatus>;
781
+ /**
782
+ * The local scan's content-free conclusions: per finding, the source/field, its
783
+ * kind/severity, and a RECOMMENDED classification (never a value). You approve
784
+ * these before anything is sealed — the capsule only recommends.
785
+ */
786
+ findings(opts?: {
787
+ limit?: number;
788
+ all?: boolean;
789
+ }): Promise<ScanFindingsResponse>;
790
+ /**
791
+ * Adopt the recommendations for the given findings — the legal record that you
792
+ * (not the machine) chose each policy. Writes a content-free signed receipt.
793
+ * Nothing is sealed here; dispatch approved files with `execute`.
794
+ */
795
+ approve(findingIds: string[]): Promise<{
796
+ ok: boolean;
797
+ approved: number;
798
+ receipt_id: string | null;
209
799
  }>;
210
800
  /**
211
- * Verify a receipt/proof hash.
801
+ * Dispatch APPROVED files for sealing — queues each file for the local agent to
802
+ * seal into its capsule with the approved classification. Only findings you've
803
+ * already approved can be dispatched.
212
804
  */
213
- verify(proofHash: string): Promise<{
214
- success: boolean;
215
- valid: boolean;
216
- entry?: {
217
- action: string;
218
- field_name: string;
219
- created_at: string;
220
- };
805
+ execute(findingIds: string[]): Promise<{
806
+ ok: boolean;
807
+ dispatched: number;
808
+ files: Array<{
809
+ target_id: string;
810
+ label: string | null;
811
+ path: string | null;
812
+ }>;
221
813
  }>;
222
814
  }
815
+ interface ScanFinding {
816
+ id: string;
817
+ source: string | null;
818
+ field: string | null;
819
+ kind: string | null;
820
+ subkind: string | null;
821
+ severity: string | null;
822
+ count: number;
823
+ /** Suggested classification — you approve or override it. */
824
+ recommended: string;
825
+ reason: string;
826
+ approved: boolean;
827
+ target_id: string | null;
828
+ first_seen_at: string | null;
829
+ }
830
+ interface ScanFindingsResponse {
831
+ ok: boolean;
832
+ count: number;
833
+ findings: ScanFinding[];
834
+ }
223
835
 
224
- declare class VaultModule {
836
+ declare class EncryptModule {
225
837
  private http;
226
838
  constructor(http: HttpClient);
227
839
  /**
228
- * Store an encrypted blob in the vault.
229
- * YOU encrypt client-side. Server stores blindly.
840
+ * Encrypt a single field value.
841
+ * Server encrypts with AES-256-GCM and returns ciphertext + key material.
842
+ * Store the result in YOUR database — NoData stores nothing.
843
+ */
844
+ encrypt(req: EncryptRequest): Promise<EncryptResponse>;
845
+ /**
846
+ * Decrypt a single field value.
847
+ * Requires the ciphertext that was returned from encrypt().
848
+ */
849
+ decrypt(req: DecryptRequest): Promise<DecryptResponse>;
850
+ /**
851
+ * Encrypt multiple fields in parallel.
852
+ * Failed fields don't block successful ones.
853
+ */
854
+ batchEncrypt(fields: EncryptRequest[], context?: string): Promise<BatchResult<EncryptResponse>>;
855
+ /**
856
+ * Decrypt multiple fields in parallel.
857
+ */
858
+ batchDecrypt(fields: DecryptRequest[], requester?: string): Promise<BatchResult<DecryptResponse>>;
859
+ /**
860
+ * Native batch — single HTTP call for up to 100 encrypt/decrypt operations.
861
+ * More efficient than batchEncrypt/batchDecrypt for large batches.
862
+ */
863
+ batchNative(items: Array<{
864
+ op: 'encrypt';
865
+ field: string;
866
+ value: string;
867
+ } | {
868
+ op: 'decrypt';
869
+ field: string;
870
+ ciphertext: string;
871
+ }>, context?: string): Promise<{
872
+ success: boolean;
873
+ batch_id: string;
874
+ results: Array<{
875
+ op: string;
876
+ field: string;
877
+ success: boolean;
878
+ ciphertext?: string;
879
+ value?: string;
880
+ audit_id?: string;
881
+ error?: string;
882
+ }>;
883
+ ok: number;
884
+ failed: number;
885
+ }>;
886
+ /**
887
+ * Encrypt all matching fields in a plain object.
888
+ * Walks nested objects and arrays.
230
889
  *
231
890
  * @example
232
891
  * ```ts
233
- * // Encrypt client-side, then store
234
- * const blob = myEncrypt(sensitiveData, myKey);
235
- * const vault = await nd.vault.create({
236
- * label: "customer-contracts",
237
- * encrypted_blob: blob.ciphertext,
238
- * iv: blob.iv,
239
- * metadata: { customer_id: "cust_123" },
240
- * });
892
+ * const encrypted = await nd.encryptObject(
893
+ * { name: "David", phone: "0501234567", email: "d@x.com", age: 30 },
894
+ * ["phone", "email"]
895
+ * );
896
+ * // → { name: "David", phone: "aes256gcm:v1:...", email: "aes256gcm:v1:...", age: 30 }
241
897
  * ```
242
898
  */
243
- create(req: VaultCreateRequest): Promise<VaultCreateResponse>;
899
+ encryptObject(obj: Record<string, unknown>, fields: string[], context?: string): Promise<Record<string, unknown>>;
244
900
  /**
245
- * Retrieve an encrypted blob from the vault.
246
- * YOU decrypt client-side.
901
+ * Decrypt all matching fields in an encrypted object.
247
902
  */
248
- read(vaultId: string): Promise<VaultReadResponse>;
903
+ decryptObject(obj: Record<string, unknown>, fields: string[], requester?: string): Promise<Record<string, unknown>>;
904
+ private processObject;
905
+ }
906
+
907
+ /** The platform engines, namespaced away from the Customer Vault surface. */
908
+ declare class EnginesModule {
909
+ /** Governance Engine — AI/data permission management (register data, grant, revoke). Runs on Excel/DB/CRM/Agent, not only capsules. */
910
+ readonly governance: GovernanceModule;
911
+ /** Blind Relay Engine — field-level encrypt / decrypt / batch (server stores nothing). */
912
+ readonly blindRelay: EncryptModule;
913
+ /** Channel Engine — system-to-system encrypted transfer. */
914
+ readonly channel: ChannelModule;
915
+ /** Delivery — burn-after-read secure delivery. */
916
+ readonly deliver: DeliverModule;
917
+ /** Evidence — audit trail + cryptographic proofs. */
918
+ readonly evidence: EvidenceModule;
919
+ /** Vault — zero-knowledge encrypted storage. */
920
+ readonly vault: VaultModule;
921
+ /** Webhooks — receive external webhooks through encrypted channels. */
922
+ readonly webhook: WebhookModule;
923
+ constructor(http: HttpClient);
924
+ }
925
+
926
+ type FieldValue = string | number | boolean | null;
927
+
928
+ interface Partner {
929
+ /** The partner's Fabric address: where commands to them are sealed and sent. */
930
+ kid: string;
931
+ /** The organisation's name, when the connection was born of an invitation. */
932
+ name: string | null;
933
+ }
934
+ interface Invitation {
935
+ /** Send this link to the partner. It works once, until expiresAt. */
936
+ url: string;
937
+ expiresAt: string | null;
938
+ /** Days the connection lasts once accepted. */
939
+ grantDays: number | null;
940
+ }
941
+ interface Sent {
942
+ /** The relay envelope id: the server's receipt is filed under it. */
943
+ id: string;
944
+ /** The command's own id; a reply names it in replyTo. */
945
+ commandId: string;
946
+ to: string;
947
+ }
948
+ interface Message {
949
+ relayId: string;
950
+ /** The sender's address, as the relay attributes it (not a sender signature); reply() and send() take it. */
951
+ from: string;
952
+ /** The sender's organisation, as the server attributes it (null when unknown). Not a sender signature. */
953
+ fromOrg: string | null;
954
+ status: 'accepted' | 'refused' | 'unopened';
955
+ /** Why a message was refused or not opened. */
956
+ reason?: string;
957
+ cmd?: string;
958
+ fields?: Record<string, FieldValue>;
959
+ /** The command id this one answers, if it is a reply. */
960
+ replyTo?: string | null;
961
+ commandId?: string;
962
+ issuedAt?: string;
963
+ /** What was checked here, after opening. */
964
+ verified: {
965
+ /** sha256 of what was opened equals the commitment the sender filed at send time. null: none filed. */
966
+ committed: boolean | null;
967
+ /** The relay receipt is signed by a pinned NoData key (PINNED_RECEIPT_KEYS). null: no receipt on this envelope. */
968
+ receiptSignature: boolean | null;
969
+ };
970
+ }
971
+ /** A held request: a person must approve it in the browser before it goes through. The SDK never approves. */
972
+ declare class FabricApprovalRequired extends NoDataError {
973
+ approveUrl: string | null;
974
+ approvalId: string | null;
975
+ orgApprovalId: string | null;
976
+ constructor(approveUrl: string | null, approvalId: string | null, orgApprovalId: string | null, message: string);
977
+ }
978
+ /** A fresh Fabric secret (32 bytes, hex). Keep it like a password: whoever holds it opens what is sent to you. */
979
+ declare function newFabricSecret(): string;
980
+ declare class FabricModule {
981
+ private http;
982
+ constructor(http: HttpClient);
983
+ /** A fresh Fabric secret (32 bytes, hex), to store and pass to open(). */
984
+ newSecret(): string;
249
985
  /**
250
- * Delete a vault entry (irreversible).
986
+ * Your Fabric address for this API key. Posts only the public half of the
987
+ * secret (an address already enrolled is kept, same key same address). Without
988
+ * a secret one is made: store `fabric.secret`, or messages sent to this address
989
+ * cannot be opened later.
990
+ *
991
+ * A different key for an API key that already has an address replaces it. The
992
+ * server refuses that (409) while mail waits at the old address, since no key
993
+ * would open it again; `replace: true` says you mean it (a throwaway key in CI).
994
+ * The replacement is receipted like any enroll.
251
995
  */
252
- delete(vaultId: string): Promise<{
253
- success: boolean;
254
- }>;
996
+ open(opts?: {
997
+ secret?: string;
998
+ trustedReceiptKeys?: readonly string[];
999
+ replace?: boolean;
1000
+ }): Promise<Fabric>;
1001
+ }
1002
+ declare class Fabric {
1003
+ private http;
1004
+ readonly secret: string;
1005
+ readonly address: string;
1006
+ private trustedReceiptKeys;
1007
+ constructor(http: HttpClient, secret: string, address: string, trustedReceiptKeys?: readonly string[]);
1008
+ /** An invitation for a partner organisation. Accepting it connects both ways (your address is in it). */
1009
+ invite(opts?: {
1010
+ note?: string;
1011
+ days?: number;
1012
+ approvalId?: string;
1013
+ orgApprovalId?: string;
1014
+ }): Promise<Invitation>;
1015
+ /** Accept a partner's invitation (the link or its token). Both ways unless oneWay. */
1016
+ accept(invitation: string, opts?: {
1017
+ oneWay?: boolean;
1018
+ termsAccepted?: boolean;
1019
+ approvalId?: string;
1020
+ orgApprovalId?: string;
1021
+ }): Promise<Partner>;
1022
+ /** Everyone this address is connected with, both directions, live grants only. */
1023
+ partners(): Promise<Partner[]>;
255
1024
  /**
256
- * Check vault service status.
1025
+ * Seal a command to a partner and send it. `to` is a Partner, an address, or a
1026
+ * partner's name. Fields are flat (string, number, boolean, null): a command is
1027
+ * information, not a document.
257
1028
  */
258
- status(): Promise<{
259
- success: boolean;
260
- vault_count: number;
261
- storage_used_bytes: number;
1029
+ send(to: Partner | string, cmd: string, fields?: Record<string, FieldValue>, opts?: {
1030
+ replyTo?: string | null;
1031
+ ttlHours?: number;
1032
+ opens?: number;
1033
+ }): Promise<Sent>;
1034
+ /** Answer a message: the reply names the command it answers. */
1035
+ reply(message: Message, cmd: string, fields?: Record<string, FieldValue>): Promise<Sent>;
1036
+ /**
1037
+ * Open the commands waiting for this address and check each one here: its shape,
1038
+ * the sender's commitment and the server's signed receipt. `accept` is your rule:
1039
+ * a command not on it comes back refused, its fields not returned.
1040
+ */
1041
+ inbox(opts?: {
1042
+ accept?: string[];
1043
+ }): Promise<Message[]>;
1044
+ /**
1045
+ * End the connection with a partner, both directions this side holds: a grant
1046
+ * we gave is revoked, a grant they gave us is left. Narrowing only; receipted on
1047
+ * both sides. Connecting again takes a new invitation.
1048
+ */
1049
+ disconnect(partner: Partner | string): Promise<{
1050
+ ended: number;
262
1051
  }>;
1052
+ private addressOf;
1053
+ }
1054
+
1055
+ declare class ComputeEngine {
1056
+ private http;
1057
+ constructor(http: HttpClient);
1058
+ /** Run the primitive: information + intent → { decision, answer, authorized view, proof }. */
1059
+ run(req: ComputeRequest): Promise<ComputeDecision>;
1060
+ /** Prove verb: given a decision proof id, confirm it is authentic + unaltered. */
1061
+ verify(proofId: string): Promise<VerifyResult>;
263
1062
  }
264
1063
 
265
1064
  declare class NoData {
266
1065
  private http;
267
1066
  private _encrypt;
268
- /** Secure channels — system-to-system encrypted transfer */
269
- channel: ChannelModule;
270
- /** Webhooks — receive external webhooks through encrypted channels */
271
- webhook: WebhookModule;
272
- /** Delivery — burn-after-read secure delivery */
273
- deliver: DeliverModule;
274
- /** Evidence — audit trail + cryptographic proofs */
275
- evidence: EvidenceModule;
276
- /** Vault — zero-knowledge encrypted storage */
277
- vault: VaultModule;
1067
+ /** Capsules — an isolated customer workspace (documents + members + AI grants + audit) as an API. */
1068
+ capsules: CapsuleModule;
1069
+ /** Tenants — provision a whole organization programmatically. */
1070
+ tenants: TenantModule;
1071
+ /** Scan — enable a LOCAL, content-blind scan (no LLM) that populates capsules. You approve every policy. */
1072
+ scan: ScanModule;
1073
+ /** Fabric — connect to a partner organisation and exchange sealed commands: open, invite, accept, send, inbox. */
1074
+ fabric: FabricModule;
1075
+ /** Platform engines (governance, blind-relay, channel, delivery, evidence, vault, webhooks). Advanced / "Powered by". */
1076
+ engines: EnginesModule;
1077
+ private _compute;
278
1078
  constructor(config: NoDataConfig);
279
- /** Encrypt a single field (blind relay — server stores nothing) */
1079
+ /**
1080
+ * THE primitive. Hand NoData the information + the intent + the clearance;
1081
+ * get back the decision, the answer over ONLY the authorized slice, and a
1082
+ * signed proof.
1083
+ *
1084
+ * const { answer, proof } = await nd.compute({
1085
+ * question: 'What is the claim status?',
1086
+ * clearance: 'internal',
1087
+ * sections: [{ title: 'Status', text: '…' }, { title: 'Client', text: '…' }],
1088
+ * });
1089
+ */
1090
+ compute(req: ComputeRequest): Promise<ComputeDecision>;
1091
+ /** The Prove verb: confirm a decision proof is authentic + unaltered, without decrypting anything. */
1092
+ verify(proofId: string): Promise<VerifyResult>;
1093
+ /**
1094
+ * May this agent do this to this asset? Asked by your organization (API key),
1095
+ * for any of its agents. Returns the verdict, the full decision (what would be
1096
+ * released and what withheld, never any values) and a signed receipt.
1097
+ *
1098
+ * const decision = await nd.authorize({
1099
+ * subject: 'agent://analyst',
1100
+ * asset: 'finance_forecasts',
1101
+ * action: 'read',
1102
+ * });
1103
+ * decision.verdict; // 'allow' | 'partial' | 'deny'
1104
+ * decision.receipt; // the signed proof of this decision
1105
+ */
1106
+ authorize(req: AuthorizeRequest): Promise<AuthorizeResult>;
1107
+ /** @deprecated use `nd.engines.channel` */
1108
+ get channel(): ChannelModule;
1109
+ /** @deprecated use `nd.engines.webhook` */
1110
+ get webhook(): WebhookModule;
1111
+ /** @deprecated use `nd.engines.deliver` */
1112
+ get deliver(): DeliverModule;
1113
+ /** @deprecated use `nd.engines.evidence` */
1114
+ get evidence(): EvidenceModule;
1115
+ /** @deprecated use `nd.engines.vault` */
1116
+ get vault(): VaultModule;
1117
+ /** @deprecated use `nd.engines.governance` */
1118
+ get governance(): GovernanceModule;
1119
+ /**
1120
+ * Bind to an agent grant token to read governed data AS that agent.
1121
+ * Authenticates with the grant token (not your API key) — exactly what
1122
+ * an LLM/agent runtime holds. Denied columns never decrypt server-side.
1123
+ */
1124
+ agent(grantToken: string): AgentReader;
1125
+ /** @deprecated Blind-Relay is a platform engine — use `nd.engines.blindRelay.encrypt`. */
280
1126
  encrypt(req: EncryptRequest): Promise<EncryptResponse>;
281
- /** Decrypt a single field */
1127
+ /** @deprecated Blind-Relay is a platform engine — use `nd.engines.blindRelay.decrypt`. */
282
1128
  decrypt(req: DecryptRequest): Promise<DecryptResponse>;
283
1129
  /** Encrypt multiple fields in parallel */
284
1130
  batchEncrypt(fields: EncryptRequest[], context?: string): Promise<BatchResult<EncryptResponse>>;
@@ -319,4 +1165,36 @@ declare class NoData {
319
1165
  }>;
320
1166
  }
321
1167
 
322
- export { BatchResult, ChannelCreateRequest, ChannelCreateResponse, ChannelReceiveRequest, ChannelReceiveResponse, ChannelSendRequest, ChannelSendResponse, DecryptRequest, DecryptResponse, DeliverRequest, DeliverResponse, EncryptRequest, EncryptResponse, EvidenceQuery, EvidenceResponse, NoData, NoDataConfig, VaultCreateRequest, VaultCreateResponse, VaultReadResponse, WebhookChannelCreateRequest, WebhookChannelCreateResponse, WebhookEventsResponse };
1168
+ interface AuthorizeRequest {
1169
+ /** "agent://<handle>" or the bare handle of one of your agents. */
1170
+ subject: string;
1171
+ /** A table registered for your organization. */
1172
+ asset: string;
1173
+ /** Only "read" today. */
1174
+ action?: 'read';
1175
+ /** Columns to ask about; defaults to every registered column. */
1176
+ columns?: string[];
1177
+ }
1178
+ interface AuthorizeResult {
1179
+ verdict: 'allow' | 'partial' | 'deny';
1180
+ decision: {
1181
+ decision: 'allow' | 'degrade' | 'deny';
1182
+ reasons: string[];
1183
+ allowed: {
1184
+ columns: string[];
1185
+ filter: Record<string, unknown>;
1186
+ };
1187
+ withheld: {
1188
+ columns: string[];
1189
+ };
1190
+ };
1191
+ receipt: {
1192
+ receipt_id: string;
1193
+ chain_index: number;
1194
+ event_hash: string;
1195
+ proof_ref: string | null;
1196
+ } | null;
1197
+ proof_url: string | null;
1198
+ }
1199
+
1200
+ export { type AddDocumentRequest, type AddDocumentResponse, type AddMemberRequest, type AddMemberResponse, AgentReadRequest, AgentReadResponse, AgentReader, type AiReadDocument, type AiReadResponse, type AiReadSection, type AuthorizeRequest, type AuthorizeResult, BatchResult, Capsule, CapsuleAi, type CapsuleAiGrant, CapsuleAudit, type CapsuleAuditResponse, CapsuleDocuments, type CapsuleKeyMode, type CapsuleMember, CapsuleMembers, CapsuleModule, type CapsuleOpen, type CapsuleReceipt, type CapsuleStatus, type CapsuleSummary, ChannelCreateRequest, ChannelCreateResponse, ChannelReceiveRequest, ChannelReceiveResponse, ChannelSendRequest, ChannelSendResponse, ComputeDecision, ComputeEngine, ComputeRequest, type CreateCapsuleRequest, type CreateTenantRequest, type CreateTenantResponse, DecryptRequest, DecryptResponse, DeliverRequest, DeliverResponse, type DocumentRecipient, type DocumentSection, type DocumentSummary, type EmbedTokenRequest, type EmbedTokenResponse, type EnableScanRequest, type EnableScanResponse, EncryptRequest, EncryptResponse, EnginesModule, EvidenceQuery, EvidenceResponse, Fabric, FabricApprovalRequired, FabricModule, type FieldValue, GovernanceModule, type GrantAiResponse, GrantRequest, GrantResponse, type Invitation, type ListAiGrantsResponse, type ListCapsulesResponse, type ListDocumentsResponse, type ListMembersResponse, type Message, NoData, NoDataConfig, NoDataError, type OverviewResponse, type Partner, type PortableMode, RegisterTableRequest, RegisterTableResponse, type RevokeAiGrantResponse, type RevokeCapsuleResponse, RevokeRequest, RevokeResponse, type ScanDeployment, type ScanFinding, type ScanFindingsResponse, ScanModule, type ScanSource, type ScanStatus, type Sent, TenantModule, type TenantState, VaultCreateRequest, VaultCreateResponse, VaultReadResponse, VerifyResult, WebhookChannelCreateRequest, WebhookChannelCreateResponse, WebhookEventsResponse, newFabricSecret };