this.me 3.0.27 → 3.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -66
- package/dist/index.d.ts +0 -1
- package/dist/me.cjs +8 -0
- package/dist/me.es.d.ts +0 -4
- package/dist/me.es.js +407 -162
- package/dist/me.umd.js +2 -2
- package/dist/src/me.d.ts +84 -33
- package/package.json +6 -2
- package/dist/me.cjs.js +0 -8
- package/dist/src/tests.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,129 +1,327 @@
|
|
|
1
|
-
<img src="https://res.cloudinary.com/dkwnxf6gm/image/upload/v1761149332/this.me-removebg-preview_2_j1eoiy.png" alt="
|
|
1
|
+
<img src="https://res.cloudinary.com/dkwnxf6gm/image/upload/v1761149332/this.me-removebg-preview_2_j1eoiy.png" alt=".me Logo" width="180" />
|
|
2
2
|
|
|
3
|
-
# .
|
|
4
|
-
You can use **.me** both in **browser** and **Node** environments.
|
|
5
|
-
#### **1. NODEJS**
|
|
6
|
-
Using **npm**:
|
|
3
|
+
# .me
|
|
7
4
|
|
|
5
|
+
##### **1. NPM:**
|
|
8
6
|
```bash
|
|
9
7
|
npm install this.me
|
|
10
8
|
```
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
##### **2. Browser:**
|
|
13
11
|
|
|
14
12
|
```html
|
|
15
|
-
<script src="
|
|
13
|
+
<script src="me.umd.js"></script>
|
|
16
14
|
<script>
|
|
17
|
-
|
|
18
|
-
console.log(me); // Ready to use after initialization
|
|
15
|
+
const me = new Me.ME("secret");
|
|
19
16
|
</script>
|
|
20
17
|
```
|
|
21
18
|
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
19
|
<img src="https://suign.github.io/assets/imgs/monads.png" alt="Cleak Me Please" width="244">Hello, I am **.me**
|
|
27
20
|
----
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
## Declarative Identity Language
|
|
23
|
+
A minimal, expressive, infinitely nested identity calculus.
|
|
30
24
|
|
|
31
|
-
`.me` is a
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
`.me` is a **language** — a semantic engine that builds identity, meaning, structure, and **encrypted universes** through simple expressions.
|
|
26
|
+
|
|
27
|
+
Everything emerges from two primitives:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
// Declare meaning
|
|
31
|
+
// Resolve meaning
|
|
32
|
+
```
|
|
34
33
|
|
|
35
34
|
---
|
|
36
35
|
|
|
37
|
-
##
|
|
36
|
+
## .me in 20 Seconds
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
###### **Declare**
|
|
39
|
+
```ts
|
|
40
|
+
me.profile.name("Abella");
|
|
41
|
+
me.profile.age(30);
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
###### **Read**
|
|
45
45
|
```ts
|
|
46
|
-
|
|
46
|
+
me("profile.name"); // → "Abella"
|
|
47
|
+
me("profile.age"); // → 30
|
|
48
|
+
```
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
##### **Use in expressions**
|
|
51
|
+
```ts
|
|
52
|
+
if (me("profile.age") > 18) {
|
|
53
|
+
console.log("Adult");
|
|
54
|
+
}
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
---
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
# 🌳 Infinite Semantic Trees
|
|
60
|
+
**.me** supports infinite nesting:
|
|
56
61
|
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.log(me.export());
|
|
63
|
-
</script>
|
|
62
|
+
```ts
|
|
63
|
+
me.system.audio.filters.lowpass.cutoff(1200);
|
|
64
|
+
me.system.audio.filters.lowpass.resonance(0.7);
|
|
65
|
+
me("system.audio.filters.lowpass");
|
|
66
|
+
// → { cutoff: 1200, resonance: 0.7 }
|
|
64
67
|
```
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
You can construct any conceptual universe:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
me.synth.moog.grandmother.osc1.wave("triangle");
|
|
73
|
+
me.synth.moog.grandmother.osc2.wave("square");
|
|
74
|
+
me("synth.moog.grandmother.osc1.wave");
|
|
75
|
+
// → "triangle"
|
|
76
|
+
```
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
---
|
|
69
79
|
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
# 🔐 Secrets: Encrypted Universes
|
|
81
|
+
Secrets create private branches:
|
|
72
82
|
|
|
73
83
|
```ts
|
|
74
|
-
me.
|
|
75
|
-
me.
|
|
84
|
+
me.wallet.balance(500).secret("ABC");
|
|
85
|
+
me.wallet.transactions.list([1,2,3]).secret("ABC");
|
|
76
86
|
```
|
|
77
87
|
|
|
78
|
-
|
|
88
|
+
Everything under that secret becomes encrypted as a single blob.
|
|
89
|
+
To access it:
|
|
79
90
|
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"signature": "0x...",
|
|
85
|
-
"timestamp": 0000
|
|
86
|
-
}
|
|
91
|
+
```ts
|
|
92
|
+
me.secret("ABC");
|
|
93
|
+
me("wallet");
|
|
94
|
+
// → { balance: 500, transactions: { list:[1,2,3] } }
|
|
87
95
|
```
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
Declarations may reference previous declarations using pointers:
|
|
97
|
+
Secrets can nest infinitely
|
|
91
98
|
|
|
92
99
|
```ts
|
|
93
|
-
|
|
94
|
-
me.
|
|
100
|
+
me.wallet.hidden.note("private").secret("ABC").secret("DEEP");
|
|
101
|
+
me.secret("ABC");
|
|
102
|
+
me.secret("DEEP");
|
|
103
|
+
me("wallet.hidden");
|
|
104
|
+
// → { note: "private" }
|
|
95
105
|
```
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
- **A secret belongs to a specific position in the identity tree.**
|
|
108
|
+
- Everything under that position becomes encrypted.
|
|
109
|
+
- If you declare another secret inside, it becomes a deeper encrypted universe.
|
|
110
|
+
- Accessing the deepest universe requires walking the chain of secrets.
|
|
98
111
|
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
## **🌳 A secret attaches to a position in the tree**
|
|
113
|
+
You do:
|
|
101
114
|
|
|
102
|
-
```ts
|
|
103
|
-
me.export();
|
|
104
115
|
```
|
|
116
|
+
me.wallet.secret("ABC");
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**.me** interprets this as:
|
|
120
|
+
> “The subtree starting at wallet is encrypted with ABC.”
|
|
121
|
+
Diagram:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
root
|
|
125
|
+
└── wallet (SECRET ABC)
|
|
126
|
+
├── balance
|
|
127
|
+
└── transactions
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Everything below wallet is encrypted **as one block**.
|
|
131
|
+
|
|
132
|
+
#### 🌚 Declaring another secret inside creates a nested universe
|
|
133
|
+
You do:
|
|
134
|
+
```
|
|
135
|
+
me.wallet.private.secret("DEEP");
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Now **.me** interprets:
|
|
139
|
+
> “Inside wallet/ (encrypted under ABC), private/ will be encrypted under DEEP.”
|
|
140
|
+
Visual:
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
root
|
|
144
|
+
└── wallet (SECRET ABC)
|
|
145
|
+
├── balance
|
|
146
|
+
├── transactions
|
|
147
|
+
└── private (SECRET DEEP)
|
|
148
|
+
└── ...nodes...
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### 🔐 Accessing nested secrets requires walking the secret chain
|
|
152
|
+
To read the inner content:
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
me.secret("ABC"); // unlock wallet universe
|
|
156
|
+
me.secret("DEEP"); // unlock nested private universe
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Then:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
me("wallet.private") // returns decrypted inner structure
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### **🌌 You can nest as many secrets as you want**
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
me.x.secret("A");
|
|
169
|
+
me.x.y.secret("B");
|
|
170
|
+
me.x.y.z.secret("C");
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
To access:
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
me.secret("A");
|
|
177
|
+
me.secret("B");
|
|
178
|
+
me.secret("C");
|
|
179
|
+
me("x.y.z"); // fully decrypted
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Visual:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
x (A)
|
|
186
|
+
└── y (B)
|
|
187
|
+
└── z (C)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Every deeper secret is a smaller encrypted universe inside a larger encrypted universe.
|
|
191
|
+
This is **fractal encryption**.
|
|
192
|
+
Let’s rewrite your example cleanly:
|
|
193
|
+
|
|
194
|
+
```js
|
|
195
|
+
me.cars.keys.secret("X");
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
> “Does this mean cars.keys is public, but everything *inside* keys (after calling secret) becomes encrypted?”
|
|
199
|
+
##### **✔ YES.**
|
|
200
|
+
- cars → public
|
|
201
|
+
- cars.keys → public *branch*
|
|
202
|
+
|
|
203
|
+
- **everything inside** **cars.keys.\***
|
|
204
|
+
(anything you declare after calling secret)
|
|
205
|
+
→ encrypted under "X"
|
|
206
|
+
|
|
207
|
+
##### **✔ Exactly that.**
|
|
208
|
+
# **💥 Important clarification:**
|
|
209
|
+
The part confusing is this:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
me.wallet.balance(500).secret("ABC");
|
|
213
|
+
me.wallet.transactions.list([1,2,3]).secret("ABC");
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
You thought:
|
|
217
|
+
|
|
218
|
+
> “Secret should attach to the position and encrypt everything coming after it.”
|
|
219
|
+
YES — that is what ME does.
|
|
220
|
+
But because each declaration is on a different line, you call .secret twice.
|
|
221
|
+
ME then merges both values under the same secret scope.
|
|
222
|
+
If you want **position-based secrets**, you can also do:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
me.wallet.secret("ABC");
|
|
226
|
+
me.wallet.balance(500);
|
|
227
|
+
me.wallet.transactions.list([1,2,3]);
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Same result.
|
|
231
|
+
|
|
232
|
+
# **🧠 So to answer common questions:**
|
|
233
|
+
##### **✔ Yes — you can declare secrets at specific positions.**
|
|
234
|
+
##### **✔ Yes — everything under that branch becomes encrypted.**
|
|
235
|
+
##### **✔ Yes — you can put another secret deeper.**
|
|
236
|
+
##### **✔ Yes — to access you must follow the entire chain of secrets.**
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
# 🧬 Why ME Works
|
|
241
|
+
|
|
242
|
+
- Proxies → infinite language surface
|
|
243
|
+
- Path strings → universal query interface
|
|
244
|
+
- Values → semantic meaning, not strict types
|
|
245
|
+
- Secrets → fractal encrypted universes
|
|
246
|
+
- Export → deterministic declarative identity
|
|
247
|
+
- Zero dependencies
|
|
248
|
+
- Browser & Node compatible
|
|
105
249
|
|
|
106
250
|
---
|
|
107
251
|
|
|
108
|
-
|
|
252
|
+
# 📦 Export Identity
|
|
109
253
|
|
|
110
|
-
|
|
254
|
+
```ts
|
|
255
|
+
console.log(me.export());
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Produces a deterministic structure:
|
|
111
259
|
|
|
112
260
|
```json
|
|
113
261
|
{
|
|
114
|
-
"identityRoot": "...",
|
|
262
|
+
"identityRoot": "0xabc...",
|
|
115
263
|
"publicKey": "...",
|
|
116
|
-
"namespace": "...",
|
|
117
264
|
"identityHash": "...",
|
|
118
|
-
"declarations": [
|
|
265
|
+
"declarations": [
|
|
266
|
+
{ "key": "profile.name", "value": "Abella", ... },
|
|
267
|
+
{ "key": "profile.age", "value": 30, ... }
|
|
268
|
+
]
|
|
119
269
|
}
|
|
120
270
|
```
|
|
121
271
|
|
|
122
|
-
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
# 🧠 Full Example
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import { ME } from "this.me";
|
|
278
|
+
|
|
279
|
+
const me = new ME("my-secret");
|
|
280
|
+
|
|
281
|
+
// Declare identity
|
|
282
|
+
me.name.first("Abella");
|
|
283
|
+
me.name.last("Eggleton");
|
|
284
|
+
me.profile.role("Musician");
|
|
285
|
+
me.profile.age(30);
|
|
286
|
+
|
|
287
|
+
// Semantic universes
|
|
288
|
+
me.system.audio.filters.lowpass.cutoff(1200);
|
|
289
|
+
me.system.audio.filters.lowpass.resonance(0.7);
|
|
290
|
+
|
|
291
|
+
// Encrypted branch
|
|
292
|
+
me.wallet.balance(500).secret("XYZ");
|
|
293
|
+
me.wallet.transactions.list([1,2,3]).secret("XYZ");
|
|
294
|
+
|
|
295
|
+
// Read values
|
|
296
|
+
console.log(me("name.first")); // "Abella"
|
|
297
|
+
console.log(me("profile.age")); // 30
|
|
298
|
+
|
|
299
|
+
// Logic
|
|
300
|
+
if (me("profile.age") > 21) {
|
|
301
|
+
console.log("Access granted");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Export
|
|
305
|
+
console.log(JSON.stringify(me.export(), null, 2));
|
|
306
|
+
```
|
|
123
307
|
|
|
124
308
|
---
|
|
125
309
|
|
|
126
|
-
|
|
310
|
+
# ▵ The Philosophy
|
|
311
|
+
A semantic language for identity, built from recursive declarations and symbolic paths.
|
|
312
|
+
`me` is ▵ **meaning** ▵ **identities** ▵ **universes** ▵ **meaning.**
|
|
313
|
+
With one primitive:
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
me
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
What **.me** unlocks is something the entire industry has failed to deliver: **true ownership of your identity**. Not through passwords, dashboards, cookie banners, or corporate “trust us” slogans — but through architecture. In **.me**, your data isn’t stored anywhere. It isn’t synced. It isn’t saved on a server you don’t control. Your identity is *derived*, meaning it only exists when *you* decide to bring it into existence. Secrets carve out private worlds inside your identity that are mathematically unreachable without your key. That means you can create layers of meaning, memory, and structure that no platform, provider, or device can see — or even detect. **No one can mine it**, leak it, subpoena it, or surveil it. Not because they’re nice, but because the system simply doesn’t expose what you don’t reveal. This is data freedom not as a policy, but as a *calculable fact*. A shift from platforms owning your life — to you owning your universes. - [suiGn](https://suign.github.io/)
|
|
320
|
+
|
|
321
|
+
<a href="https://www.neurons.me" target="_blank">
|
|
322
|
+
<img src="https://res.cloudinary.com/dkwnxf6gm/image/upload/v1760893633/npm-neurons-me_9b3e3a.jpg" style="zoom:16%;" /></a>
|
|
323
|
+
|
|
324
|
+
##### License
|
|
325
|
+
MIT © 2025 by https://neurons.me
|
|
326
|
+
See the [LICENSE](./LICENSE) file for details.
|
|
127
327
|
|
|
128
|
-
MIT License
|
|
129
|
-
Documentation: https://neurons.me
|
package/dist/index.d.ts
CHANGED
package/dist/me.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ae(E){return E&&E.__esModule&&Object.prototype.hasOwnProperty.call(E,"default")?E.default:E}var Ut={exports:{}};/**
|
|
2
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
|
+
*
|
|
4
|
+
* @version 0.9.3
|
|
5
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
+
* @copyright Chen, Yi-Cyuan 2015-2023
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/var te;function he(){return te||(te=1,(function(E){(function(){var i="input is invalid type",o="finalize already called",l=typeof window=="object",a=l?window:{};a.JS_SHA3_NO_WINDOW&&(l=!1);var y=!l&&typeof self=="object",b=!a.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;b?a=ce:y&&(a=self);for(var B=!a.JS_SHA3_NO_COMMON_JS&&!0&&E.exports,p=!a.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),P=[31,7936,2031616,520093696],k=[4,1024,262144,67108864],F=[1,256,65536,16777216],w=[6,1536,393216,100663296],v=[0,8,16,24],_=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],j=[224,256,384,512],C=[128,256],A=["hex","buffer","arrayBuffer","array","digest"],K={128:168,256:136},ee=a.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return Object.prototype.toString.call(t)==="[object Array]"}:Array.isArray,re=p&&(a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,Vt=function(t){var e=typeof t;if(e==="string")return[t,!0];if(e!=="object"||t===null)throw new Error(i);if(p&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!ee(t)&&!re(t))throw new Error(i);return[t,!1]},Gt=function(t){return Vt(t)[0].length===0},Jt=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},Yt=function(t,e,r){return function(n){return new g(t,e,t).update(n)[r]()}},qt=function(t,e,r){return function(n,c){return new g(t,e,c).update(n)[r]()}},$t=function(t,e,r){return function(n,c,h,u){return T["cshake"+t].update(n,c,h,u)[r]()}},Lt=function(t,e,r){return function(n,c,h,u){return T["kmac"+t].update(n,c,h,u)[r]()}},I=function(t,e,r,n){for(var c=0;c<A.length;++c){var h=A[c];t[h]=e(r,n,h)}return t},Xt=function(t,e){var r=Yt(t,e,"hex");return r.create=function(){return new g(t,e,t)},r.update=function(n){return r.create().update(n)},I(r,Yt,t,e)},ne=function(t,e){var r=qt(t,e,"hex");return r.create=function(n){return new g(t,e,n)},r.update=function(n,c){return r.create(c).update(n)},I(r,qt,t,e)},oe=function(t,e){var r=K[t],n=$t(t,e,"hex");return n.create=function(c,h,u){return Gt(h)&&Gt(u)?T["shake"+t].create(c):new g(t,e,c).bytepad([h,u],r)},n.update=function(c,h,u,f){return n.create(h,u,f).update(c)},I(n,$t,t,e)},ie=function(t,e){var r=K[t],n=Lt(t,e,"hex");return n.create=function(c,h,u){return new Wt(t,e,h).bytepad(["KMAC",u],r).bytepad([c],r)},n.update=function(c,h,u,f){return n.create(c,u,f).update(h)},I(n,Lt,t,e)},Zt=[{name:"keccak",padding:F,bits:j,createMethod:Xt},{name:"sha3",padding:w,bits:j,createMethod:Xt},{name:"shake",padding:P,bits:C,createMethod:ne},{name:"cshake",padding:k,bits:C,createMethod:oe},{name:"kmac",padding:k,bits:C,createMethod:ie}],T={},N=[],R=0;R<Zt.length;++R)for(var M=Zt[R],V=M.bits,D=0;D<V.length;++D){var zt=M.name+"_"+V[D];if(N.push(zt),T[zt]=M.createMethod(V[D],M.padding),M.name!=="sha3"){var Qt=M.name+V[D];N.push(Qt),T[Qt]=T[zt]}}function g(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(r&31)>>3;for(var n=0;n<50;++n)this.s[n]=0}g.prototype.update=function(t){if(this.finalized)throw new Error(o);var e=Vt(t);t=e[0];for(var r=e[1],n=this.blocks,c=this.byteCount,h=t.length,u=this.blockCount,f=0,S=this.s,s,x;f<h;){if(this.reset)for(this.reset=!1,n[0]=this.block,s=1;s<u+1;++s)n[s]=0;if(r)for(s=this.start;f<h&&s<c;++f)x=t.charCodeAt(f),x<128?n[s>>2]|=x<<v[s++&3]:x<2048?(n[s>>2]|=(192|x>>6)<<v[s++&3],n[s>>2]|=(128|x&63)<<v[s++&3]):x<55296||x>=57344?(n[s>>2]|=(224|x>>12)<<v[s++&3],n[s>>2]|=(128|x>>6&63)<<v[s++&3],n[s>>2]|=(128|x&63)<<v[s++&3]):(x=65536+((x&1023)<<10|t.charCodeAt(++f)&1023),n[s>>2]|=(240|x>>18)<<v[s++&3],n[s>>2]|=(128|x>>12&63)<<v[s++&3],n[s>>2]|=(128|x>>6&63)<<v[s++&3],n[s>>2]|=(128|x&63)<<v[s++&3]);else for(s=this.start;f<h&&s<c;++f)n[s>>2]|=t[f]<<v[s++&3];if(this.lastByteIndex=s,s>=c){for(this.start=s-c,this.block=n[u],s=0;s<u;++s)S[s]^=n[s];H(S),this.reset=!0}else this.start=s}return this},g.prototype.encode=function(t,e){var r=t&255,n=1,c=[r];for(t=t>>8,r=t&255;r>0;)c.unshift(r),t=t>>8,r=t&255,++n;return e?c.push(n):c.unshift(n),this.update(c),c.length},g.prototype.encodeString=function(t){var e=Vt(t);t=e[0];var r=e[1],n=0,c=t.length;if(r)for(var h=0;h<t.length;++h){var u=t.charCodeAt(h);u<128?n+=1:u<2048?n+=2:u<55296||u>=57344?n+=3:(u=65536+((u&1023)<<10|t.charCodeAt(++h)&1023),n+=4)}else n=c;return n+=this.encode(n*8),this.update(t),n},g.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var c=(e-r%e)%e,h=[];return h.length=c,this.update(h),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[e&3],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];H(n)}},g.prototype.toString=g.prototype.hex=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,c=0,h=0,u="",f;h<r;){for(c=0;c<t&&h<r;++c,++h)f=e[c],u+=d[f>>4&15]+d[f&15]+d[f>>12&15]+d[f>>8&15]+d[f>>20&15]+d[f>>16&15]+d[f>>28&15]+d[f>>24&15];h%t===0&&(e=Jt(e),H(e),c=0)}return n&&(f=e[c],u+=d[f>>4&15]+d[f&15],n>1&&(u+=d[f>>12&15]+d[f>>8&15]),n>2&&(u+=d[f>>20&15]+d[f>>16&15])),u},g.prototype.arrayBuffer=function(){this.finalize();var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,c=0,h=0,u=this.outputBits>>3,f;n?f=new ArrayBuffer(r+1<<2):f=new ArrayBuffer(u);for(var S=new Uint32Array(f);h<r;){for(c=0;c<t&&h<r;++c,++h)S[h]=e[c];h%t===0&&(e=Jt(e),H(e))}return n&&(S[h]=e[c],f=f.slice(0,u)),f},g.prototype.buffer=g.prototype.arrayBuffer,g.prototype.digest=g.prototype.array=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,c=0,h=0,u=[],f,S;h<r;){for(c=0;c<t&&h<r;++c,++h)f=h<<2,S=e[c],u[f]=S&255,u[f+1]=S>>8&255,u[f+2]=S>>16&255,u[f+3]=S>>24&255;h%t===0&&(e=Jt(e),H(e))}return n&&(f=h<<2,S=e[c],u[f]=S&255,n>1&&(u[f+1]=S>>8&255),n>2&&(u[f+2]=S>>16&255)),u};function Wt(t,e,r){g.call(this,t,e,r)}Wt.prototype=new g,Wt.prototype.finalize=function(){return this.encode(this.outputBits,!0),g.prototype.finalize.call(this)};var H=function(t){var e,r,n,c,h,u,f,S,s,x,J,z,W,U,m,G,Y,q,$,L,X,Z,Q,tt,et,rt,nt,ot,it,ct,at,ht,ft,lt,ut,st,yt,dt,bt,pt,vt,xt,gt,St,Pt,Bt,kt,At,Ft,wt,_t,jt,Ct,Ot,Et,Tt,Rt,Kt,Mt,Nt,Dt,Ht,It;for(n=0;n<48;n+=2)c=t[0]^t[10]^t[20]^t[30]^t[40],h=t[1]^t[11]^t[21]^t[31]^t[41],u=t[2]^t[12]^t[22]^t[32]^t[42],f=t[3]^t[13]^t[23]^t[33]^t[43],S=t[4]^t[14]^t[24]^t[34]^t[44],s=t[5]^t[15]^t[25]^t[35]^t[45],x=t[6]^t[16]^t[26]^t[36]^t[46],J=t[7]^t[17]^t[27]^t[37]^t[47],z=t[8]^t[18]^t[28]^t[38]^t[48],W=t[9]^t[19]^t[29]^t[39]^t[49],e=z^(u<<1|f>>>31),r=W^(f<<1|u>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=c^(S<<1|s>>>31),r=h^(s<<1|S>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=u^(x<<1|J>>>31),r=f^(J<<1|x>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=S^(z<<1|W>>>31),r=s^(W<<1|z>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=x^(c<<1|h>>>31),r=J^(h<<1|c>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,U=t[0],m=t[1],Bt=t[11]<<4|t[10]>>>28,kt=t[10]<<4|t[11]>>>28,ot=t[20]<<3|t[21]>>>29,it=t[21]<<3|t[20]>>>29,Nt=t[31]<<9|t[30]>>>23,Dt=t[30]<<9|t[31]>>>23,xt=t[40]<<18|t[41]>>>14,gt=t[41]<<18|t[40]>>>14,lt=t[2]<<1|t[3]>>>31,ut=t[3]<<1|t[2]>>>31,G=t[13]<<12|t[12]>>>20,Y=t[12]<<12|t[13]>>>20,At=t[22]<<10|t[23]>>>22,Ft=t[23]<<10|t[22]>>>22,ct=t[33]<<13|t[32]>>>19,at=t[32]<<13|t[33]>>>19,Ht=t[42]<<2|t[43]>>>30,It=t[43]<<2|t[42]>>>30,Ot=t[5]<<30|t[4]>>>2,Et=t[4]<<30|t[5]>>>2,st=t[14]<<6|t[15]>>>26,yt=t[15]<<6|t[14]>>>26,q=t[25]<<11|t[24]>>>21,$=t[24]<<11|t[25]>>>21,wt=t[34]<<15|t[35]>>>17,_t=t[35]<<15|t[34]>>>17,ht=t[45]<<29|t[44]>>>3,ft=t[44]<<29|t[45]>>>3,tt=t[6]<<28|t[7]>>>4,et=t[7]<<28|t[6]>>>4,Tt=t[17]<<23|t[16]>>>9,Rt=t[16]<<23|t[17]>>>9,dt=t[26]<<25|t[27]>>>7,bt=t[27]<<25|t[26]>>>7,L=t[36]<<21|t[37]>>>11,X=t[37]<<21|t[36]>>>11,jt=t[47]<<24|t[46]>>>8,Ct=t[46]<<24|t[47]>>>8,St=t[8]<<27|t[9]>>>5,Pt=t[9]<<27|t[8]>>>5,rt=t[18]<<20|t[19]>>>12,nt=t[19]<<20|t[18]>>>12,Kt=t[29]<<7|t[28]>>>25,Mt=t[28]<<7|t[29]>>>25,pt=t[38]<<8|t[39]>>>24,vt=t[39]<<8|t[38]>>>24,Z=t[48]<<14|t[49]>>>18,Q=t[49]<<14|t[48]>>>18,t[0]=U^~G&q,t[1]=m^~Y&$,t[10]=tt^~rt&ot,t[11]=et^~nt&it,t[20]=lt^~st&dt,t[21]=ut^~yt&bt,t[30]=St^~Bt&At,t[31]=Pt^~kt&Ft,t[40]=Ot^~Tt&Kt,t[41]=Et^~Rt&Mt,t[2]=G^~q&L,t[3]=Y^~$&X,t[12]=rt^~ot&ct,t[13]=nt^~it&at,t[22]=st^~dt&pt,t[23]=yt^~bt&vt,t[32]=Bt^~At&wt,t[33]=kt^~Ft&_t,t[42]=Tt^~Kt&Nt,t[43]=Rt^~Mt&Dt,t[4]=q^~L&Z,t[5]=$^~X&Q,t[14]=ot^~ct&ht,t[15]=it^~at&ft,t[24]=dt^~pt&xt,t[25]=bt^~vt>,t[34]=At^~wt&jt,t[35]=Ft^~_t&Ct,t[44]=Kt^~Nt&Ht,t[45]=Mt^~Dt&It,t[6]=L^~Z&U,t[7]=X^~Q&m,t[16]=ct^~ht&tt,t[17]=at^~ft&et,t[26]=pt^~xt<,t[27]=vt^~gt&ut,t[36]=wt^~jt&St,t[37]=_t^~Ct&Pt,t[46]=Nt^~Ht&Ot,t[47]=Dt^~It&Et,t[8]=Z^~U&G,t[9]=Q^~m&Y,t[18]=ht^~tt&rt,t[19]=ft^~et&nt,t[28]=xt^~lt&st,t[29]=gt^~ut&yt,t[38]=jt^~St&Bt,t[39]=Ct^~Pt&kt,t[48]=Ht^~Ot&Tt,t[49]=It^~Et&Rt,t[0]^=_[n],t[1]^=_[n+1]};if(B)E.exports=T;else for(R=0;R<N.length;++R)a[N[R]]=T[N[R]]})()})(Ut)),Ut.exports}var fe=he();const le=ae(fe),{keccak256:O}=le;class mt{constructor(i,o){this.payload={},this.declarations=[],this.secrets={},this.branchVersions={},this.username=i,this.secret=o,this.identityRoot="0x"+O(o),this.publicKey="0x"+O("public:"+o),this.identityHash="0x"+O(this.publicKey+this.username),this.secrets[""]=o;const l=this.createProxy([]);return Object.setPrototypeOf(l,mt.prototype),Object.assign(l,this),l}createProxy(i){const o=this,l=(...a)=>o.handleCall(i,a);return new Proxy(l,{get(a,y){if(typeof y=="symbol")return a[y];if(y==="secret")return o.createProxy([...i,String(y)]);if(y in o)return o[y];const b=[...i,String(y)];return o.createProxy(b)},apply(a,y,b){return o.handleCall(i,b)}})}handleCall(i,o){if(i.length===0){if(o.length===1&&typeof o[0]=="string"){const p=o[0].split(".").filter(Boolean);return this.exportBranch(p.join("."))}return this.createProxy([])}const l=i[i.length-1];if(l==="secret"){const p=i.slice(0,-1),d=p.join("."),P=String(o[0]??"");if(!P)return this.createProxy(p);this.secrets[d]=P;const k="0x"+O(this.secret+d+"::secret-set");return this.declarations.push({key:d+".secret",value:"<secret-set>",signature:k,timestamp:Date.now()}),this.createProxy(p)}if(l==="ptr")return{__ptr:i.slice(0,-1).join(".")};const a=i.join(".");let y;o.length===0?y=void 0:o.length===1?y=o[0]:y=o,this.ensurePath(i,y);const b=this.resolveSecret(i),B="0x"+O(b+a+JSON.stringify(y));return this.declarations.push({key:a,value:y,signature:B,timestamp:Date.now()}),this.createProxy(i)}resolveSecretWithPath(i){for(let o=i.length;o>=0;o--){const l=i.slice(0,o).join(".");if(this.secrets[l])return{secret:this.secrets[l],secretPath:i.slice(0,o)}}return{secret:this.secret,secretPath:[]}}resolveSecret(i){return this.resolveSecretWithPath(i).secret}ensurePath(i,o){const{secret:l,secretPath:a}=this.resolveSecretWithPath(i),y=a.join("."),b=O(l);if(a.length>0){let k={};const F=this.branchVersions[y]?.[b],w=this.getSubPayload(a);if(F){const A=this.decryptForPath(a,F);A&&typeof A=="object"&&(k=A)}else if(typeof w=="string"){const A=this.decryptForPath(a,w);A&&typeof A=="object"&&(k=A)}else w&&typeof w=="object"&&(k=w);const v=i.slice(a.length);let _=k;for(let A=0;A<v.length-1;A++){const K=v[A];(!_[K]||typeof _[K]!="object")&&(_[K]={}),_=_[K]}const j=v[v.length-1];_[j]=o;const C=this.encryptForPath(a,k);this.branchVersions[y]||(this.branchVersions[y]={}),this.branchVersions[y][b]=C,this.writeBranchBlob(a,C);return}const p=this.encryptForPath(i,o);let d=this.payload;for(let k=0;k<i.length-1;k++){const F=i[k];(!d[F]||typeof d[F]!="object")&&(d[F]={}),d=d[F]}const P=i[i.length-1];d[P]=p}setSubPayload(i,o){if(i.length===0){this.payload=o;return}let l=this.payload;for(let y=0;y<i.length-1;y++){const b=i[y];(!l[b]||typeof l[b]!="object")&&(l[b]={}),l=l[b]}const a=i[i.length-1];l[a]=o}findNearestBranchAncestor(i){for(let o=i.length-1;o>=1;o--){const l=i.slice(0,o),a=l.join(".");if(this.branchVersions[a])return{path:l,secret:this.resolveSecret(l)}}return null}writeBranchBlob(i,o){let l=i,a=o;for(;;){const y=this.findNearestBranchAncestor(l);if(!y){this.setSubPayload(l,a);return}const{path:b,secret:B}=y,p=b.join("."),d=O(B),P=this.getSubPayload(b),k=this.branchVersions[p]?.[d]??(typeof P=="string"?P:void 0);let F={};if(k){const j=this.decryptForPath(b,k);j&&typeof j=="object"&&(F=j)}const w=l.slice(b.length);let v=F;for(let j=0;j<w.length-1;j++){const C=w[j];(!v[C]||typeof v[C]!="object")&&(v[C]={}),v=v[C]}v[w[w.length-1]]=a;const _=this.encryptForPath(b,F);this.branchVersions[p]||(this.branchVersions[p]={}),this.branchVersions[p][d]=_,l=b,a=_}}getSubPayload(i){let o=this.payload;for(const l of i){if(!o||typeof o!="object")return;o=o[l]}return o}decryptTree(i,o){if(o==null)return o;if(typeof o=="string"){if(!this.isHexString(o))return o;const a=this.decryptForPath(i,o);return a===null?o:a}if(typeof o!="object")return o;const l=Array.isArray(o)?[]:{};for(const a of Object.keys(o)){const y=[...i,a];l[a]=this.decryptTree(y,o[a])}return l}encryptForPath(i,o){const l=this.resolveSecret(i),a=JSON.stringify(o),y=new TextEncoder().encode(a),b=O(l+":"+i.join(".")),B=this.asciiToBytes(b),p=new Uint8Array(y.length);for(let P=0;P<y.length;P++)p[P]=y[P]^B[P%B.length];let d="";for(let P=0;P<p.length;P++)d+=p[P].toString(16).padStart(2,"0");return d}decryptForPath(i,o){const l=this.resolveSecret(i);try{const a=this.hexToBytes(o),y=O(l+":"+i.join(".")),b=this.asciiToBytes(y),B=new Uint8Array(a.length);for(let d=0;d<a.length;d++)B[d]=a[d]^b[d%b.length];const p=new TextDecoder().decode(B);return JSON.parse(p)}catch{return null}}asciiToBytes(i){return new TextEncoder().encode(i)}hexToBytes(i){const o=i.startsWith("0x")?i.slice(2):i,l=new Uint8Array(o.length/2);for(let a=0;a<l.length;a++)l[a]=parseInt(o.substr(a*2,2),16);return l}isHexString(i){const o=i.startsWith("0x")?i.slice(2):i;return o.length>0&&o.length%2===0&&/^[0-9a-fA-F]+$/.test(o)}export(){return{identityRoot:this.identityRoot,publicKey:this.publicKey,identityHash:this.identityHash,declarations:this.declarations,payload:this.payload}}exportBranch(i){const o=i?i.split(".").filter(Boolean):[],l=o.join("."),a=this.resolveSecret(o),y=O(a),b=this.branchVersions[l]?.[y];if(b){const p=this.decryptForPath(o,b);return this.decryptTree(o,p)}const B=this.getSubPayload(o);if(B!==void 0){if(typeof B=="string"){const p=this.decryptForPath(o,B);return this.decryptTree(o,p)}return this.decryptTree(o,B)}}}exports.ME=mt;
|