@rhizomes/rhizomatic 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +54 -0
- package/dist/alias.d.ts +4 -0
- package/dist/alias.d.ts.map +1 -0
- package/dist/alias.js +34 -0
- package/dist/alias.js.map +1 -0
- package/dist/cbor.d.ts +24 -0
- package/dist/cbor.d.ts.map +1 -0
- package/dist/cbor.js +267 -0
- package/dist/cbor.js.map +1 -0
- package/dist/delta.d.ts +8 -0
- package/dist/delta.d.ts.map +1 -0
- package/dist/delta.js +92 -0
- package/dist/delta.js.map +1 -0
- package/dist/derivation.d.ts +29 -0
- package/dist/derivation.d.ts.map +1 -0
- package/dist/derivation.js +183 -0
- package/dist/derivation.js.map +1 -0
- package/dist/eval.d.ts +91 -0
- package/dist/eval.d.ts.map +1 -0
- package/dist/eval.js +318 -0
- package/dist/eval.js.map +1 -0
- package/dist/hash.d.ts +4 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +17 -0
- package/dist/hash.js.map +1 -0
- package/dist/http.d.ts +21 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +110 -0
- package/dist/http.js.map +1 -0
- package/dist/hview.d.ts +15 -0
- package/dist/hview.d.ts.map +1 -0
- package/dist/hview.js +72 -0
- package/dist/hview.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/json-profile.d.ts +4 -0
- package/dist/json-profile.d.ts.map +1 -0
- package/dist/json-profile.js +97 -0
- package/dist/json-profile.js.map +1 -0
- package/dist/pack.d.ts +5 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +227 -0
- package/dist/pack.js.map +1 -0
- package/dist/peer.d.ts +26 -0
- package/dist/peer.d.ts.map +1 -0
- package/dist/peer.js +111 -0
- package/dist/peer.js.map +1 -0
- package/dist/policy.d.ts +46 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +186 -0
- package/dist/policy.js.map +1 -0
- package/dist/pred.d.ts +78 -0
- package/dist/pred.d.ts.map +1 -0
- package/dist/pred.js +228 -0
- package/dist/pred.js.map +1 -0
- package/dist/reactor.d.ts +67 -0
- package/dist/reactor.d.ts.map +1 -0
- package/dist/reactor.js +433 -0
- package/dist/reactor.js.map +1 -0
- package/dist/schema-deltas.d.ts +14 -0
- package/dist/schema-deltas.d.ts.map +1 -0
- package/dist/schema-deltas.js +87 -0
- package/dist/schema-deltas.js.map +1 -0
- package/dist/schema.d.ts +17 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +102 -0
- package/dist/schema.js.map +1 -0
- package/dist/set.d.ts +18 -0
- package/dist/set.d.ts.map +1 -0
- package/dist/set.js +83 -0
- package/dist/set.js.map +1 -0
- package/dist/sign.d.ts +8 -0
- package/dist/sign.d.ts.map +1 -0
- package/dist/sign.js +44 -0
- package/dist/sign.js.map +1 -0
- package/dist/term-io.d.ts +13 -0
- package/dist/term-io.d.ts.map +1 -0
- package/dist/term-io.js +216 -0
- package/dist/term-io.js.map +1 -0
- package/dist/term-json.d.ts +7 -0
- package/dist/term-json.d.ts.map +1 -0
- package/dist/term-json.js +362 -0
- package/dist/term-json.js.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/vocab.d.ts +2 -0
- package/dist/vocab.d.ts.map +1 -0
- package/dist/vocab.js +4 -0
- package/dist/vocab.js.map +1 -0
- package/package.json +83 -0
- package/src/alias.ts +36 -0
- package/src/cbor.ts +280 -0
- package/src/delta.ts +89 -0
- package/src/derivation.ts +229 -0
- package/src/eval.ts +401 -0
- package/src/hash.ts +19 -0
- package/src/http.ts +124 -0
- package/src/hview.ts +91 -0
- package/src/index.ts +83 -0
- package/src/json-profile.ts +96 -0
- package/src/pack.ts +239 -0
- package/src/peer.ts +126 -0
- package/src/policy.ts +216 -0
- package/src/pred.ts +307 -0
- package/src/reactor.ts +490 -0
- package/src/schema-deltas.ts +100 -0
- package/src/schema.ts +111 -0
- package/src/set.ts +98 -0
- package/src/sign.ts +48 -0
- package/src/term-io.ts +228 -0
- package/src/term-json.ts +364 -0
- package/src/types.ts +38 -0
- package/src/vocab.ts +3 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Mykola Bilokonsky
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mykola Bilokonsky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @rhizomes/rhizomatic
|
|
2
|
+
|
|
3
|
+
The TypeScript reference implementation of **Rhizomatic** — a portable format for arbitrarily
|
|
4
|
+
relational data: composable, forkable, mergeable, and federatable by default.
|
|
5
|
+
|
|
6
|
+
- Every fact is a **signed, content-addressed delta** (an author's claim at a time).
|
|
7
|
+
- **Merge is union** — a grow-only set CRDT; any interleaving of the same deltas converges.
|
|
8
|
+
- **Truth is not stored; it is resolved per-reader** under a trust policy. Disagreement lives in
|
|
9
|
+
superposition until a policy picks. Provenance and time-travel are intrinsic.
|
|
10
|
+
|
|
11
|
+
This is **one of two parallel witnesses** to the [specification](https://github.com/mbilokonsky/rhizomatic/tree/main/spec)
|
|
12
|
+
(the other is a [Rust witness](https://github.com/mbilokonsky/rhizomatic/tree/main/implementations/rust)
|
|
13
|
+
in the same repo). Both pass the same
|
|
14
|
+
[conformance vectors](https://github.com/mbilokonsky/rhizomatic/tree/main/vectors), byte-for-byte —
|
|
15
|
+
determinism is the contract. See it run in the [interactive tour](https://mbilokonsky.github.io/rhizomatic/).
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install @rhizomes/rhizomatic
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick taste
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { authorForSeed, signClaims, verifyDelta, DeltaSet } from "@rhizomes/rhizomatic";
|
|
27
|
+
|
|
28
|
+
const seed = "00".repeat(32); // 32-byte hex seed — use real randomness in practice
|
|
29
|
+
const author = authorForSeed(seed);
|
|
30
|
+
|
|
31
|
+
// A delta is a signed set of pointers: an author's claim, content-addressed by its canonical bytes.
|
|
32
|
+
const delta = signClaims(
|
|
33
|
+
{
|
|
34
|
+
timestamp: 0,
|
|
35
|
+
author,
|
|
36
|
+
pointers: [{ role: "name", target: { kind: "primitive", value: "Ada" } }],
|
|
37
|
+
},
|
|
38
|
+
seed,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
verifyDelta(delta); // "verified" (content address holds + signature checks out)
|
|
42
|
+
|
|
43
|
+
const world = new DeltaSet();
|
|
44
|
+
world.add(delta); // deduped by id; merge two DeltaSets and you get their union
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The public surface also covers the operator algebra (`evalTerm`), schemas, resolution policies
|
|
48
|
+
(`resolveView`), packs (`packSet`/`unpackSet`), the reactor, federation (`Peer`), and derivation.
|
|
49
|
+
See the [spec](https://github.com/mbilokonsky/rhizomatic/tree/main/spec) for what each layer means.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
Dual-licensed under either of [MIT](https://github.com/mbilokonsky/rhizomatic/blob/main/LICENSE-MIT)
|
|
54
|
+
or [Apache-2.0](https://github.com/mbilokonsky/rhizomatic/blob/main/LICENSE-APACHE), at your option.
|
package/dist/alias.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../src/alias.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAcxC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAU9E;AAGD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAGlE"}
|
package/dist/alias.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Relation signatures (SPEC-9 §5): the deterministic answer to "what relation shape does this
|
|
2
|
+
// delta instantiate?" — the librarian's input, never part of evaluation semantics.
|
|
3
|
+
import { array, encode, tstr } from "./cbor.js";
|
|
4
|
+
import { bytesToHex } from "./hash.js";
|
|
5
|
+
function byteCompare(a, b) {
|
|
6
|
+
const n = Math.min(a.length, b.length);
|
|
7
|
+
for (let i = 0; i < n; i++) {
|
|
8
|
+
const d = a[i] - b[i];
|
|
9
|
+
if (d !== 0)
|
|
10
|
+
return d;
|
|
11
|
+
}
|
|
12
|
+
return a.length - b.length;
|
|
13
|
+
}
|
|
14
|
+
// The [role, context] pairs ([role] when the pointer has no context) of the delta's EntityRef
|
|
15
|
+
// pointers, sorted bytewise by their canonical CBOR encoding. Primitive and DeltaRef pointers
|
|
16
|
+
// contribute nothing: primitives are not vertices (SPEC-1 §2.3); delta references are plumbing.
|
|
17
|
+
export function relationSignature(delta) {
|
|
18
|
+
const pairs = [];
|
|
19
|
+
for (const ptr of delta.claims.pointers) {
|
|
20
|
+
if (ptr.target.kind !== "entity")
|
|
21
|
+
continue;
|
|
22
|
+
const context = ptr.target.entity.context;
|
|
23
|
+
const pair = context === undefined ? [ptr.role] : [ptr.role, context];
|
|
24
|
+
pairs.push({ pair, bytes: encode(array(pair.map(tstr))) });
|
|
25
|
+
}
|
|
26
|
+
pairs.sort((a, b) => byteCompare(a.bytes, b.bytes));
|
|
27
|
+
return pairs.map((p) => p.pair);
|
|
28
|
+
}
|
|
29
|
+
// The signature's canonical form: the canonical CBOR of the sorted array of pairs.
|
|
30
|
+
export function relationSignatureCanonicalHex(delta) {
|
|
31
|
+
const pairs = relationSignature(delta).map((pair) => array(pair.map(tstr)));
|
|
32
|
+
return bytesToHex(encode(array(pairs)));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["../src/alias.ts"],"names":[],"mappings":"AA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AAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,6BAA6B,CAAC,KAAY;IACxD,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/cbor.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type CborValue = {
|
|
2
|
+
readonly t: "tstr";
|
|
3
|
+
readonly v: string;
|
|
4
|
+
} | {
|
|
5
|
+
readonly t: "float";
|
|
6
|
+
readonly v: number;
|
|
7
|
+
} | {
|
|
8
|
+
readonly t: "bool";
|
|
9
|
+
readonly v: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
readonly t: "array";
|
|
12
|
+
readonly v: readonly CborValue[];
|
|
13
|
+
} | {
|
|
14
|
+
readonly t: "map";
|
|
15
|
+
readonly v: ReadonlyArray<readonly [string, CborValue]>;
|
|
16
|
+
};
|
|
17
|
+
export declare const tstr: (v: string) => CborValue;
|
|
18
|
+
export declare const float: (v: number) => CborValue;
|
|
19
|
+
export declare const bool: (v: boolean) => CborValue;
|
|
20
|
+
export declare const array: (v: readonly CborValue[]) => CborValue;
|
|
21
|
+
export declare const map: (v: ReadonlyArray<readonly [string, CborValue]>) => CborValue;
|
|
22
|
+
export declare function encode(val: CborValue): Uint8Array;
|
|
23
|
+
export declare function decode(bytes: Uint8Array): CborValue;
|
|
24
|
+
//# sourceMappingURL=cbor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;CAAE,CAAC;AAEnF,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG,SAA+B,CAAC;AACjE,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,KAAG,SAAgC,CAAC;AACnE,eAAO,MAAM,IAAI,GAAI,GAAG,OAAO,KAAG,SAA+B,CAAC;AAClE,eAAO,MAAM,KAAK,GAAI,GAAG,SAAS,SAAS,EAAE,KAAG,SAAgC,CAAC;AACjF,eAAO,MAAM,GAAG,GAAI,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAG,SAA8B,CAAC;AA0JpG,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,UAAU,CAIjD;AAkGD,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAKnD"}
|
package/dist/cbor.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// Deterministic CBOR encoder — the Rhizomatic v0 canonicalization profile (RFC 8949 §4.2.1,
|
|
2
|
+
// as refined in spec/01-delta.ERRATA.md). Hand-rolled on purpose: this must reproduce the Rust
|
|
3
|
+
// encoder byte-for-byte, and the only way to guarantee that is to own every byte.
|
|
4
|
+
//
|
|
5
|
+
// Supported data items (exactly what the delta model needs): text string, float (numbers),
|
|
6
|
+
// bool, definite-length array, definite-length map (text-string keys, sorted).
|
|
7
|
+
export const tstr = (v) => ({ t: "tstr", v });
|
|
8
|
+
export const float = (v) => ({ t: "float", v });
|
|
9
|
+
export const bool = (v) => ({ t: "bool", v });
|
|
10
|
+
export const array = (v) => ({ t: "array", v });
|
|
11
|
+
export const map = (v) => ({ t: "map", v });
|
|
12
|
+
class ByteSink {
|
|
13
|
+
bytes = [];
|
|
14
|
+
push(...b) {
|
|
15
|
+
for (const x of b)
|
|
16
|
+
this.bytes.push(x & 0xff);
|
|
17
|
+
}
|
|
18
|
+
pushBytes(arr) {
|
|
19
|
+
for (const x of arr)
|
|
20
|
+
this.bytes.push(x);
|
|
21
|
+
}
|
|
22
|
+
toUint8Array() {
|
|
23
|
+
return Uint8Array.from(this.bytes);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Write a CBOR head: major type (high 3 bits) plus an unsigned argument, shortest form.
|
|
27
|
+
function writeHead(sink, major, arg) {
|
|
28
|
+
const mt = major << 5;
|
|
29
|
+
if (arg < 24) {
|
|
30
|
+
sink.push(mt | arg);
|
|
31
|
+
}
|
|
32
|
+
else if (arg < 0x100) {
|
|
33
|
+
sink.push(mt | 24, arg);
|
|
34
|
+
}
|
|
35
|
+
else if (arg < 0x10000) {
|
|
36
|
+
sink.push(mt | 25, (arg >> 8) & 0xff, arg & 0xff);
|
|
37
|
+
}
|
|
38
|
+
else if (arg <= 0xffffffff) {
|
|
39
|
+
sink.push(mt | 26, (arg >>> 24) & 0xff, (arg >>> 16) & 0xff, (arg >>> 8) & 0xff, arg & 0xff);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Only reachable for absurd lengths; included for totality.
|
|
43
|
+
const hi = Math.floor(arg / 0x100000000);
|
|
44
|
+
const lo = arg >>> 0;
|
|
45
|
+
sink.push(mt | 27, (hi >>> 24) & 0xff, (hi >>> 16) & 0xff, (hi >>> 8) & 0xff, hi & 0xff, (lo >>> 24) & 0xff, (lo >>> 16) & 0xff, (lo >>> 8) & 0xff, lo & 0xff);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const fbuf = new DataView(new ArrayBuffer(8));
|
|
49
|
+
// Returns the IEEE-754 binary16 bit pattern for n if (and only if) f16 represents n exactly,
|
|
50
|
+
// else null. n must be finite and exactly representable as f32 (caller guarantees both).
|
|
51
|
+
function tryF16Bits(n) {
|
|
52
|
+
fbuf.setFloat32(0, n);
|
|
53
|
+
const bits = fbuf.getUint32(0);
|
|
54
|
+
const sign = ((bits >>> 31) & 1) << 15;
|
|
55
|
+
const exp = (bits >>> 23) & 0xff;
|
|
56
|
+
const mant = bits & 0x7fffff;
|
|
57
|
+
if (exp === 0 && mant === 0)
|
|
58
|
+
return sign; // zero (-0 already normalized away by caller)
|
|
59
|
+
const e = exp - 127; // unbiased exponent (f32 subnormals land at -127 and fall through)
|
|
60
|
+
if (e >= -14 && e <= 15) {
|
|
61
|
+
// f16 normal range: the 23-bit mantissa must fit in 10 bits.
|
|
62
|
+
if ((mant & 0x1fff) !== 0)
|
|
63
|
+
return null;
|
|
64
|
+
return sign | ((e + 15) << 10) | (mant >>> 13);
|
|
65
|
+
}
|
|
66
|
+
if (e >= -24 && e <= -15) {
|
|
67
|
+
// f16 subnormal range: value must be an exact multiple of 2^-24.
|
|
68
|
+
const shift = -(e + 1); // 14..23
|
|
69
|
+
const sig = 0x800000 | mant; // full 24-bit significand
|
|
70
|
+
if ((sig & ((1 << shift) - 1)) !== 0)
|
|
71
|
+
return null;
|
|
72
|
+
return sign | (sig >>> shift);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
// ERRATA D1: numbers encode as float only, in the shortest of f16/f32/f64 that represents the
|
|
77
|
+
// value exactly (RFC 8949 §4.2.1). -0.0 is normalized to +0.0.
|
|
78
|
+
function writeFloat(sink, value) {
|
|
79
|
+
if (!Number.isFinite(value)) {
|
|
80
|
+
throw new Error(`non-finite number is not representable: ${value}`);
|
|
81
|
+
}
|
|
82
|
+
const n = value + 0; // normalize -0 to +0
|
|
83
|
+
if (Math.fround(n) === n) {
|
|
84
|
+
const h = tryF16Bits(n);
|
|
85
|
+
if (h !== null) {
|
|
86
|
+
sink.push(0xf9, (h >>> 8) & 0xff, h & 0xff);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
fbuf.setFloat32(0, n);
|
|
90
|
+
sink.push(0xfa, fbuf.getUint8(0), fbuf.getUint8(1), fbuf.getUint8(2), fbuf.getUint8(3));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
fbuf.setFloat64(0, n);
|
|
94
|
+
sink.push(0xfb, fbuf.getUint8(0), fbuf.getUint8(1), fbuf.getUint8(2), fbuf.getUint8(3), fbuf.getUint8(4), fbuf.getUint8(5), fbuf.getUint8(6), fbuf.getUint8(7));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function cmpBytes(a, b) {
|
|
98
|
+
const n = Math.min(a.length, b.length);
|
|
99
|
+
for (let i = 0; i < n; i++) {
|
|
100
|
+
const d = a[i] - b[i];
|
|
101
|
+
if (d !== 0)
|
|
102
|
+
return d;
|
|
103
|
+
}
|
|
104
|
+
return a.length - b.length;
|
|
105
|
+
}
|
|
106
|
+
const utf8 = new TextEncoder();
|
|
107
|
+
function encodeInto(sink, val) {
|
|
108
|
+
switch (val.t) {
|
|
109
|
+
case "tstr": {
|
|
110
|
+
const bytes = utf8.encode(val.v.normalize("NFC"));
|
|
111
|
+
writeHead(sink, 3, bytes.length);
|
|
112
|
+
sink.pushBytes(bytes);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
case "bool":
|
|
116
|
+
sink.push(val.v ? 0xf5 : 0xf4);
|
|
117
|
+
return;
|
|
118
|
+
case "float":
|
|
119
|
+
writeFloat(sink, val.v);
|
|
120
|
+
return;
|
|
121
|
+
case "array":
|
|
122
|
+
writeHead(sink, 4, val.v.length);
|
|
123
|
+
for (const item of val.v)
|
|
124
|
+
encodeInto(sink, item);
|
|
125
|
+
return;
|
|
126
|
+
case "map": {
|
|
127
|
+
// ERRATA D4: sort entries by bytewise lex order of the encoded key.
|
|
128
|
+
const entries = val.v.map(([k, v]) => {
|
|
129
|
+
const ks = new ByteSink();
|
|
130
|
+
encodeInto(ks, tstr(k));
|
|
131
|
+
return { key: ks.toUint8Array(), value: v };
|
|
132
|
+
});
|
|
133
|
+
entries.sort((a, b) => cmpBytes(a.key, b.key));
|
|
134
|
+
for (let i = 1; i < entries.length; i++) {
|
|
135
|
+
if (cmpBytes(entries[i - 1].key, entries[i].key) === 0) {
|
|
136
|
+
throw new Error("duplicate map key in canonical CBOR");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
writeHead(sink, 5, entries.length);
|
|
140
|
+
for (const e of entries) {
|
|
141
|
+
sink.pushBytes(e.key);
|
|
142
|
+
encodeInto(sink, e.value);
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export function encode(val) {
|
|
149
|
+
const sink = new ByteSink();
|
|
150
|
+
encodeInto(sink, val);
|
|
151
|
+
return sink.toUint8Array();
|
|
152
|
+
}
|
|
153
|
+
// --- strict decoder for the Rhizomatic profile ----------------------------------------------------
|
|
154
|
+
// Accepts exactly the items the profile emits: definite text strings, f16/f32/f64 floats, bools,
|
|
155
|
+
// definite arrays, definite maps with text keys. Everything else (ints, byte strings, tags,
|
|
156
|
+
// indefinite lengths, null/undefined) is rejected. Canonicality is checked by re-encoding where a
|
|
157
|
+
// caller needs it; this decoder checks structure only.
|
|
158
|
+
const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
159
|
+
class ByteReader {
|
|
160
|
+
bytes;
|
|
161
|
+
pos = 0;
|
|
162
|
+
constructor(bytes) {
|
|
163
|
+
this.bytes = bytes;
|
|
164
|
+
}
|
|
165
|
+
u8() {
|
|
166
|
+
if (this.pos >= this.bytes.length)
|
|
167
|
+
throw new Error("cbor: unexpected end of input");
|
|
168
|
+
return this.bytes[this.pos++];
|
|
169
|
+
}
|
|
170
|
+
take(n) {
|
|
171
|
+
if (this.pos + n > this.bytes.length)
|
|
172
|
+
throw new Error("cbor: unexpected end of input");
|
|
173
|
+
const out = this.bytes.subarray(this.pos, this.pos + n);
|
|
174
|
+
this.pos += n;
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
done() {
|
|
178
|
+
return this.pos === this.bytes.length;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function readLength(r, info) {
|
|
182
|
+
if (info < 24)
|
|
183
|
+
return info;
|
|
184
|
+
if (info === 24)
|
|
185
|
+
return r.u8();
|
|
186
|
+
if (info === 25)
|
|
187
|
+
return (r.u8() << 8) | r.u8();
|
|
188
|
+
if (info === 26)
|
|
189
|
+
return ((r.u8() << 24) | (r.u8() << 16) | (r.u8() << 8) | r.u8()) >>> 0;
|
|
190
|
+
throw new Error(`cbor: unsupported length encoding (info ${info})`);
|
|
191
|
+
}
|
|
192
|
+
function f16BitsToNumber(bits) {
|
|
193
|
+
const sign = bits & 0x8000 ? -1 : 1;
|
|
194
|
+
const exp = (bits >> 10) & 0x1f;
|
|
195
|
+
const mant = bits & 0x3ff;
|
|
196
|
+
if (exp === 0)
|
|
197
|
+
return sign * mant * 2 ** -24;
|
|
198
|
+
if (exp === 31)
|
|
199
|
+
throw new Error("cbor: non-finite f16 is not representable");
|
|
200
|
+
return sign * (1 + mant / 1024) * 2 ** (exp - 15);
|
|
201
|
+
}
|
|
202
|
+
function decodeItem(r) {
|
|
203
|
+
const head = r.u8();
|
|
204
|
+
const major = head >> 5;
|
|
205
|
+
const info = head & 0x1f;
|
|
206
|
+
switch (major) {
|
|
207
|
+
case 3: {
|
|
208
|
+
const len = readLength(r, info);
|
|
209
|
+
return tstr(utf8Decoder.decode(r.take(len)));
|
|
210
|
+
}
|
|
211
|
+
case 4: {
|
|
212
|
+
const len = readLength(r, info);
|
|
213
|
+
const items = [];
|
|
214
|
+
for (let i = 0; i < len; i++)
|
|
215
|
+
items.push(decodeItem(r));
|
|
216
|
+
return array(items);
|
|
217
|
+
}
|
|
218
|
+
case 5: {
|
|
219
|
+
const len = readLength(r, info);
|
|
220
|
+
const entries = [];
|
|
221
|
+
for (let i = 0; i < len; i++) {
|
|
222
|
+
const key = decodeItem(r);
|
|
223
|
+
if (key.t !== "tstr")
|
|
224
|
+
throw new Error("cbor: map keys must be text strings");
|
|
225
|
+
entries.push([key.v, decodeItem(r)]);
|
|
226
|
+
}
|
|
227
|
+
return map(entries);
|
|
228
|
+
}
|
|
229
|
+
case 7: {
|
|
230
|
+
if (info === 20)
|
|
231
|
+
return bool(false);
|
|
232
|
+
if (info === 21)
|
|
233
|
+
return bool(true);
|
|
234
|
+
if (info === 25) {
|
|
235
|
+
const b = r.take(2);
|
|
236
|
+
return float(f16BitsToNumber((b[0] << 8) | b[1]));
|
|
237
|
+
}
|
|
238
|
+
if (info === 26) {
|
|
239
|
+
const b = r.take(4);
|
|
240
|
+
const dv = new DataView(b.buffer, b.byteOffset, 4);
|
|
241
|
+
const n = dv.getFloat32(0);
|
|
242
|
+
if (!Number.isFinite(n))
|
|
243
|
+
throw new Error("cbor: non-finite float is not representable");
|
|
244
|
+
return float(n);
|
|
245
|
+
}
|
|
246
|
+
if (info === 27) {
|
|
247
|
+
const b = r.take(8);
|
|
248
|
+
const dv = new DataView(b.buffer, b.byteOffset, 8);
|
|
249
|
+
const n = dv.getFloat64(0);
|
|
250
|
+
if (!Number.isFinite(n))
|
|
251
|
+
throw new Error("cbor: non-finite float is not representable");
|
|
252
|
+
return float(n);
|
|
253
|
+
}
|
|
254
|
+
throw new Error(`cbor: unsupported simple/float (info ${info})`);
|
|
255
|
+
}
|
|
256
|
+
default:
|
|
257
|
+
throw new Error(`cbor: major type ${major} is outside the Rhizomatic profile`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
export function decode(bytes) {
|
|
261
|
+
const r = new ByteReader(bytes);
|
|
262
|
+
const v = decodeItem(r);
|
|
263
|
+
if (!r.done())
|
|
264
|
+
throw new Error("cbor: trailing bytes after item");
|
|
265
|
+
return v;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=cbor.js.map
|
package/dist/cbor.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbor.js","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,+FAA+F;AAC/F,kFAAkF;AAClF,EAAE;AACF,2FAA2F;AAC3F,+EAA+E;AAS/E,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAU,EAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAuB,EAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AACjF,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AAoC,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAiB;IACtC,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAClE,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/delta.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CborValue } from "./cbor.js";
|
|
2
|
+
import type { Claims } from "./types.js";
|
|
3
|
+
export declare function claimsToCbor(claims: Claims): CborValue;
|
|
4
|
+
export declare function assertValidClaims(claims: Claims): void;
|
|
5
|
+
export declare function canonicalBytes(claims: Claims): Uint8Array;
|
|
6
|
+
export declare function canonicalHex(claims: Claims): string;
|
|
7
|
+
export declare function computeId(claims: Claims): string;
|
|
8
|
+
//# sourceMappingURL=delta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["../src/delta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAyC,MAAM,WAAW,CAAC;AAElF,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,YAAY,CAAC;AA8B1D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAMtD;AASD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA4BtD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAGzD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|