@nodatachat/sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +385 -0
- package/dist/chunk-V6GUTSNO.mjs +601 -0
- package/dist/index.d.mts +322 -0
- package/dist/index.d.ts +322 -0
- package/dist/index.js +628 -0
- package/dist/index.mjs +8 -0
- package/dist/plugins/express.d.mts +20 -0
- package/dist/plugins/express.d.ts +20 -0
- package/dist/plugins/express.js +663 -0
- package/dist/plugins/express.mjs +43 -0
- package/dist/plugins/fastify.d.mts +11 -0
- package/dist/plugins/fastify.d.ts +11 -0
- package/dist/plugins/fastify.js +667 -0
- package/dist/plugins/fastify.mjs +47 -0
- package/dist/types-DQh0UmSr.d.mts +233 -0
- package/dist/types-DQh0UmSr.d.ts +233 -0
- package/package.json +64 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
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';
|
|
3
|
+
|
|
4
|
+
declare class HttpClient {
|
|
5
|
+
private apiKey;
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private timeout;
|
|
8
|
+
private retries;
|
|
9
|
+
private customHeaders;
|
|
10
|
+
private onRequest?;
|
|
11
|
+
private onResponse?;
|
|
12
|
+
private onError?;
|
|
13
|
+
constructor(config: NoDataConfig);
|
|
14
|
+
request<T>(method: string, path: string, body?: unknown, query?: Record<string, string>): Promise<T>;
|
|
15
|
+
get<T>(path: string, query?: Record<string, string>): Promise<T>;
|
|
16
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
17
|
+
del<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class ChannelModule {
|
|
21
|
+
private http;
|
|
22
|
+
constructor(http: HttpClient);
|
|
23
|
+
/**
|
|
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.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```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)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
create(req?: ChannelCreateRequest): Promise<ChannelCreateResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Send data through a secure channel.
|
|
40
|
+
* Data is encrypted in transit — the server never sees plaintext.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```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,
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
send(req: ChannelSendRequest): Promise<ChannelSendResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Receive data from a secure channel.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* // System A retrieves the data
|
|
59
|
+
* const result = await nd.channel.receive({
|
|
60
|
+
* token: ch.channel_token,
|
|
61
|
+
* verificationCode: "123456",
|
|
62
|
+
* });
|
|
63
|
+
* const card = JSON.parse(result.data);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
receive(req: ChannelReceiveRequest): Promise<ChannelReceiveResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Verify a channel recipient with a code (out-of-band verification).
|
|
69
|
+
*/
|
|
70
|
+
verify(token: string, code: string): Promise<{
|
|
71
|
+
success: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Get delivery proof (Merkle-based).
|
|
75
|
+
*/
|
|
76
|
+
proof(channelToken: string): Promise<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
proof_hash: string;
|
|
79
|
+
merkle_root: string;
|
|
80
|
+
delivery_chain: string[];
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class WebhookModule {
|
|
85
|
+
private http;
|
|
86
|
+
constructor(http: HttpClient);
|
|
87
|
+
/**
|
|
88
|
+
* Create a webhook channel.
|
|
89
|
+
*
|
|
90
|
+
* 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).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* // Create a webhook channel for Stripe events
|
|
97
|
+
* const wh = await nd.webhook.create({ label: "stripe-payments", ttl: "30d" });
|
|
98
|
+
*
|
|
99
|
+
* // Configure Stripe to POST to: wh.ingest_url
|
|
100
|
+
* // Store wh.secret securely — you need it to decrypt events
|
|
101
|
+
*
|
|
102
|
+
* // Later, poll for events:
|
|
103
|
+
* const events = await nd.webhook.events(wh.channel_token, wh.secret);
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
create(req?: WebhookChannelCreateRequest): Promise<WebhookChannelCreateResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieve encrypted webhook events.
|
|
109
|
+
* Events are returned encrypted — use the secret from create() to decrypt client-side.
|
|
110
|
+
*/
|
|
111
|
+
events(channelToken: string, options?: {
|
|
112
|
+
limit?: number;
|
|
113
|
+
since?: string;
|
|
114
|
+
}): Promise<WebhookEventsResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* List all webhook channels for this API key.
|
|
117
|
+
*/
|
|
118
|
+
list(): Promise<{
|
|
119
|
+
success: boolean;
|
|
120
|
+
channels: Array<{
|
|
121
|
+
channel_id: string;
|
|
122
|
+
channel_token: string;
|
|
123
|
+
label: string;
|
|
124
|
+
event_count: number;
|
|
125
|
+
max_events: number;
|
|
126
|
+
expires_at: string;
|
|
127
|
+
created_at: string;
|
|
128
|
+
}>;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare class DeliverModule {
|
|
133
|
+
private http;
|
|
134
|
+
constructor(http: HttpClient);
|
|
135
|
+
/**
|
|
136
|
+
* Create a secure, self-destructing delivery.
|
|
137
|
+
*
|
|
138
|
+
* Use for: credit card numbers, passwords, API keys, PII.
|
|
139
|
+
* The recipient opens the link, sees the content ONCE, and it burns.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```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,
|
|
149
|
+
* });
|
|
150
|
+
* // Send d.delivery_url to the recipient
|
|
151
|
+
* // After they open it — gone forever
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
send(req: DeliverRequest): Promise<DeliverResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Create an anonymous burn drop (no auth required on read side).
|
|
157
|
+
*/
|
|
158
|
+
burn(content: string, options?: {
|
|
159
|
+
ttlHours?: number;
|
|
160
|
+
burnAfterRead?: boolean;
|
|
161
|
+
availableAt?: string;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
success: boolean;
|
|
164
|
+
drop_id: string;
|
|
165
|
+
read_url: string;
|
|
166
|
+
expires_at: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Read a burn drop (self-destructs on read if configured).
|
|
170
|
+
*/
|
|
171
|
+
read(dropId: string): Promise<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
content: string;
|
|
174
|
+
burned: boolean;
|
|
175
|
+
}>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare class EvidenceModule {
|
|
179
|
+
private http;
|
|
180
|
+
constructor(http: HttpClient);
|
|
181
|
+
/**
|
|
182
|
+
* Query the audit trail.
|
|
183
|
+
* Returns metadata only — never content.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```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
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
query(q?: EvidenceQuery): Promise<EvidenceResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Generate a proof certificate for a specific operation.
|
|
199
|
+
*/
|
|
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
|
+
};
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Verify a receipt/proof hash.
|
|
212
|
+
*/
|
|
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
|
+
};
|
|
221
|
+
}>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare class VaultModule {
|
|
225
|
+
private http;
|
|
226
|
+
constructor(http: HttpClient);
|
|
227
|
+
/**
|
|
228
|
+
* Store an encrypted blob in the vault.
|
|
229
|
+
* YOU encrypt client-side. Server stores blindly.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```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
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
create(req: VaultCreateRequest): Promise<VaultCreateResponse>;
|
|
244
|
+
/**
|
|
245
|
+
* Retrieve an encrypted blob from the vault.
|
|
246
|
+
* YOU decrypt client-side.
|
|
247
|
+
*/
|
|
248
|
+
read(vaultId: string): Promise<VaultReadResponse>;
|
|
249
|
+
/**
|
|
250
|
+
* Delete a vault entry (irreversible).
|
|
251
|
+
*/
|
|
252
|
+
delete(vaultId: string): Promise<{
|
|
253
|
+
success: boolean;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Check vault service status.
|
|
257
|
+
*/
|
|
258
|
+
status(): Promise<{
|
|
259
|
+
success: boolean;
|
|
260
|
+
vault_count: number;
|
|
261
|
+
storage_used_bytes: number;
|
|
262
|
+
}>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare class NoData {
|
|
266
|
+
private http;
|
|
267
|
+
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;
|
|
278
|
+
constructor(config: NoDataConfig);
|
|
279
|
+
/** Encrypt a single field (blind relay — server stores nothing) */
|
|
280
|
+
encrypt(req: EncryptRequest): Promise<EncryptResponse>;
|
|
281
|
+
/** Decrypt a single field */
|
|
282
|
+
decrypt(req: DecryptRequest): Promise<DecryptResponse>;
|
|
283
|
+
/** Encrypt multiple fields in parallel */
|
|
284
|
+
batchEncrypt(fields: EncryptRequest[], context?: string): Promise<BatchResult<EncryptResponse>>;
|
|
285
|
+
/** Decrypt multiple fields in parallel */
|
|
286
|
+
batchDecrypt(fields: DecryptRequest[], requester?: string): Promise<BatchResult<DecryptResponse>>;
|
|
287
|
+
/** Single-call batch — up to 100 encrypt/decrypt ops in one HTTP request */
|
|
288
|
+
batchNative(items: Array<{
|
|
289
|
+
op: 'encrypt';
|
|
290
|
+
field: string;
|
|
291
|
+
value: string;
|
|
292
|
+
} | {
|
|
293
|
+
op: 'decrypt';
|
|
294
|
+
field: string;
|
|
295
|
+
ciphertext: string;
|
|
296
|
+
}>, context?: string): Promise<{
|
|
297
|
+
success: boolean;
|
|
298
|
+
batch_id: string;
|
|
299
|
+
results: Array<{
|
|
300
|
+
op: string;
|
|
301
|
+
field: string;
|
|
302
|
+
success: boolean;
|
|
303
|
+
ciphertext?: string;
|
|
304
|
+
value?: string;
|
|
305
|
+
audit_id?: string;
|
|
306
|
+
error?: string;
|
|
307
|
+
}>;
|
|
308
|
+
ok: number;
|
|
309
|
+
failed: number;
|
|
310
|
+
}>;
|
|
311
|
+
/** Encrypt all matching fields in a plain object (deep walk) */
|
|
312
|
+
encryptObject(obj: Record<string, unknown>, fields: string[], context?: string): Promise<Record<string, unknown>>;
|
|
313
|
+
/** Decrypt all matching fields in an encrypted object (deep walk) */
|
|
314
|
+
decryptObject(obj: Record<string, unknown>, fields: string[], requester?: string): Promise<Record<string, unknown>>;
|
|
315
|
+
/** Health check */
|
|
316
|
+
ping(): Promise<{
|
|
317
|
+
success: boolean;
|
|
318
|
+
latencyMs: number;
|
|
319
|
+
}>;
|
|
320
|
+
}
|
|
321
|
+
|
|
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 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
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.js';
|
|
2
|
+
export { p as EvidenceEntry, q as NoDataError, P as PluginConfig, r as WebhookEvent } from './types-DQh0UmSr.js';
|
|
3
|
+
|
|
4
|
+
declare class HttpClient {
|
|
5
|
+
private apiKey;
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private timeout;
|
|
8
|
+
private retries;
|
|
9
|
+
private customHeaders;
|
|
10
|
+
private onRequest?;
|
|
11
|
+
private onResponse?;
|
|
12
|
+
private onError?;
|
|
13
|
+
constructor(config: NoDataConfig);
|
|
14
|
+
request<T>(method: string, path: string, body?: unknown, query?: Record<string, string>): Promise<T>;
|
|
15
|
+
get<T>(path: string, query?: Record<string, string>): Promise<T>;
|
|
16
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
17
|
+
del<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class ChannelModule {
|
|
21
|
+
private http;
|
|
22
|
+
constructor(http: HttpClient);
|
|
23
|
+
/**
|
|
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.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```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)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
create(req?: ChannelCreateRequest): Promise<ChannelCreateResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Send data through a secure channel.
|
|
40
|
+
* Data is encrypted in transit — the server never sees plaintext.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```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,
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
send(req: ChannelSendRequest): Promise<ChannelSendResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Receive data from a secure channel.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* // System A retrieves the data
|
|
59
|
+
* const result = await nd.channel.receive({
|
|
60
|
+
* token: ch.channel_token,
|
|
61
|
+
* verificationCode: "123456",
|
|
62
|
+
* });
|
|
63
|
+
* const card = JSON.parse(result.data);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
receive(req: ChannelReceiveRequest): Promise<ChannelReceiveResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Verify a channel recipient with a code (out-of-band verification).
|
|
69
|
+
*/
|
|
70
|
+
verify(token: string, code: string): Promise<{
|
|
71
|
+
success: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Get delivery proof (Merkle-based).
|
|
75
|
+
*/
|
|
76
|
+
proof(channelToken: string): Promise<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
proof_hash: string;
|
|
79
|
+
merkle_root: string;
|
|
80
|
+
delivery_chain: string[];
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class WebhookModule {
|
|
85
|
+
private http;
|
|
86
|
+
constructor(http: HttpClient);
|
|
87
|
+
/**
|
|
88
|
+
* Create a webhook channel.
|
|
89
|
+
*
|
|
90
|
+
* 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).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* // Create a webhook channel for Stripe events
|
|
97
|
+
* const wh = await nd.webhook.create({ label: "stripe-payments", ttl: "30d" });
|
|
98
|
+
*
|
|
99
|
+
* // Configure Stripe to POST to: wh.ingest_url
|
|
100
|
+
* // Store wh.secret securely — you need it to decrypt events
|
|
101
|
+
*
|
|
102
|
+
* // Later, poll for events:
|
|
103
|
+
* const events = await nd.webhook.events(wh.channel_token, wh.secret);
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
create(req?: WebhookChannelCreateRequest): Promise<WebhookChannelCreateResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieve encrypted webhook events.
|
|
109
|
+
* Events are returned encrypted — use the secret from create() to decrypt client-side.
|
|
110
|
+
*/
|
|
111
|
+
events(channelToken: string, options?: {
|
|
112
|
+
limit?: number;
|
|
113
|
+
since?: string;
|
|
114
|
+
}): Promise<WebhookEventsResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* List all webhook channels for this API key.
|
|
117
|
+
*/
|
|
118
|
+
list(): Promise<{
|
|
119
|
+
success: boolean;
|
|
120
|
+
channels: Array<{
|
|
121
|
+
channel_id: string;
|
|
122
|
+
channel_token: string;
|
|
123
|
+
label: string;
|
|
124
|
+
event_count: number;
|
|
125
|
+
max_events: number;
|
|
126
|
+
expires_at: string;
|
|
127
|
+
created_at: string;
|
|
128
|
+
}>;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare class DeliverModule {
|
|
133
|
+
private http;
|
|
134
|
+
constructor(http: HttpClient);
|
|
135
|
+
/**
|
|
136
|
+
* Create a secure, self-destructing delivery.
|
|
137
|
+
*
|
|
138
|
+
* Use for: credit card numbers, passwords, API keys, PII.
|
|
139
|
+
* The recipient opens the link, sees the content ONCE, and it burns.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```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,
|
|
149
|
+
* });
|
|
150
|
+
* // Send d.delivery_url to the recipient
|
|
151
|
+
* // After they open it — gone forever
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
send(req: DeliverRequest): Promise<DeliverResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Create an anonymous burn drop (no auth required on read side).
|
|
157
|
+
*/
|
|
158
|
+
burn(content: string, options?: {
|
|
159
|
+
ttlHours?: number;
|
|
160
|
+
burnAfterRead?: boolean;
|
|
161
|
+
availableAt?: string;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
success: boolean;
|
|
164
|
+
drop_id: string;
|
|
165
|
+
read_url: string;
|
|
166
|
+
expires_at: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Read a burn drop (self-destructs on read if configured).
|
|
170
|
+
*/
|
|
171
|
+
read(dropId: string): Promise<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
content: string;
|
|
174
|
+
burned: boolean;
|
|
175
|
+
}>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare class EvidenceModule {
|
|
179
|
+
private http;
|
|
180
|
+
constructor(http: HttpClient);
|
|
181
|
+
/**
|
|
182
|
+
* Query the audit trail.
|
|
183
|
+
* Returns metadata only — never content.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```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
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
query(q?: EvidenceQuery): Promise<EvidenceResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Generate a proof certificate for a specific operation.
|
|
199
|
+
*/
|
|
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
|
+
};
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Verify a receipt/proof hash.
|
|
212
|
+
*/
|
|
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
|
+
};
|
|
221
|
+
}>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare class VaultModule {
|
|
225
|
+
private http;
|
|
226
|
+
constructor(http: HttpClient);
|
|
227
|
+
/**
|
|
228
|
+
* Store an encrypted blob in the vault.
|
|
229
|
+
* YOU encrypt client-side. Server stores blindly.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```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
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
create(req: VaultCreateRequest): Promise<VaultCreateResponse>;
|
|
244
|
+
/**
|
|
245
|
+
* Retrieve an encrypted blob from the vault.
|
|
246
|
+
* YOU decrypt client-side.
|
|
247
|
+
*/
|
|
248
|
+
read(vaultId: string): Promise<VaultReadResponse>;
|
|
249
|
+
/**
|
|
250
|
+
* Delete a vault entry (irreversible).
|
|
251
|
+
*/
|
|
252
|
+
delete(vaultId: string): Promise<{
|
|
253
|
+
success: boolean;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Check vault service status.
|
|
257
|
+
*/
|
|
258
|
+
status(): Promise<{
|
|
259
|
+
success: boolean;
|
|
260
|
+
vault_count: number;
|
|
261
|
+
storage_used_bytes: number;
|
|
262
|
+
}>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare class NoData {
|
|
266
|
+
private http;
|
|
267
|
+
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;
|
|
278
|
+
constructor(config: NoDataConfig);
|
|
279
|
+
/** Encrypt a single field (blind relay — server stores nothing) */
|
|
280
|
+
encrypt(req: EncryptRequest): Promise<EncryptResponse>;
|
|
281
|
+
/** Decrypt a single field */
|
|
282
|
+
decrypt(req: DecryptRequest): Promise<DecryptResponse>;
|
|
283
|
+
/** Encrypt multiple fields in parallel */
|
|
284
|
+
batchEncrypt(fields: EncryptRequest[], context?: string): Promise<BatchResult<EncryptResponse>>;
|
|
285
|
+
/** Decrypt multiple fields in parallel */
|
|
286
|
+
batchDecrypt(fields: DecryptRequest[], requester?: string): Promise<BatchResult<DecryptResponse>>;
|
|
287
|
+
/** Single-call batch — up to 100 encrypt/decrypt ops in one HTTP request */
|
|
288
|
+
batchNative(items: Array<{
|
|
289
|
+
op: 'encrypt';
|
|
290
|
+
field: string;
|
|
291
|
+
value: string;
|
|
292
|
+
} | {
|
|
293
|
+
op: 'decrypt';
|
|
294
|
+
field: string;
|
|
295
|
+
ciphertext: string;
|
|
296
|
+
}>, context?: string): Promise<{
|
|
297
|
+
success: boolean;
|
|
298
|
+
batch_id: string;
|
|
299
|
+
results: Array<{
|
|
300
|
+
op: string;
|
|
301
|
+
field: string;
|
|
302
|
+
success: boolean;
|
|
303
|
+
ciphertext?: string;
|
|
304
|
+
value?: string;
|
|
305
|
+
audit_id?: string;
|
|
306
|
+
error?: string;
|
|
307
|
+
}>;
|
|
308
|
+
ok: number;
|
|
309
|
+
failed: number;
|
|
310
|
+
}>;
|
|
311
|
+
/** Encrypt all matching fields in a plain object (deep walk) */
|
|
312
|
+
encryptObject(obj: Record<string, unknown>, fields: string[], context?: string): Promise<Record<string, unknown>>;
|
|
313
|
+
/** Decrypt all matching fields in an encrypted object (deep walk) */
|
|
314
|
+
decryptObject(obj: Record<string, unknown>, fields: string[], requester?: string): Promise<Record<string, unknown>>;
|
|
315
|
+
/** Health check */
|
|
316
|
+
ping(): Promise<{
|
|
317
|
+
success: boolean;
|
|
318
|
+
latencyMs: number;
|
|
319
|
+
}>;
|
|
320
|
+
}
|
|
321
|
+
|
|
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 };
|