ulda-auth 0.0.0-stage → 1.0.1
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/CHANGELOG.md +16 -0
- package/LICENSE.md +380 -0
- package/MANIFEST.md +100 -0
- package/README.md +131 -2
- package/SECURITY.md +94 -0
- package/dist/THIRD_PARTY_LICENSES.md +887 -0
- package/dist/ulda-library.js +2 -0
- package/docs/API.md +266 -0
- package/docs/GUIDE.md +281 -0
- package/docs/LICENSING.md +41 -0
- package/docs/PIPELINES.md +235 -0
- package/docs/PROTOCOL.md +205 -0
- package/docs/RECOVERY.md +87 -0
- package/docs/SECRET_LIFECYCLE.md +50 -0
- package/package.json +83 -4
- package/src/client.js +1209 -0
- package/src/core.js +66 -0
- package/src/crypto.js +216 -0
- package/src/diagnostics.js +33 -0
- package/src/errors.js +39 -0
- package/src/index.js +3 -0
- package/src/protocol.js +199 -0
- package/src/proxy.js +63 -0
- package/src/queue.js +146 -0
- package/src/reconnect.js +103 -0
- package/src/socket-parser.js +37 -0
- package/src/transport.js +262 -0
- package/src/values.js +175 -0
- package/types/index.d.ts +81 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
- Fix the release dry-run for versions already present in npm, with regression tests for dry-run safety and archive integrity.
|
|
6
|
+
- Clarify GitHub Actions rehearsals, trusted publisher configuration and maintainer approval in the publishing guide.
|
|
7
|
+
- SDK runtime, public API, wire protocol, cryptographic profile and dependencies are unchanged from 1.0.0.
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
- Initial public SDK package: encrypted master/content lifecycle over ULDA and Socket.IO.
|
|
12
|
+
- Per-resource chains, binary transport, subscriptions, X/S queues and explicit conflict handling.
|
|
13
|
+
- Bounded reconnect with verified reads; no automatic replay of uncertain writes.
|
|
14
|
+
- Fail-closed incoming validation, explicit content recovery and private secret lifecycle.
|
|
15
|
+
- ESM and standalone browser exports, TypeScript declarations and pinned core dependency.
|
|
16
|
+
- Security regressions, safe test output, package checks and publication dry-run.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
# ULDA Library Community Source License 1.0
|
|
2
|
+
|
|
3
|
+
Version 1.0 — 6 October 2026
|
|
4
|
+
|
|
5
|
+
Copyright in the respective contributions © 2026 Mark Shaposhnik and
|
|
6
|
+
Vitalii Radko.
|
|
7
|
+
|
|
8
|
+
ULDA protocol and library concept: Mark Shaposhnik.
|
|
9
|
+
|
|
10
|
+
Library implementation contributions and improvements: Vitalii Radko.
|
|
11
|
+
|
|
12
|
+
## 1. Scope and acceptance
|
|
13
|
+
|
|
14
|
+
“Licensors” means Mark Shaposhnik and Vitalii Radko, each solely with respect
|
|
15
|
+
to the rights that person owns or is authorized to license in the Covered
|
|
16
|
+
Materials.
|
|
17
|
+
|
|
18
|
+
“Covered Materials” means the source code and generated bundles of
|
|
19
|
+
`ulda-auth`, together with the ULDA Library Manifest, protocol documentation, test
|
|
20
|
+
vectors, examples, and other materials expressly identified as part of an
|
|
21
|
+
official `ulda-auth` release distributed with this License.
|
|
22
|
+
|
|
23
|
+
Third-party materials and separately licensed files are excluded.
|
|
24
|
+
|
|
25
|
+
This License text is not a Covered Material and may be copied and distributed
|
|
26
|
+
verbatim.
|
|
27
|
+
|
|
28
|
+
This License applies only to ULDA Library (the SDK), currently packaged as
|
|
29
|
+
`ulda-auth` (formerly `@ulda/library-prototype`), and to releases expressly identified as covered by
|
|
30
|
+
this License. A package rename alone does not extend its scope to other
|
|
31
|
+
products. The internal project name `ulda-library` refers to this SDK.
|
|
32
|
+
|
|
33
|
+
`ulda-core`, Socket.IO, and all other dependencies retain their own licenses,
|
|
34
|
+
including when included in an SDK bundle or vendor archive. This License does
|
|
35
|
+
not replace their terms or grant additional rights in them. ULDA servers,
|
|
36
|
+
SaaS or API services, container images, Enterprise products, and other
|
|
37
|
+
separately distributed products require their own terms.
|
|
38
|
+
|
|
39
|
+
By exercising any permission granted under this License, You accept its terms.
|
|
40
|
+
If You do not accept them, You may not exercise those permissions.
|
|
41
|
+
|
|
42
|
+
Nothing in this License restricts an act that applicable law permits and does
|
|
43
|
+
not allow the Licensors to prohibit by contract.
|
|
44
|
+
|
|
45
|
+
This is a source-available license. It is not an OSI-approved open-source
|
|
46
|
+
license.
|
|
47
|
+
|
|
48
|
+
## 2. Definitions
|
|
49
|
+
|
|
50
|
+
“You” means the individual or Organization exercising permissions under this
|
|
51
|
+
License.
|
|
52
|
+
|
|
53
|
+
“Organization” means a corporation, company, partnership, sole proprietorship,
|
|
54
|
+
association, foundation, non-profit organization, educational institution,
|
|
55
|
+
public body, government body, or other organized entity.
|
|
56
|
+
|
|
57
|
+
“Control” means direct or indirect ownership of more than fifty percent of an
|
|
58
|
+
entity’s voting interests or the power to direct its management or policies.
|
|
59
|
+
|
|
60
|
+
“Group” means an Organization together with every entity that Controls, is
|
|
61
|
+
Controlled by, or is under common Control with it.
|
|
62
|
+
|
|
63
|
+
“Modified Version” means a work that copies, adapts, translates, ports, or
|
|
64
|
+
modifies protected expression from the Covered Materials in a manner requiring
|
|
65
|
+
permission under applicable law.
|
|
66
|
+
|
|
67
|
+
“Library Functionality” means:
|
|
68
|
+
|
|
69
|
+
1. providing a client SDK for encrypted ULDA resources and catalogs;
|
|
70
|
+
2. preparing and verifying encrypted resource containers while coordinating
|
|
71
|
+
per-resource ULDA state through the underlying core;
|
|
72
|
+
3. exposing client data access, resource lifecycle, and write queues; and
|
|
73
|
+
4. managing client transport, change delivery, and connection recovery for
|
|
74
|
+
those resources.
|
|
75
|
+
|
|
76
|
+
These definitions describe the SDK as an integrated product. They do not
|
|
77
|
+
relicense the separately distributed `ulda-core` or claim exclusive rights
|
|
78
|
+
over general encryption, networking, or programming techniques.
|
|
79
|
+
|
|
80
|
+
“Functionally Equivalent Offering” means a product or service whose entire or
|
|
81
|
+
primary purpose is to provide all or a material part of the Library Functionality
|
|
82
|
+
as:
|
|
83
|
+
|
|
84
|
+
- a standalone ULDA client library or SDK;
|
|
85
|
+
- a port, replacement, or substantial substitute for `ulda-auth`; or
|
|
86
|
+
- a hosted service or API that exposes that functionality directly to third
|
|
87
|
+
parties.
|
|
88
|
+
|
|
89
|
+
“Ancillary Application” means a larger application whose primary purpose is
|
|
90
|
+
materially different from the Library Functionality and which uses ULDA only as a
|
|
91
|
+
supporting component for encrypted application data, integrity, lineage, or
|
|
92
|
+
resource synchronization.
|
|
93
|
+
|
|
94
|
+
An Ancillary Application does not become a Functionally Equivalent Offering
|
|
95
|
+
merely because it calls the public `ulda-auth` API or includes an official
|
|
96
|
+
bundle.
|
|
97
|
+
|
|
98
|
+
## 3. Community license
|
|
99
|
+
|
|
100
|
+
Subject to this License, each Licensor grants You, only to the extent of the
|
|
101
|
+
rights controlled by that Licensor, a worldwide, royalty-free, non-exclusive,
|
|
102
|
+
non-transferable, and non-sublicensable copyright license to:
|
|
103
|
+
|
|
104
|
+
- use and run the Covered Materials;
|
|
105
|
+
- inspect and study them;
|
|
106
|
+
- copy and modify them;
|
|
107
|
+
- create private forks and Modified Versions;
|
|
108
|
+
- embed them in an Ancillary Application;
|
|
109
|
+
- distribute them in source or bundled form;
|
|
110
|
+
- use them in paid products and services; and
|
|
111
|
+
- provide them as part of a hosted Ancillary Application.
|
|
112
|
+
|
|
113
|
+
You may exercise these permissions if:
|
|
114
|
+
|
|
115
|
+
1. You are an individual acting solely for personal, educational, research, or
|
|
116
|
+
other non-commercial purposes; or
|
|
117
|
+
2. You are a Qualifying Small Organization under Section 4.
|
|
118
|
+
|
|
119
|
+
Commercial use is permitted for a Qualifying Small Organization.
|
|
120
|
+
|
|
121
|
+
You may keep modifications and the source code of an Ancillary Application
|
|
122
|
+
private. This License does not impose a source-publication requirement.
|
|
123
|
+
|
|
124
|
+
Every recipient must independently qualify under this License or obtain a
|
|
125
|
+
separate commercial license.
|
|
126
|
+
|
|
127
|
+
An end user who merely accesses an Ancillary Application and does not deploy,
|
|
128
|
+
integrate, modify, distribute, or use the Covered Materials separately does not
|
|
129
|
+
need to qualify independently merely because the Covered Materials are
|
|
130
|
+
delivered to or executed on that end user’s device.
|
|
131
|
+
|
|
132
|
+
Creating and maintaining a private Modified Version solely to integrate,
|
|
133
|
+
operate, secure, or maintain a permitted Ancillary Application does not by
|
|
134
|
+
itself create a Functionally Equivalent Offering. Offering or distributing
|
|
135
|
+
that Modified Version as a standalone ULDA client library or SDK remains subject to
|
|
136
|
+
Section 5.
|
|
137
|
+
|
|
138
|
+
## 4. Revenue threshold
|
|
139
|
+
|
|
140
|
+
The “Revenue Threshold” is **USD 1,000,000**.
|
|
141
|
+
|
|
142
|
+
“Consolidated Gross Revenue” means the total worldwide gross revenue or gross
|
|
143
|
+
receipts of the Group before deducting costs, operating expenses, owner
|
|
144
|
+
compensation, contractor payments, or distributions. Bona fide transactions
|
|
145
|
+
between Group members must be eliminated to avoid counting the same revenue
|
|
146
|
+
twice.
|
|
147
|
+
|
|
148
|
+
Revenue must be calculated using the accounting standards legally required
|
|
149
|
+
for the Organization’s consolidated financial statements. If no such
|
|
150
|
+
standards apply, the Organization must use the method reflected in its
|
|
151
|
+
official tax filings or externally prepared financial statements. If none
|
|
152
|
+
exist, it must use a reasonable and consistently applied method based on its
|
|
153
|
+
ordinary books and records.
|
|
154
|
+
|
|
155
|
+
An accounting method, fiscal year, revenue classification, or business
|
|
156
|
+
arrangement must not be selected or changed primarily to avoid the Revenue
|
|
157
|
+
Threshold.
|
|
158
|
+
|
|
159
|
+
Taxes collected solely for a government, bona fide loans, equity investments,
|
|
160
|
+
and capital contributions are excluded. For each fiscal year tested under this
|
|
161
|
+
Section, an Organization that has no reportable gross revenue or gross receipts
|
|
162
|
+
must use its approved operating budget for that fiscal year.
|
|
163
|
+
|
|
164
|
+
Amounts recorded in a currency other than United States dollars must be
|
|
165
|
+
converted using the average European Central Bank reference rate for the
|
|
166
|
+
applicable period or, if unavailable, another comparable official central-bank
|
|
167
|
+
rate.
|
|
168
|
+
|
|
169
|
+
A “Qualifying Small Organization” is an Organization whose Consolidated Gross
|
|
170
|
+
Revenue:
|
|
171
|
+
|
|
172
|
+
1. did not exceed the Revenue Threshold during its most recently completed
|
|
173
|
+
fiscal year; and
|
|
174
|
+
2. has not exceeded the Revenue Threshold during its current fiscal year to
|
|
175
|
+
date.
|
|
176
|
+
|
|
177
|
+
If no fiscal year has been formally adopted, the calendar year applies. An
|
|
178
|
+
Organization that has not completed its first fiscal year is tested using its
|
|
179
|
+
current fiscal-year-to-date Consolidated Gross Revenue.
|
|
180
|
+
|
|
181
|
+
A freelancer or individual performing paid work is treated as an Organization
|
|
182
|
+
whether or not the activity is formally registered. Their revenue includes
|
|
183
|
+
gross receipts from all business and professional activities, but excludes
|
|
184
|
+
salary from unrelated employment. When the Covered Materials are used for an
|
|
185
|
+
employer or customer, that employer or customer must independently qualify or
|
|
186
|
+
hold a commercial license.
|
|
187
|
+
|
|
188
|
+
Revenue or activity must not be divided, concealed, transferred, or
|
|
189
|
+
recharacterized through members of the Group, contractors, accounts,
|
|
190
|
+
deployments, or other arrangements primarily to avoid the Revenue Threshold.
|
|
191
|
+
Affected revenue will be counted as though the arrangement had not occurred.
|
|
192
|
+
|
|
193
|
+
### Crossing the threshold
|
|
194
|
+
|
|
195
|
+
“Threshold Crossing Date” means the date on which an Organization that
|
|
196
|
+
previously qualified under this License first exceeds the Revenue Threshold.
|
|
197
|
+
|
|
198
|
+
Only an Organization that qualified immediately before its Threshold Crossing
|
|
199
|
+
Date receives 90 calendar days to obtain a commercial license or stop
|
|
200
|
+
exercising rights under this License.
|
|
201
|
+
|
|
202
|
+
Compliant earlier use does not become retroactively unlawful, and no
|
|
203
|
+
retroactive fee is imposed solely because the threshold was crossed.
|
|
204
|
+
|
|
205
|
+
The 90-day period does not apply to intentional concealment or material
|
|
206
|
+
misrepresentation of revenue, Control, or Group membership.
|
|
207
|
+
|
|
208
|
+
An Organization that already exceeds the Revenue Threshold when it first
|
|
209
|
+
exercises rights under this License must obtain a commercial license before
|
|
210
|
+
doing so.
|
|
211
|
+
|
|
212
|
+
### Returning below the threshold
|
|
213
|
+
|
|
214
|
+
An Organization may qualify again from the first day of a fiscal year if:
|
|
215
|
+
|
|
216
|
+
1. its Consolidated Gross Revenue remained at or below the Revenue Threshold
|
|
217
|
+
throughout the immediately preceding completed fiscal year;
|
|
218
|
+
2. it remains at or below the threshold in the current fiscal year to date;
|
|
219
|
+
and
|
|
220
|
+
3. it otherwise complies with this License.
|
|
221
|
+
|
|
222
|
+
Requalification applies prospectively. It does not cure a previous violation,
|
|
223
|
+
cancel an amount already due, or automatically terminate or modify an existing
|
|
224
|
+
commercial agreement. That agreement continues according to its own terms.
|
|
225
|
+
|
|
226
|
+
## 5. Functionally equivalent and competitive uses
|
|
227
|
+
|
|
228
|
+
Regardless of revenue, You must not use the Covered Materials or a Modified
|
|
229
|
+
Version as development, reference, training, comparison, testing,
|
|
230
|
+
benchmarking, validation, certification, debugging, documentation,
|
|
231
|
+
maintenance, or improvement material to create or provide a Functionally
|
|
232
|
+
Equivalent Offering without a separate written commercial license.
|
|
233
|
+
|
|
234
|
+
In particular, without such a license You must not:
|
|
235
|
+
|
|
236
|
+
1. use, modify, translate, port, or adapt the Covered Materials to develop a
|
|
237
|
+
Functionally Equivalent Offering;
|
|
238
|
+
2. use the Manifest, protocol documentation, examples, or test vectors to
|
|
239
|
+
develop or validate a Functionally Equivalent Offering;
|
|
240
|
+
3. distribute, license, sell, host, or otherwise provide a Functionally
|
|
241
|
+
Equivalent Offering developed through a prohibited use of the Covered
|
|
242
|
+
Materials; or
|
|
243
|
+
4. knowingly enable or assist another person to do any of the foregoing.
|
|
244
|
+
|
|
245
|
+
This restriction applies even when the competing implementation:
|
|
246
|
+
|
|
247
|
+
- is written in another programming language;
|
|
248
|
+
- uses a different internal architecture;
|
|
249
|
+
- has different public names or branding; or
|
|
250
|
+
- provides a material part of the Library Functionality sufficient to act as a
|
|
251
|
+
replacement or substantial substitute for `ulda-auth`.
|
|
252
|
+
|
|
253
|
+
This Section does not prohibit:
|
|
254
|
+
|
|
255
|
+
- ordinary use of `ulda-auth` inside an Ancillary Application;
|
|
256
|
+
- testing that an Ancillary Application correctly integrates the official
|
|
257
|
+
package;
|
|
258
|
+
- private security research that is not used to provide a Functionally
|
|
259
|
+
Equivalent Offering;
|
|
260
|
+
- unchanged redistribution of an official `ulda-auth` artifact in compliance
|
|
261
|
+
with Section 6; or
|
|
262
|
+
- acts that applicable mandatory law does not permit this License to restrict.
|
|
263
|
+
|
|
264
|
+
For clarity, this License does not claim copyright ownership over an abstract
|
|
265
|
+
idea, mathematical principle, algorithm, interface, protocol behavior, or
|
|
266
|
+
functionality as such.
|
|
267
|
+
|
|
268
|
+
Similar output or behavior alone does not establish that the Covered Materials
|
|
269
|
+
were copied or used.
|
|
270
|
+
|
|
271
|
+
An implementation independently created without copying or adapting protected
|
|
272
|
+
expression from the Covered Materials, and without exercising permissions
|
|
273
|
+
granted under this License to develop, test, validate, or improve that
|
|
274
|
+
implementation, is not restricted by this License merely because it provides
|
|
275
|
+
similar functionality.
|
|
276
|
+
|
|
277
|
+
## 6. Distribution and notices
|
|
278
|
+
|
|
279
|
+
When distributing Covered Materials or a Modified Version, You must:
|
|
280
|
+
|
|
281
|
+
1. provide this License or an accessible link to it;
|
|
282
|
+
2. preserve copyright, authorship, attribution, and license notices;
|
|
283
|
+
3. identify materially modified files or portions; and
|
|
284
|
+
4. not represent a modified product as an official ULDA release.
|
|
285
|
+
|
|
286
|
+
For an embedded or minified bundle, notices may be provided in accompanying
|
|
287
|
+
documentation or a `LICENSE`, `NOTICE`, or `ABOUT` file. You are not required
|
|
288
|
+
to extract the bundle or publish the source code of the larger application.
|
|
289
|
+
|
|
290
|
+
Notwithstanding Sections 3 and 4 and the preceding notice requirements, GitHub,
|
|
291
|
+
npm, jsDelivr, unpkg, registries, mirrors, archives, proxies, security scanners,
|
|
292
|
+
and caches may store, inspect, cache, and transmit unchanged official artifacts
|
|
293
|
+
when the official package or release metadata provides an accessible link to
|
|
294
|
+
this License. This technical permission does not grant a recipient any right to
|
|
295
|
+
use the Covered Materials beyond the other terms of this License and does not
|
|
296
|
+
authorize a Functionally Equivalent Offering.
|
|
297
|
+
|
|
298
|
+
No rights to ULDA names, logos, trademarks, service marks, or other branding
|
|
299
|
+
are granted except accurate descriptive references that do not imply
|
|
300
|
+
endorsement, certification, or official status.
|
|
301
|
+
|
|
302
|
+
## 7. Commercial licensing, ownership, and other rights
|
|
303
|
+
|
|
304
|
+
A separate written commercial license is required:
|
|
305
|
+
|
|
306
|
+
1. after the Revenue Threshold transition period;
|
|
307
|
+
2. for a Functionally Equivalent Offering; or
|
|
308
|
+
3. for any use outside this License.
|
|
309
|
+
|
|
310
|
+
A commercial license covering all Covered Materials may be granted only by
|
|
311
|
+
Mark Shaposhnik and Vitalii Radko jointly, or by a person or legal entity
|
|
312
|
+
authorized in writing by each Licensor to license that Licensor’s respective
|
|
313
|
+
rights.
|
|
314
|
+
|
|
315
|
+
Commercial licensing inquiries may be sent to
|
|
316
|
+
[mark@shaposhnik.ch](mailto:mark@shaposhnik.ch). This address is an
|
|
317
|
+
administrative contact only. Correspondence does not itself grant any rights;
|
|
318
|
+
commercial rights arise only under a separate written agreement granted as
|
|
319
|
+
described above.
|
|
320
|
+
|
|
321
|
+
A future company may administer community and commercial licensing only after
|
|
322
|
+
receiving the necessary rights or licensing authority through a separate
|
|
323
|
+
written agreement. Such a transfer or authorization does not terminate or
|
|
324
|
+
narrow licenses already validly granted.
|
|
325
|
+
|
|
326
|
+
Commercial pricing, support, warranties, service levels, and payment terms are
|
|
327
|
+
governed by the separate agreement.
|
|
328
|
+
|
|
329
|
+
This License grants no patent license. It also grants no rights in future ULDA
|
|
330
|
+
products or other separately distributed products except as expressly stated.
|
|
331
|
+
All rights not expressly granted are reserved.
|
|
332
|
+
|
|
333
|
+
## 8. Termination and general terms
|
|
334
|
+
|
|
335
|
+
If You violate this License, Your rights continue if You fully cure the first
|
|
336
|
+
notified violation within 30 days.
|
|
337
|
+
|
|
338
|
+
An uncured violation, repeated material violation, or intentional material
|
|
339
|
+
misrepresentation terminates Your rights. Crossing the Revenue Threshold is
|
|
340
|
+
governed by the 90-day period in Section 4.
|
|
341
|
+
|
|
342
|
+
Upon termination, You must stop using and distributing the Covered Materials.
|
|
343
|
+
Rights of recipients who independently comply with this License are not
|
|
344
|
+
terminated solely because Your rights ended.
|
|
345
|
+
|
|
346
|
+
THE COVERED MATERIALS ARE PROVIDED “AS IS” AND “AS AVAILABLE,” WITHOUT
|
|
347
|
+
WARRANTIES OF ANY KIND, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
348
|
+
PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, SECURITY, ACCURACY, OR RELIABILITY.
|
|
349
|
+
|
|
350
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSORS WILL NOT BE LIABLE FOR
|
|
351
|
+
INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES,
|
|
352
|
+
OR FOR LOSS OF PROFITS, REVENUE, DATA, BUSINESS, OR GOODWILL.
|
|
353
|
+
|
|
354
|
+
THE LICENSORS’ TOTAL AGGREGATE LIABILITY WILL NOT EXCEED THE AMOUNT PAID
|
|
355
|
+
DIRECTLY FOR USE OF THE COVERED MATERIALS DURING THE TWELVE MONTHS BEFORE THE
|
|
356
|
+
CLAIM. IF NOTHING WAS PAID, THE LIMIT IS ZERO TO THE MAXIMUM EXTENT PERMITTED
|
|
357
|
+
BY LAW.
|
|
358
|
+
|
|
359
|
+
This License is governed by Swiss law, excluding conflict-of-law rules.
|
|
360
|
+
Disputes are subject to the competent courts in Switzerland unless a separate
|
|
361
|
+
written agreement provides otherwise.
|
|
362
|
+
|
|
363
|
+
If any provision is unenforceable, it will be enforced to the maximum extent
|
|
364
|
+
permitted, and the remaining provisions remain effective. Failure to enforce a
|
|
365
|
+
provision is not a waiver.
|
|
366
|
+
|
|
367
|
+
A signed commercial agreement controls where it expressly conflicts with this
|
|
368
|
+
License.
|
|
369
|
+
|
|
370
|
+
The warranty disclaimers, liability limitations, governing-law and dispute
|
|
371
|
+
provisions, and obligations accrued before termination survive termination.
|
|
372
|
+
|
|
373
|
+
The Licensors may publish new versions of this License. A release remains
|
|
374
|
+
governed by the version distributed with that release unless You and the
|
|
375
|
+
applicable Licensors agree otherwise in writing. A new version does not
|
|
376
|
+
retroactively change the terms governing an earlier release.
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
**End of ULDA Library Community Source License 1.0**
|
package/MANIFEST.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ULDA Auth Manifest
|
|
2
|
+
|
|
3
|
+
This manifest defines the SDK's architecture, data model and supported contract. Usage examples are in the [guide](docs/GUIDE.md); security assumptions are in [SECURITY.md](SECURITY.md).
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
ULDA Auth is a JavaScript client SDK for encrypted JSON resources. It manages an encrypted catalog, a separate ULDA chain per resource, client-side encryption, write queues, transport, change delivery and connection recovery.
|
|
8
|
+
|
|
9
|
+
It uses the separately licensed `ulda-core@1.0.1`. The application supplies its endpoint, master ID and password. The storage server, account UI and application authorization are separate components.
|
|
10
|
+
|
|
11
|
+
## Components
|
|
12
|
+
|
|
13
|
+
| Component | Responsibility |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Client | Catalog, resource lifecycle, validated local state and event delivery |
|
|
16
|
+
| Crypto | Password/content key derivation and authenticated encryption |
|
|
17
|
+
| Core adapter | Supported ULDA profile, origin creation, chain advancement and witness verification |
|
|
18
|
+
| Protocol | Exact packet shapes, size validation and opaque outgoing handles |
|
|
19
|
+
| Transport | One Socket.IO WebSocket connection, ACKs and incoming encrypted records |
|
|
20
|
+
| Queues | Per-resource X/S writes and serialized catalog operations |
|
|
21
|
+
| Reconnect | Bounded connection/Hello/read retries, without write replay |
|
|
22
|
+
| References | Explicit access to application JSON through get/update/delete |
|
|
23
|
+
|
|
24
|
+
`src/` contains the JavaScript implementation. `dist/ulda-library.js` is the generated standalone ESM bundle. `types/index.d.ts` describes the same API for editors and TypeScript; it is not another runtime implementation.
|
|
25
|
+
|
|
26
|
+
## Resource model
|
|
27
|
+
|
|
28
|
+
A master is an encrypted catalog containing content IDs, names, secrets and identity tokens. It always uses X. Content stores application JSON and uses X by default, or S when chosen at creation.
|
|
29
|
+
|
|
30
|
+
A server record contains only `id`, `witness` and encrypted `payload`. It has no explicit master/content role or parent field. The client interprets its decrypted catalog; the server can still observe access patterns and public witness metadata.
|
|
31
|
+
|
|
32
|
+
Public snapshots expose application JSON, not internal catalog credentials or origins.
|
|
33
|
+
|
|
34
|
+
## Supported profile
|
|
35
|
+
|
|
36
|
+
| Property | Value |
|
|
37
|
+
|---|---|
|
|
38
|
+
| Core format | canonical compactV1 |
|
|
39
|
+
| Core hash | SHA-256 |
|
|
40
|
+
| Chain width | N=5 |
|
|
41
|
+
| Origin block size | 256 bits |
|
|
42
|
+
| Modes | X and S |
|
|
43
|
+
| Age | uint32; advancing past the maximum is rejected |
|
|
44
|
+
| Payload container | SDK version 2 |
|
|
45
|
+
| Encryption | AES-256-GCM, 96-bit nonce, 128-bit tag |
|
|
46
|
+
| Master KDF | PBKDF2-HMAC-SHA-256, 600000 iterations, 16-byte salt |
|
|
47
|
+
| Content KDF | HKDF-SHA-256, independent 32-byte secret, 16-byte salt |
|
|
48
|
+
| AES key export | Disabled |
|
|
49
|
+
|
|
50
|
+
The header and full witness are authenticated with the encrypted payload. The [protocol specification](docs/PROTOCOL.md) defines byte layout and domain separation.
|
|
51
|
+
|
|
52
|
+
## Operational contract
|
|
53
|
+
|
|
54
|
+
One SDK instance uses one connection. Successful Read/Create/Update subscribes it before ACK. Its own write is confirmed by ACK; other subscribers receive Changed. Disconnect removes subscriptions.
|
|
55
|
+
|
|
56
|
+
Content creation reserves an ID, then atomically updates the content and master together. The two commits are not one distributed transaction. Update batches and mixed Delete/Update batches must be atomic at the compatible server.
|
|
57
|
+
|
|
58
|
+
Conflicting writers do not merge. X permits one pending write per resource. S permits a bounded local chain of pending writes. Every operation retains its own ACK/outcome.
|
|
59
|
+
|
|
60
|
+
Writes are volatile and are not replayed automatically. Missing or invalid success ACKs produce UNKNOWN_OUTCOME. Explicit refresh may resolve working state without changing the original rejected promise.
|
|
61
|
+
|
|
62
|
+
Live updates require a valid chain transition. Full refresh/reconnect may accept an authenticated newer snapshot without missing intermediate history. The server's selection of that snapshot and its deletion notifications are trusted. Invalid input preserves verified local state and blocks normal writes.
|
|
63
|
+
|
|
64
|
+
Explicit content recovery creates a new resource from a confirmed local copy, replaces one catalog entry and keeps the old resource.
|
|
65
|
+
|
|
66
|
+
## Interfaces
|
|
67
|
+
|
|
68
|
+
Exports: `Ulda`, `SocketIoTransport` and `UldaError`.
|
|
69
|
+
|
|
70
|
+
The client provides registration/opening, CRUD, nested references, local snapshots, refresh, reconnect, explicit recovery, close, and status/change/error/trace/reconnect events. Signatures and error behavior are defined in [API.md](docs/API.md).
|
|
71
|
+
|
|
72
|
+
## Limits
|
|
73
|
+
|
|
74
|
+
| Limit | Value |
|
|
75
|
+
|---|---|
|
|
76
|
+
| Application JSON per resource | 1,048,576 UTF-8 bytes |
|
|
77
|
+
| JSON nesting depth | 48 |
|
|
78
|
+
| Visited JSON nodes | 40,000 |
|
|
79
|
+
| Content entries per master | 63 |
|
|
80
|
+
| Items per protocol batch/event | 64 |
|
|
81
|
+
| Combined witness/payload bytes per message | 8,388,608 |
|
|
82
|
+
| Binary attachments per Socket.IO packet | 128 |
|
|
83
|
+
| Bytes per binary attachment | 1,100,000 |
|
|
84
|
+
| Decoder text header | 65,536 UTF-8 bytes |
|
|
85
|
+
| Queued incoming handlers | 8 |
|
|
86
|
+
| Waiting/pending jobs per relevant outgoing queue | 128 |
|
|
87
|
+
| Content name | 1–256 UTF-16 code units |
|
|
88
|
+
| Master password input | 1–1024 UTF-16 code units |
|
|
89
|
+
|
|
90
|
+
Container overhead and catalog metadata consume additional space; not every theoretical maximum can necessarily be combined in one batch. Oversized Read requests can be split into smaller groups. Atomic writes are not split.
|
|
91
|
+
|
|
92
|
+
## Environment and distribution
|
|
93
|
+
|
|
94
|
+
Node.js 22 or later; browser ES2022 with Web Crypto and WebSocket in a secure context. HTTPS endpoints are required except explicit HTTP loopback development.
|
|
95
|
+
|
|
96
|
+
The normal ESM entry uses npm dependencies. The browser ESM bundles them and includes their license notices. The package contains runtime modules, declarations, the browser bundle and user documentation. Test fixtures and maintainer tooling are repository-only.
|
|
97
|
+
|
|
98
|
+
Private fields, non-extractable keys and best-effort cleanup do not isolate secrets from hostile code controlling the same page or process. [Secret lifecycle](docs/SECRET_LIFECYCLE.md) defines cleanup responsibilities.
|
|
99
|
+
|
|
100
|
+
The [ULDA Library Community Source License](LICENSE.md) governs the SDK. Dependencies retain their own licenses; the core and server have separate scopes.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ULDA Auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A JavaScript SDK for encrypted JSON resources over Socket.IO, built on [ULDA Core](https://github.com/ulda-io/ulda-core).
|
|
4
|
+
|
|
5
|
+
ULDA Auth encrypts application data on the client, maintains a separate ULDA chain for each resource, and synchronizes changes across connected clients. Applications work with JSON and explicit update methods.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
~~~sh
|
|
10
|
+
npm install ulda-auth
|
|
11
|
+
~~~
|
|
12
|
+
|
|
13
|
+
Requires Node.js 22 or later, or a browser with ES2022, Web Crypto and WebSocket support. Use an HTTPS endpoint running a compatible [ULDA protocol](docs/PROTOCOL.md) server. A generic Socket.IO server is not sufficient.
|
|
14
|
+
|
|
15
|
+
The package provides ES modules. JavaScript is the runtime implementation; TypeScript declarations are included for editor assistance and typed applications.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
The application supplies the server URL and a password obtained from the user.
|
|
20
|
+
|
|
21
|
+
~~~js
|
|
22
|
+
import { Ulda } from 'ulda-auth';
|
|
23
|
+
|
|
24
|
+
export async function createNotebook(endpoint, password) {
|
|
25
|
+
const ulda = new Ulda(endpoint);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
await ulda.ready;
|
|
29
|
+
const masterId = await ulda.register(password);
|
|
30
|
+
|
|
31
|
+
await ulda.add('notes', { title: 'First note', done: false });
|
|
32
|
+
await ulda.data.notes.title.update('Updated title');
|
|
33
|
+
|
|
34
|
+
const note = ulda.value('notes'); // An independent JSON copy.
|
|
35
|
+
return { masterId, note };
|
|
36
|
+
} finally {
|
|
37
|
+
await ulda.close();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
~~~
|
|
41
|
+
|
|
42
|
+
Keep the returned master ID: it identifies the encrypted catalog needed to reopen the data. Store and present it through your application. ULDA Auth does not provide usernames, password reset or an account directory.
|
|
43
|
+
|
|
44
|
+
To open an existing catalog:
|
|
45
|
+
|
|
46
|
+
~~~js
|
|
47
|
+
import { Ulda } from 'ulda-auth';
|
|
48
|
+
|
|
49
|
+
export async function openNotebook(endpoint, masterId, password) {
|
|
50
|
+
const ulda = new Ulda(endpoint);
|
|
51
|
+
try {
|
|
52
|
+
await ulda.connect(masterId, password);
|
|
53
|
+
return ulda; // The caller owns this session and must close it when finished.
|
|
54
|
+
} catch (error) {
|
|
55
|
+
await ulda.close();
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
~~~
|
|
60
|
+
|
|
61
|
+
Resource IDs are decimal **strings**, not JavaScript numbers.
|
|
62
|
+
|
|
63
|
+
## Working with data
|
|
64
|
+
|
|
65
|
+
~~~js
|
|
66
|
+
const notes = ulda.ref('notes');
|
|
67
|
+
|
|
68
|
+
const title = notes.title.get();
|
|
69
|
+
await notes.title.update('Another title');
|
|
70
|
+
await ulda.set('notes', ['done'], true);
|
|
71
|
+
|
|
72
|
+
// Editing a returned copy does not write to the server.
|
|
73
|
+
const copy = ulda.snapshot();
|
|
74
|
+
|
|
75
|
+
const unsubscribe = ulda.on('change', () => {
|
|
76
|
+
const current = ulda.snapshot();
|
|
77
|
+
// Render or otherwise use the current application data.
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Later:
|
|
81
|
+
unsubscribe();
|
|
82
|
+
await ulda.close();
|
|
83
|
+
~~~
|
|
84
|
+
|
|
85
|
+
References are explicit: use `.get()` to read a value and await `.update()` or `.delete()` to change it. Assigning to a reference does not save data and is rejected.
|
|
86
|
+
|
|
87
|
+
## Resource model
|
|
88
|
+
|
|
89
|
+
A **master** is an encrypted catalog of content IDs, names and secrets. A **content** resource holds application JSON. Each has its own encryption material and ULDA chain.
|
|
90
|
+
|
|
91
|
+
The server stores `id`, public `witness` and encrypted `payload`. Content names, catalog entries, application JSON and the full origin remain inside encrypted containers. IDs, lengths, witness metadata and traffic patterns remain visible.
|
|
92
|
+
|
|
93
|
+
Successful Create, Read and Update operations subscribe the connection to changes. The initiating connection receives an ACK; other subscribed connections receive updates. Disconnecting clears subscriptions, which are rebuilt by reading after reconnect.
|
|
94
|
+
|
|
95
|
+
## Concurrency and failures
|
|
96
|
+
|
|
97
|
+
- Mode **X**, the default, waits for an acknowledgement before sending the next write for that resource. Mode **S** allows a bounded sequence of pending writes.
|
|
98
|
+
- Conflicting writers do not merge automatically. Refresh, inspect the current data, and decide whether to apply the intended change again.
|
|
99
|
+
- A timeout after sending a write can produce `UNKNOWN_OUTCOME`: the server may have committed it. The SDK never automatically replays writes.
|
|
100
|
+
- Creating content uses two server commits: reserve its ID, then atomically update the content and master. An interrupted operation can leave an unreferenced encrypted resource.
|
|
101
|
+
- Reconnect retries are bounded. There is no persistent offline write queue.
|
|
102
|
+
|
|
103
|
+
See the [usage guide](docs/GUIDE.md) for errors, reconnect, deletion and recovery. Read the [security policy](SECURITY.md) before integrating sensitive data.
|
|
104
|
+
|
|
105
|
+
## Browser entry
|
|
106
|
+
|
|
107
|
+
With a bundler:
|
|
108
|
+
|
|
109
|
+
~~~js
|
|
110
|
+
import { Ulda } from 'ulda-auth/browser';
|
|
111
|
+
~~~
|
|
112
|
+
|
|
113
|
+
This entry bundles the core and Socket.IO dependencies. Without a bundler, host `dist/ulda-library.js` with the accompanying license notices and import it from your own page using `<script type="module">`. Bare npm package names require a bundler or import map.
|
|
114
|
+
|
|
115
|
+
## Documentation
|
|
116
|
+
|
|
117
|
+
- [Usage guide](docs/GUIDE.md) — complete workflows and examples.
|
|
118
|
+
- [API reference](docs/API.md) — methods, options, events and errors.
|
|
119
|
+
- [Protocol](docs/PROTOCOL.md) — socket events, binary records and server requirements.
|
|
120
|
+
- [Method pipelines](docs/PIPELINES.md) — internal steps for each operation.
|
|
121
|
+
- [Content recovery](docs/RECOVERY.md) — explicit replacement from a verified local copy.
|
|
122
|
+
- [Secret lifecycle](docs/SECRET_LIFECYCLE.md) — storage and cleanup in memory.
|
|
123
|
+
- [Manifest](MANIFEST.md) — architecture, supported profile and limits.
|
|
124
|
+
- [Security](SECURITY.md) — reporting vulnerabilities and the trust model.
|
|
125
|
+
|
|
126
|
+
For repository tooling, see [development](https://github.com/ulda-io/ulda-auth/blob/main/docs/DEVELOPMENT.md) and [publishing](https://github.com/ulda-io/ulda-auth/blob/main/docs/PUBLISHING.md).
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
[ULDA Library Community Source License 1.0](LICENSE.md), a source-available license with revenue and competitive-use conditions. Commercial licensing: [mark@shaposhnik.ch](mailto:mark@shaposhnik.ch).
|
|
131
|
+
|
|
132
|
+
See the [licensing guide](docs/LICENSING.md) for a summary. Dependencies retain their own licenses.
|