@nodatachat/sdk 1.0.0 → 2.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/LICENSE.md +105 -0
- package/README.md +152 -253
- package/dist/chunk-4VSHBCCU.mjs +1 -0
- package/dist/index.d.mts +818 -130
- package/dist/index.d.ts +818 -130
- package/dist/index.js +1 -628
- package/dist/index.mjs +1 -8
- package/dist/plugins/express.d.mts +1 -1
- package/dist/plugins/express.d.ts +1 -1
- package/dist/plugins/express.js +1 -663
- package/dist/plugins/express.mjs +1 -43
- package/dist/plugins/fastify.d.mts +1 -1
- package/dist/plugins/fastify.d.ts +1 -1
- package/dist/plugins/fastify.js +1 -667
- package/dist/plugins/fastify.mjs +1 -47
- package/dist/{types-DQh0UmSr.d.mts → types-BQZ_zF32.d.mts} +132 -3
- package/dist/{types-DQh0UmSr.d.ts → types-BQZ_zF32.d.ts} +132 -3
- package/package.json +28 -22
- package/dist/chunk-V6GUTSNO.mjs +0 -601
package/LICENSE.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Capsule Ltd.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# @nodatachat/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The developer SDK for **NoData, the Information Access Processor**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Give AI access without giving it the data. One API. One decision. One proof.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The **primitive** is a single call — `compute(information, intent, clearance)` → a **decision** with an authorized view and a signed proof. The data the AI isn't cleared for never reaches the model. You pay per decision, and every decision *is* the proof.
|
|
8
|
+
|
|
9
|
+
Everything else in this SDK — capsules, documents, scan, engines — is an **adapter** that resolves to that same decision.
|
|
8
10
|
|
|
9
11
|
---
|
|
10
12
|
|
|
@@ -14,234 +16,153 @@ One package. Five lines. Full SOC compliance.
|
|
|
14
16
|
npm install @nodatachat/sdk
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
Zero dependencies. Works in Node.js, Bun, Deno, Cloudflare Workers, and any runtime with `fetch`.
|
|
19
|
+
Zero dependencies. Works in Node.js, Bun, Deno, Cloudflare Workers, and any runtime with `fetch`. Get a key at [nodatacapsule.com/capsule-api/register](https://www.nodatacapsule.com/capsule-api/register).
|
|
18
20
|
|
|
19
21
|
---
|
|
20
22
|
|
|
21
|
-
##
|
|
23
|
+
## The primitive — `compute()`
|
|
22
24
|
|
|
23
25
|
```ts
|
|
24
26
|
import { NoData } from '@nodatachat/sdk';
|
|
25
27
|
|
|
26
|
-
const nd = new NoData({ apiKey: '
|
|
27
|
-
|
|
28
|
-
// Encrypt a credit card — server-blind
|
|
29
|
-
const { ciphertext } = await nd.encrypt({
|
|
30
|
-
field: 'credit_card',
|
|
31
|
-
value: '4111111111111111',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Store `ciphertext` in YOUR database. NoData stores nothing.
|
|
28
|
+
const nd = new NoData({ apiKey: 'ndp_...' });
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
const { answer, sections, proof } = await nd.compute({
|
|
31
|
+
question: 'What is the claim status?',
|
|
32
|
+
clearance: 'internal',
|
|
33
|
+
sections: [
|
|
34
|
+
{ title: 'Status', text: 'Claim status: approved. Region: Tel Aviv.' },
|
|
35
|
+
{ title: 'Client', text: 'Dana Cohen, ID 039821582, amount 42,500 NIS.' },
|
|
36
|
+
],
|
|
41
37
|
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
That's it. AES-256-GCM. Audit trail. Zero plaintext on any server.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## What this does
|
|
49
|
-
|
|
50
|
-
| You call | What happens | What NoData stores |
|
|
51
|
-
|----------|-------------|-------------------|
|
|
52
|
-
| `nd.encrypt()` | AES-256-GCM encryption, key material returned to you | Nothing |
|
|
53
|
-
| `nd.decrypt()` | Decryption, audit log entry created | Metadata only (who, when, which field) |
|
|
54
|
-
| `nd.channel.create()` | Encrypted tunnel between two systems | Channel metadata, no content |
|
|
55
|
-
| `nd.deliver.send()` | Burn-after-read secret delivery | Encrypted blob, deleted on read |
|
|
56
|
-
| `nd.evidence.query()` | Returns audit trail for compliance | - |
|
|
57
|
-
|
|
58
|
-
---
|
|
59
38
|
|
|
60
|
-
|
|
39
|
+
// "Client" auto-classifies as confidential and is WITHHELD at internal clearance —
|
|
40
|
+
// it never reaches the model. `answer` comes only from "Status".
|
|
41
|
+
// sections → [{ title: 'Status', sent: true }, { title: 'Client', sent: false }]
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
const result = await nd.batchNative([
|
|
64
|
-
{ op: 'encrypt', field: 'phone', value: '0501234567' },
|
|
65
|
-
{ op: 'encrypt', field: 'email', value: 'david@company.com' },
|
|
66
|
-
{ op: 'encrypt', field: 'id', value: '123456789' },
|
|
67
|
-
{ op: 'decrypt', field: 'ssn', ciphertext: 'aes256gcm:v1:...' },
|
|
68
|
-
]);
|
|
69
|
-
// result.ok === 4, result.failed === 0
|
|
43
|
+
const v = await nd.verify(proof.id); // → { authentic: true, unaltered: true, ... }
|
|
70
44
|
```
|
|
71
45
|
|
|
72
|
-
|
|
46
|
+
Wire it to any model runtime — the pattern is always the same: **NoData decides + proves; your model only ever sees the authorized slice.**
|
|
73
47
|
|
|
74
48
|
```ts
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
age: 30,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const encrypted = await nd.encryptObject(customer, ['phone', 'email']);
|
|
84
|
-
// { name: 'David', phone: 'aes256gcm:v1:...', email: 'aes256gcm:v1:...', address: {...}, age: 30 }
|
|
49
|
+
// OpenAI / Anthropic / Gemini / LangChain / n8n — same shape:
|
|
50
|
+
const gate = await nd.compute({ question, clearance, sections });
|
|
51
|
+
if (gate.decision === 'deny') return 'Not authorized.';
|
|
52
|
+
const reply = gate.answer; // already computed over the authorized slice
|
|
53
|
+
// attach gate.proof.id to your response as the tamper-evident receipt.
|
|
85
54
|
```
|
|
86
55
|
|
|
87
56
|
---
|
|
88
57
|
|
|
89
|
-
##
|
|
58
|
+
## Adapter — a customer capsule in a few calls
|
|
90
59
|
|
|
91
|
-
|
|
60
|
+
The capsule is one adapter over the primitive: an isolated, content-blind workspace per customer; every read is a governed decision with a receipt.
|
|
92
61
|
|
|
93
62
|
```ts
|
|
94
|
-
|
|
95
|
-
const ch = await nd.channel.create({
|
|
96
|
-
ttl: '1h',
|
|
97
|
-
requireVerification: true,
|
|
98
|
-
});
|
|
99
|
-
// Share ch.channel_token with System B
|
|
100
|
-
// Share ch.verification_code with the human approver
|
|
101
|
-
|
|
102
|
-
// System B — sends the data
|
|
103
|
-
await nd.channel.send({
|
|
104
|
-
token: ch.channel_token,
|
|
105
|
-
data: { card: '4111111111111111', cvv: '123', exp: '12/28' },
|
|
106
|
-
burnAfterRead: true,
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// System A — receives
|
|
110
|
-
const result = await nd.channel.receive({
|
|
111
|
-
token: ch.channel_token,
|
|
112
|
-
verificationCode: '482901',
|
|
113
|
-
});
|
|
114
|
-
const card = JSON.parse(result.data);
|
|
115
|
-
```
|
|
63
|
+
import { NoData } from '@nodatachat/sdk';
|
|
116
64
|
|
|
117
|
-
|
|
65
|
+
const nd = new NoData({ apiKey: 'ndp_...' });
|
|
118
66
|
|
|
119
|
-
|
|
67
|
+
// Mint a customer capsule (isolated, content-blind)
|
|
68
|
+
const cap = await nd.capsules.create({ handle: 'case-4471', display_name: 'Yossi Levy' });
|
|
120
69
|
|
|
121
|
-
|
|
70
|
+
// Seal a document in — a key per recipient
|
|
71
|
+
await cap.documents.add({
|
|
72
|
+
title: 'Policy',
|
|
73
|
+
sections: [
|
|
74
|
+
{ label: 'Summary', classification: 'public', text: 'Public summary.' },
|
|
75
|
+
{ label: 'Terms', classification: 'confidential', text: 'Confidential terms.' },
|
|
76
|
+
],
|
|
77
|
+
recipients: [{ email: 'client@acme.com', classifications: ['public'], code: 'blue-harbor' }],
|
|
78
|
+
});
|
|
122
79
|
|
|
123
|
-
|
|
80
|
+
// Grant a member access across the docs
|
|
81
|
+
await cap.members.add({ email: 'client@acme.com', classifications: ['public'], code: 'blue-harbor' });
|
|
124
82
|
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
content: 'DATABASE_PASSWORD=s3cr3t_p@ss!',
|
|
128
|
-
ttl: '30m',
|
|
129
|
-
burn: true,
|
|
130
|
-
maxViews: 1,
|
|
131
|
-
});
|
|
83
|
+
// Signed audit ledger — who opened, when, on which device
|
|
84
|
+
const ledger = await cap.audit.get();
|
|
132
85
|
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
|
|
86
|
+
// Kill-switch: blocks the key capsule-wide — every live link 410s at once.
|
|
87
|
+
// Reversible (a paused capsule can be restored); use burn to crypto-shred the bytes.
|
|
88
|
+
await cap.revoke({ reason: 'offboarded' });
|
|
136
89
|
```
|
|
137
90
|
|
|
91
|
+
The server stores **ciphertext only** — never your section plaintext or the key.
|
|
92
|
+
|
|
138
93
|
---
|
|
139
94
|
|
|
140
|
-
##
|
|
95
|
+
## AI governance — let an agent read only what you allow
|
|
141
96
|
|
|
142
|
-
|
|
97
|
+
Grant a named agent scoped classifications; on read it gets back **only** those — denied sections never decrypt (deny-by-default), and every read is audited as an AI access.
|
|
143
98
|
|
|
144
99
|
```ts
|
|
145
|
-
const
|
|
146
|
-
label: 'stripe-payments',
|
|
147
|
-
ttl: '30d',
|
|
148
|
-
});
|
|
100
|
+
const g = await cap.ai.grant({ agent_name: 'claims-bot', classifications: ['public'] });
|
|
149
101
|
|
|
150
|
-
|
|
151
|
-
//
|
|
102
|
+
const read = await cap.ai.read({ agent_id: g.agent_id });
|
|
103
|
+
// read.documents[].sections → 'public' only; 'confidential' is absent, never decrypted
|
|
152
104
|
|
|
153
|
-
|
|
154
|
-
const events = await nd.webhook.events(wh.channel_token);
|
|
105
|
+
await cap.ai.revoke(g.agent_id);
|
|
155
106
|
```
|
|
156
107
|
|
|
157
108
|
---
|
|
158
109
|
|
|
159
|
-
##
|
|
110
|
+
## Embedded Capsule — the white-label widget
|
|
160
111
|
|
|
161
|
-
|
|
112
|
+
Mint an origin-bound token for one of the capsule's documents and frame the viewer on your own site. The raw bearer never leaves NoData's origin — the token encrypts it.
|
|
162
113
|
|
|
163
114
|
```ts
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
to: '2026-03-27',
|
|
115
|
+
const { embed_url } = await cap.embed({
|
|
116
|
+
bearer: '<document bearer from documents.add>',
|
|
117
|
+
allowed_origin: 'https://portal.myfirm.com',
|
|
118
|
+
ttl_seconds: 3600,
|
|
169
119
|
});
|
|
170
|
-
|
|
171
|
-
// WHO decrypted WHAT field WHEN — ready for SOC 2 auditor
|
|
120
|
+
// <iframe src={embed_url} />
|
|
172
121
|
```
|
|
173
122
|
|
|
174
123
|
---
|
|
175
124
|
|
|
176
|
-
##
|
|
177
|
-
|
|
178
|
-
You encrypt client-side. Server stores blindly.
|
|
125
|
+
## Tenants — provision a whole organization
|
|
179
126
|
|
|
180
127
|
```ts
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
encrypted_blob: myEncrypt(data, myKey),
|
|
184
|
-
iv: myIv,
|
|
185
|
-
metadata: { customer_id: 'cust_123' },
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
const entry = await nd.vault.read(vault.vault_id);
|
|
189
|
-
const data = myDecrypt(entry.encrypted_blob, entry.iv, myKey);
|
|
128
|
+
const t = await nd.tenants.create({ company_name: 'Acme', slug: 'acme', capsule_install: true });
|
|
129
|
+
const state = await nd.tenants.get(t.tenant_id);
|
|
190
130
|
```
|
|
191
131
|
|
|
132
|
+
Requires a key with the `partner.provision_tenants` scope.
|
|
133
|
+
|
|
192
134
|
---
|
|
193
135
|
|
|
194
|
-
##
|
|
136
|
+
## Fleet overview — you manage a fleet, not a capsule
|
|
195
137
|
|
|
196
138
|
```ts
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const app = express();
|
|
201
|
-
|
|
202
|
-
app.use('/api/customers', nodataExpress({
|
|
203
|
-
apiKey: 'sk_live_...',
|
|
204
|
-
encryptFields: ['phone', 'email', 'id_number'],
|
|
205
|
-
decryptFields: ['phone', 'email'],
|
|
206
|
-
decryptHeader: 'X-NoData-Decrypt',
|
|
207
|
-
}));
|
|
208
|
-
|
|
209
|
-
app.get('/api/customers', async (req, res) => {
|
|
210
|
-
const rows = await db.query('SELECT * FROM customers');
|
|
211
|
-
res.json(rows);
|
|
212
|
-
// phone, email, id_number → automatically encrypted in response
|
|
213
|
-
});
|
|
139
|
+
const fleet = await nd.capsules.overview();
|
|
140
|
+
// { fleet: { active_vaults, total_documents, ... }, ai_governance: { agents, grants_active } }
|
|
214
141
|
```
|
|
215
142
|
|
|
216
|
-
Also available: `@nodatachat/sdk/fastify`.
|
|
217
|
-
|
|
218
143
|
---
|
|
219
144
|
|
|
220
|
-
##
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
| Key prefix | Purpose | Can create child keys |
|
|
242
|
-
|-----------|---------|----------------------|
|
|
243
|
-
| `sk_live_` | Master key | Yes |
|
|
244
|
-
| `svc_live_` | Service account | No |
|
|
145
|
+
## Capsule API reference
|
|
146
|
+
|
|
147
|
+
| Method | Endpoint | What it does |
|
|
148
|
+
|--------|----------|--------------|
|
|
149
|
+
| `nd.capsules.create(req)` | `POST /v1/capsules` | Mint a customer capsule |
|
|
150
|
+
| `nd.capsules.list(opts?)` | `GET /v1/capsules` | List this org's capsules |
|
|
151
|
+
| `nd.capsules.get(idOrSlug)` | `GET /v1/capsules/{id}` | Capsule summary |
|
|
152
|
+
| `cap.documents.add(req)` | `POST /v1/capsules/{id}/documents` | Seal a document in |
|
|
153
|
+
| `cap.documents.list()` | `GET /v1/capsules/{id}/documents` | List documents (metadata) |
|
|
154
|
+
| `cap.members.add(req)` | `POST /v1/capsules/{id}/members` | Grant a member access |
|
|
155
|
+
| `cap.members.list()` | `GET /v1/capsules/{id}/members` | The member roster |
|
|
156
|
+
| `cap.ai.grant(req)` | `POST /v1/capsules/{id}/ai-grants` | Grant an AI agent scoped classifications |
|
|
157
|
+
| `cap.ai.list()` | `GET /v1/capsules/{id}/ai-grants` | List grants (allowed vs denied) |
|
|
158
|
+
| `cap.ai.read(req)` | `POST /v1/capsules/{id}/ai-read` | Agent reads only its allowed classifications |
|
|
159
|
+
| `cap.ai.revoke(id)` | `POST /v1/capsules/{id}/ai-grants` | Revoke an agent |
|
|
160
|
+
| `cap.audit.get(opts?)` | `GET /v1/capsules/{id}/audit` | Signed audit ledger |
|
|
161
|
+
| `cap.embed(req)` | `POST /v1/capsules/{id}/embed-token` | Origin-bound embed token |
|
|
162
|
+
| `cap.revoke(opts?)` | `POST /v1/capsules/{id}/revoke` | Kill-switch — every live link 410s at once (reversible) |
|
|
163
|
+
| `nd.tenants.create(req)` | `POST /v1/tenants` | Provision a tenant |
|
|
164
|
+
| `nd.tenants.get(id)` | `GET /v1/tenants/{id}` | Read tenant state |
|
|
165
|
+
| `nd.capsules.overview()` | `GET /v1/overview` | Fleet totals |
|
|
245
166
|
|
|
246
167
|
---
|
|
247
168
|
|
|
@@ -249,33 +170,27 @@ const svc = await fetch('https://www.nodatachat.com/api/v1/service-account', {
|
|
|
249
170
|
|
|
250
171
|
```ts
|
|
251
172
|
const nd = new NoData({
|
|
252
|
-
apiKey: '
|
|
253
|
-
baseUrl: 'https://www.
|
|
254
|
-
timeout: 30000,
|
|
255
|
-
retries: 2,
|
|
256
|
-
headers: { 'X-Custom': 'value' },
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
onResponse: (url, status, ms) => console.log(`← ${status} ${ms}ms`),
|
|
261
|
-
onError: (url, err) => console.error(`! ${url}: ${err.message}`),
|
|
173
|
+
apiKey: 'ndp_...',
|
|
174
|
+
baseUrl: 'https://www.nodatacapsule.com', // default
|
|
175
|
+
timeout: 30000, // ms
|
|
176
|
+
retries: 2, // on 5xx / network error
|
|
177
|
+
headers: { 'X-Custom': 'value' },
|
|
178
|
+
onRequest: (url, init) => console.log(`→ ${url}`),
|
|
179
|
+
onResponse: (url, status, ms) => console.log(`← ${status} ${ms}ms`),
|
|
180
|
+
onError: (url, err) => console.error(`! ${url}: ${err.message}`),
|
|
262
181
|
});
|
|
263
182
|
```
|
|
264
183
|
|
|
265
|
-
---
|
|
266
|
-
|
|
267
184
|
## Error handling
|
|
268
185
|
|
|
269
186
|
```ts
|
|
270
187
|
import { NoData, NoDataError } from '@nodatachat/sdk';
|
|
271
188
|
|
|
272
189
|
try {
|
|
273
|
-
await nd.
|
|
190
|
+
await nd.capsules.create({ handle: 'case-4471' });
|
|
274
191
|
} catch (err) {
|
|
275
192
|
if (err instanceof NoDataError) {
|
|
276
|
-
console.log(err.status);
|
|
277
|
-
console.log(err.message); // "Rate limit exceeded"
|
|
278
|
-
console.log(err.retryAfter); // 45 (seconds)
|
|
193
|
+
console.log(err.status, err.message, err.retryAfter);
|
|
279
194
|
}
|
|
280
195
|
}
|
|
281
196
|
```
|
|
@@ -284,102 +199,86 @@ Rate limits are handled automatically — the SDK waits and retries on 429.
|
|
|
284
199
|
|
|
285
200
|
---
|
|
286
201
|
|
|
287
|
-
##
|
|
288
|
-
|
|
289
|
-
### Core
|
|
290
|
-
|
|
291
|
-
| Method | Description |
|
|
292
|
-
|--------|------------|
|
|
293
|
-
| `nd.encrypt(req)` | Encrypt a single field |
|
|
294
|
-
| `nd.decrypt(req)` | Decrypt a single field |
|
|
295
|
-
| `nd.batchEncrypt(fields)` | Parallel encrypt (N HTTP calls) |
|
|
296
|
-
| `nd.batchDecrypt(fields)` | Parallel decrypt (N HTTP calls) |
|
|
297
|
-
| `nd.batchNative(items)` | Single-call batch (1 HTTP call, up to 100 ops) |
|
|
298
|
-
| `nd.encryptObject(obj, fields)` | Deep-walk encrypt matching fields |
|
|
299
|
-
| `nd.decryptObject(obj, fields)` | Deep-walk decrypt matching fields |
|
|
300
|
-
| `nd.ping()` | Health check + latency |
|
|
202
|
+
## Platform Engines — `nd.engines.*`
|
|
301
203
|
|
|
302
|
-
|
|
204
|
+
The shared machinery beneath the capsule (and beneath File / Code / AI / Data Capsule). These are the **engines**, not the pitch — the way Stripe doesn't put its internal ledger in the hero. Reach for them directly only when you need the raw primitive.
|
|
303
205
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
| `nd.channel.send(req)` | Send data through channel |
|
|
308
|
-
| `nd.channel.receive(req)` | Receive data from channel |
|
|
309
|
-
| `nd.channel.verify(token, code)` | Verify recipient |
|
|
310
|
-
| `nd.channel.proof(token)` | Get delivery proof |
|
|
206
|
+
```ts
|
|
207
|
+
// Blind Relay — field-level encrypt/decrypt (server stores nothing)
|
|
208
|
+
const { ciphertext } = await nd.engines.blindRelay.encrypt({ field: 'credit_card', value: '4111...' });
|
|
311
209
|
|
|
312
|
-
|
|
210
|
+
// Governance — register data + grant/revoke agents (runs on Excel/DB/CRM too)
|
|
211
|
+
await nd.engines.governance.grant(/* ... */);
|
|
313
212
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
| `nd.webhook.create(opts)` | Create webhook channel |
|
|
317
|
-
| `nd.webhook.events(token)` | Poll encrypted events |
|
|
318
|
-
| `nd.webhook.list()` | List all channels |
|
|
213
|
+
// Channel — system-to-system encrypted transfer
|
|
214
|
+
const ch = await nd.engines.channel.create({ ttl: '1h' });
|
|
319
215
|
|
|
320
|
-
|
|
216
|
+
// Delivery — burn-after-read
|
|
217
|
+
await nd.engines.deliver.send({ content: 'API_KEY=...', burn: true });
|
|
321
218
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
| `nd.deliver.send(req)` | Burn-after-read delivery |
|
|
325
|
-
| `nd.deliver.burn(content)` | Anonymous burn drop |
|
|
326
|
-
| `nd.deliver.read(dropId)` | Read + self-destruct |
|
|
219
|
+
// Evidence — audit trail + proofs
|
|
220
|
+
await nd.engines.evidence.query({ field: 'credit_card' });
|
|
327
221
|
|
|
328
|
-
|
|
222
|
+
// Vault — zero-knowledge blob storage · Webhooks — encrypted at rest
|
|
223
|
+
await nd.engines.vault.create({ /* ... */ });
|
|
224
|
+
await nd.engines.webhook.create({ label: 'stripe' });
|
|
225
|
+
```
|
|
329
226
|
|
|
330
|
-
|
|
|
331
|
-
|
|
332
|
-
| `nd.
|
|
333
|
-
| `nd.
|
|
334
|
-
| `nd.
|
|
227
|
+
| Engine | Namespace | Purpose |
|
|
228
|
+
|--------|-----------|---------|
|
|
229
|
+
| Governance | `nd.engines.governance.*` | Data permissions — register, grant, revoke (product-independent) |
|
|
230
|
+
| Blind Relay | `nd.engines.blindRelay.*` | `encrypt` / `decrypt` / batch — field-level, server-blind |
|
|
231
|
+
| Channel | `nd.engines.channel.*` | Encrypted system-to-system transfer |
|
|
232
|
+
| Delivery | `nd.engines.deliver.*` | Burn-after-read secret delivery |
|
|
233
|
+
| Evidence | `nd.engines.evidence.*` | Audit trail + cryptographic proofs |
|
|
234
|
+
| Vault | `nd.engines.vault.*` | Zero-knowledge blob storage |
|
|
235
|
+
| Webhooks | `nd.engines.webhook.*` | Receive webhooks, encrypted at rest |
|
|
335
236
|
|
|
336
|
-
|
|
237
|
+
> The old top-level accessors (`nd.encrypt`, `nd.channel`, `nd.governance`, …) still work but are **deprecated** — use `nd.engines.*`.
|
|
337
238
|
|
|
338
|
-
|
|
339
|
-
|--------|------------|
|
|
340
|
-
| `nd.vault.create(req)` | Store encrypted blob |
|
|
341
|
-
| `nd.vault.read(id)` | Retrieve encrypted blob |
|
|
342
|
-
| `nd.vault.delete(id)` | Delete entry |
|
|
343
|
-
| `nd.vault.status()` | Storage stats |
|
|
239
|
+
Framework plugins are available: `@nodatachat/sdk/express` and `@nodatachat/sdk/fastify`.
|
|
344
240
|
|
|
345
241
|
---
|
|
346
242
|
|
|
347
243
|
## Architecture
|
|
348
244
|
|
|
349
245
|
```
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
│
|
|
353
|
-
│ plaintext │
|
|
354
|
-
│ lives here │
|
|
355
|
-
│ │
|
|
356
|
-
└─────────────┘
|
|
246
|
+
one capsule per customer
|
|
247
|
+
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
|
248
|
+
│ Your App │ ─────→ │ NoData API │ ─────→ │ Your world │
|
|
249
|
+
│ plaintext │ │ ciphertext │ │ ciphertext │
|
|
250
|
+
│ lives here │ │ content- │ │ + receipts │
|
|
251
|
+
│ │ │ blind · 0 │ │ │
|
|
252
|
+
└─────────────┘ └──────────────┘ └─────────────┘
|
|
253
|
+
Capsule = the entity · Engines = the machinery underneath
|
|
357
254
|
```
|
|
358
255
|
|
|
359
|
-
**
|
|
256
|
+
**Content-blind by design — not by policy, by architecture.** We store ciphertext; never your data, never the key. A zero-knowledge capsule is sealed to a key only your customer holds, so we can never unwrap it.
|
|
360
257
|
|
|
361
258
|
---
|
|
362
259
|
|
|
363
|
-
##
|
|
260
|
+
## Get your API key
|
|
364
261
|
|
|
365
|
-
|
|
262
|
+
**[nodatacapsule.com/vault-api](https://www.nodatacapsule.com/vault-api)**
|
|
366
263
|
|
|
367
|
-
|
|
368
|
-
- **No key storage** — you hold the keys
|
|
369
|
-
- **No data retention** — we're a relay, not a warehouse
|
|
370
|
-
- **Full audit trail** — every operation logged (metadata only)
|
|
371
|
-
- **SOC 2 ready** — evidence endpoint = auditor-friendly
|
|
264
|
+
---
|
|
372
265
|
|
|
373
|
-
|
|
266
|
+
## NoData on npm
|
|
374
267
|
|
|
375
|
-
|
|
268
|
+
- **`@nodatachat/nodata`**: the main package, with all protection, scanning and governance capabilities, from the terminal.
|
|
269
|
+
- **`@nodatachat/sdk`** (this one): integration for developers.
|
|
270
|
+
- **`@nodatachat/mcp`**: integration for AI agents and MCP clients.
|
|
376
271
|
|
|
377
|
-
##
|
|
272
|
+
## License
|
|
378
273
|
|
|
379
|
-
|
|
274
|
+
[FSL-1.1-ALv2](LICENSE.md) (Functional Source License 1.1, Apache 2.0 future license).
|
|
275
|
+
Use it for any purpose except a competing product or service. Each release becomes
|
|
276
|
+
available under the Apache License 2.0 two years after it is published. Version 1.0.0
|
|
277
|
+
was published under MIT and remains available under that license.
|
|
278
|
+
Copyright 2026 Capsule Ltd.
|
|
380
279
|
|
|
381
280
|
---
|
|
382
281
|
|
|
383
282
|
<p align="center">
|
|
384
|
-
<strong>NoData</strong> —
|
|
283
|
+
<strong>NoData Capsule</strong> — one API mints a customer capsule.
|
|
385
284
|
</p>
|