@northtalk/ts 0.9.0 → 0.10.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/{binary-value-B93hEK7l.d.ts → binary-value-B8W4W_e1.d.ts} +1 -1
- package/{checker-D74oYIhs.js → checker-hkWO1UbN.js} +1 -1
- package/{core-BBPI6EhG.d.ts → core-Dwec7SRy.d.ts} +1 -1
- package/{debug-s6QIovKS.d.ts → debug-2yfUZYzF.d.ts} +7 -0
- package/debug.d.ts +1 -1
- package/{driver-D5yrK3Nu.d.ts → driver-CT-ksM-N.d.ts} +1 -1
- package/driver.d.ts +1 -1
- package/{encoding-DzVFpg7k.js → encoding-DlMqlP2Y.js} +1 -1
- package/{engine-Bx8B63iQ.js → engine-CxcONfhv.js} +4 -4
- package/{engine-Dy-BCoiw.d.ts → engine-DP_lqWfI.d.ts} +2 -2
- package/{group-CY4FKhzT.js → group--dcl0em8.js} +80 -21
- package/{http-fetch-DnpfiOWK.js → http-fetch-CLAeEXVi.js} +1 -1
- package/http.d.ts +1 -1
- package/http.js +2 -2
- package/index.d.ts +4 -4
- package/index.js +11 -11
- package/{lean-DTCTJUmR.js → lean-BtbKWkXA.js} +8 -8
- package/{lean-Bg_UTRj0.d.ts → lean-DU_muGpT.d.ts} +2 -2
- package/lean.d.ts +4 -4
- package/lean.js +11 -11
- package/{manifest-DVS1SEmN.js → manifest-CRpUahPt.js} +2 -2
- package/message-layer.d.ts +2 -2
- package/message-layer.js +1 -1
- package/notify.d.ts +1 -1
- package/notify.js +1 -1
- package/{objects-q0lnCK-4.d.ts → objects-DoyEohtr.d.ts} +1 -1
- package/{operations-B3XaG7Ve.js → operations-DrsedOvj.js} +3 -3
- package/package.json +1 -1
- package/{peer-capability-3etyPHs3.js → peer-capability-RMdN4OHj.js} +2 -2
- package/peer.d.ts +1 -1
- package/peer.js +2 -2
- package/{readers-AeB1bJ--.d.ts → readers-IhVpgXkj.d.ts} +1 -1
- package/{request-pump-binary-VOPVqRZD.js → request-pump-binary-P8m6kLfB.js} +229 -51
- package/{router-DXoJ_2Z4.d.ts → router-2vjYbqx3.d.ts} +2 -2
- package/{router-Bdm4KiMG.js → router-C_Fjc2as.js} +4 -4
- package/session.d.ts +2 -2
- package/session.js +17 -16
- package/setup.d.ts +2 -2
- package/setup.js +3 -3
- package/sha256-C5Lqj5U7.js +197 -0
- package/sqlite.d.ts +2 -2
- package/sqlite.js +3 -3
- package/{store-BTcyKBLg.js → store-_af2DPoK.js} +2 -2
- package/{store-capability-CBJ6mUoH.js → store-capability-Db6v_dw9.js} +2 -2
- package/store.d.ts +2 -2
- package/store.js +2 -2
- package/{user-capability-DNY2dyjq.js → user-capability-CzoLN3RK.js} +2 -2
- package/wasm.d.ts +4 -4
- package/wasm.js +84 -44
- package/{zone-rules-DsCJtmlC.js → zone-rules-Cn-f9u_Z.js} +3 -3
- package/sha256-9CGf5BS_.js +0 -168
package/sha256-9CGf5BS_.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/sha256.ts
|
|
3
|
-
const K = new Uint32Array([
|
|
4
|
-
1116352408,
|
|
5
|
-
1899447441,
|
|
6
|
-
3049323471,
|
|
7
|
-
3921009573,
|
|
8
|
-
961987163,
|
|
9
|
-
1508970993,
|
|
10
|
-
2453635748,
|
|
11
|
-
2870763221,
|
|
12
|
-
3624381080,
|
|
13
|
-
310598401,
|
|
14
|
-
607225278,
|
|
15
|
-
1426881987,
|
|
16
|
-
1925078388,
|
|
17
|
-
2162078206,
|
|
18
|
-
2614888103,
|
|
19
|
-
3248222580,
|
|
20
|
-
3835390401,
|
|
21
|
-
4022224774,
|
|
22
|
-
264347078,
|
|
23
|
-
604807628,
|
|
24
|
-
770255983,
|
|
25
|
-
1249150122,
|
|
26
|
-
1555081692,
|
|
27
|
-
1996064986,
|
|
28
|
-
2554220882,
|
|
29
|
-
2821834349,
|
|
30
|
-
2952996808,
|
|
31
|
-
3210313671,
|
|
32
|
-
3336571891,
|
|
33
|
-
3584528711,
|
|
34
|
-
113926993,
|
|
35
|
-
338241895,
|
|
36
|
-
666307205,
|
|
37
|
-
773529912,
|
|
38
|
-
1294757372,
|
|
39
|
-
1396182291,
|
|
40
|
-
1695183700,
|
|
41
|
-
1986661051,
|
|
42
|
-
2177026350,
|
|
43
|
-
2456956037,
|
|
44
|
-
2730485921,
|
|
45
|
-
2820302411,
|
|
46
|
-
3259730800,
|
|
47
|
-
3345764771,
|
|
48
|
-
3516065817,
|
|
49
|
-
3600352804,
|
|
50
|
-
4094571909,
|
|
51
|
-
275423344,
|
|
52
|
-
430227734,
|
|
53
|
-
506948616,
|
|
54
|
-
659060556,
|
|
55
|
-
883997877,
|
|
56
|
-
958139571,
|
|
57
|
-
1322822218,
|
|
58
|
-
1537002063,
|
|
59
|
-
1747873779,
|
|
60
|
-
1955562222,
|
|
61
|
-
2024104815,
|
|
62
|
-
2227730452,
|
|
63
|
-
2361852424,
|
|
64
|
-
2428436474,
|
|
65
|
-
2756734187,
|
|
66
|
-
3204031479,
|
|
67
|
-
3329325298
|
|
68
|
-
]);
|
|
69
|
-
const rotr = (x, n) => x >>> n | x << 32 - n;
|
|
70
|
-
const initial = [
|
|
71
|
-
1779033703,
|
|
72
|
-
3144134277,
|
|
73
|
-
1013904242,
|
|
74
|
-
2773480762,
|
|
75
|
-
1359893119,
|
|
76
|
-
2600822924,
|
|
77
|
-
528734635,
|
|
78
|
-
1541459225
|
|
79
|
-
];
|
|
80
|
-
/** An incremental SHA-256: `update` with bytes, then `final` once. */
|
|
81
|
-
var Sha256 = class {
|
|
82
|
-
h = new Uint32Array(initial);
|
|
83
|
-
w = /* @__PURE__ */ new Uint32Array(64);
|
|
84
|
-
block = /* @__PURE__ */ new Uint8Array(64);
|
|
85
|
-
blockView = new DataView(this.block.buffer);
|
|
86
|
-
filled = 0;
|
|
87
|
-
length = 0;
|
|
88
|
-
done = false;
|
|
89
|
-
update(bytes) {
|
|
90
|
-
if (this.done) throw new Error("Sha256.update after final");
|
|
91
|
-
this.length += bytes.length;
|
|
92
|
-
let at = 0;
|
|
93
|
-
if (this.filled > 0) {
|
|
94
|
-
const take = Math.min(64 - this.filled, bytes.length);
|
|
95
|
-
this.block.set(bytes.subarray(0, take), this.filled);
|
|
96
|
-
this.filled += take;
|
|
97
|
-
at = take;
|
|
98
|
-
if (this.filled < 64) return this;
|
|
99
|
-
this.compress(this.blockView, 0);
|
|
100
|
-
this.filled = 0;
|
|
101
|
-
}
|
|
102
|
-
const whole = at + Math.floor((bytes.length - at) / 64) * 64;
|
|
103
|
-
if (whole > at) {
|
|
104
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
105
|
-
for (; at < whole; at += 64) this.compress(view, at);
|
|
106
|
-
}
|
|
107
|
-
this.block.set(bytes.subarray(at));
|
|
108
|
-
this.filled = bytes.length - at;
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
/** The 32-byte digest; the hash takes no more input after it. */
|
|
112
|
-
final() {
|
|
113
|
-
if (this.done) throw new Error("Sha256.final twice");
|
|
114
|
-
const length = this.length;
|
|
115
|
-
const tail = new Uint8Array(this.filled < 56 ? 64 : 128);
|
|
116
|
-
tail.set(this.block.subarray(0, this.filled));
|
|
117
|
-
tail[this.filled] = 128;
|
|
118
|
-
const view = new DataView(tail.buffer);
|
|
119
|
-
view.setUint32(tail.length - 8, Math.floor(length / 536870912));
|
|
120
|
-
view.setUint32(tail.length - 4, length * 8 >>> 0);
|
|
121
|
-
for (let at = 0; at < tail.length; at += 64) this.compress(view, at);
|
|
122
|
-
this.done = true;
|
|
123
|
-
const out = /* @__PURE__ */ new Uint8Array(32);
|
|
124
|
-
const outView = new DataView(out.buffer);
|
|
125
|
-
for (let i = 0; i < 8; i++) outView.setUint32(i * 4, this.h[i]);
|
|
126
|
-
return out;
|
|
127
|
-
}
|
|
128
|
-
compress(view, block) {
|
|
129
|
-
const { h, w } = this;
|
|
130
|
-
for (let i = 0; i < 16; i++) w[i] = view.getUint32(block + i * 4);
|
|
131
|
-
for (let i = 16; i < 64; i++) {
|
|
132
|
-
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
|
|
133
|
-
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
|
|
134
|
-
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
135
|
-
}
|
|
136
|
-
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7];
|
|
137
|
-
for (let i = 0; i < 64; i++) {
|
|
138
|
-
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
139
|
-
const ch = e & f ^ ~e & g;
|
|
140
|
-
const t1 = hh + s1 + ch + K[i] + w[i] >>> 0;
|
|
141
|
-
const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
|
|
142
|
-
hh = g;
|
|
143
|
-
g = f;
|
|
144
|
-
f = e;
|
|
145
|
-
e = d + t1 >>> 0;
|
|
146
|
-
d = c;
|
|
147
|
-
c = b;
|
|
148
|
-
b = a;
|
|
149
|
-
a = t1 + t2 >>> 0;
|
|
150
|
-
}
|
|
151
|
-
h[0] = h[0] + a >>> 0;
|
|
152
|
-
h[1] = h[1] + b >>> 0;
|
|
153
|
-
h[2] = h[2] + c >>> 0;
|
|
154
|
-
h[3] = h[3] + d >>> 0;
|
|
155
|
-
h[4] = h[4] + e >>> 0;
|
|
156
|
-
h[5] = h[5] + f >>> 0;
|
|
157
|
-
h[6] = h[6] + g >>> 0;
|
|
158
|
-
h[7] = h[7] + hh >>> 0;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
/** The SHA-256 of `bytes`, as 32 bytes. */
|
|
162
|
-
const sha256Bytes = (bytes) => new Sha256().update(bytes).final();
|
|
163
|
-
const sha256 = (input) => {
|
|
164
|
-
const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
165
|
-
return Array.from(sha256Bytes(bytes), (x) => x.toString(16).padStart(2, "0")).join("");
|
|
166
|
-
};
|
|
167
|
-
//#endregion
|
|
168
|
-
export { sha256 as n, sha256Bytes as r, Sha256 as t };
|