@capxul/mcp 4.20.0-beta.4 → 4.20.0-beta.40
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 +48 -26
- package/dist/{lib-CQFHjQEQ.mjs → lib-5nM6ORJd.mjs} +4 -4
- package/dist/{lib-DS3ZLCxu.mjs → lib-BJgR4mWJ.mjs} +5 -5
- package/dist/lib-BlUleR2B.mjs +3 -0
- package/dist/{lib-DO3Il55w.mjs → lib-BspI667y.mjs} +6 -6
- package/dist/{lib-B8j6PH9L.mjs → lib-Buegx0dz.mjs} +5 -5
- package/dist/{lib-83Fk1wWX.mjs → lib-CJw8te9L.mjs} +37 -37
- package/dist/lib-C_-etuHZ.mjs +3 -0
- package/dist/{lib-vbuHK0v7.mjs → lib-CoGPQsbr.mjs} +3 -3
- package/dist/lib-Dd_fsz7h.mjs +3 -0
- package/dist/{lib-EFzR1_47.mjs → lib-DnmstTkB.mjs} +2 -1
- package/dist/lib-IlYdzOHo.mjs +3 -0
- package/dist/main.mjs +31952 -41930
- package/dist/organizations-BXC-6y-P.mjs +41861 -0
- package/dist/permission-approvals-BNP5hA8b.mjs +137 -0
- package/dist/secp256k1-CLeVBma1.mjs +2 -0
- package/dist/{secp256k1-oe2FO-K6.mjs → secp256k1-vkvPWdOZ.mjs} +4 -424
- package/dist/{esm-DUNJOL6b.mjs → sentryClient-CN-gBjYx.mjs} +98 -1
- package/dist/sha2-D5rBHwg7.mjs +422 -0
- package/package.json +13 -9
- package/dist/lib-BNmz42MT.mjs +0 -3
- package/dist/lib-DRIaj4W_.mjs +0 -3
- package/dist/lib-DZmUoBjo.mjs +0 -3
- package/dist/lib-F14n2Pis.mjs +0 -3
- package/dist/secp256k1-CYG6Mi0X.mjs +0 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { B as abandonPrepared, Kt as CAPXUL_OPERATIONS, Ln as absurd, W as asCapxulError, a as prepareConfiguration, bt as noSessionError, d as verifiedPreparation, f as buildCommand, i as authorInvitation, l as preparePermission, o as verifiedConfiguration, or as CapxulError, p as validateReplacementInput, u as preparedIdentity } from "./organizations-BXC-6y-P.mjs";
|
|
2
|
+
//#region ../../packages/sdk/src/accounts/permission-approvals.ts
|
|
3
|
+
/** Prepare a Permission write or an invitation's configuration for `signerAddress`, checked. */
|
|
4
|
+
function prepareVerifiedPermissionChange(deps, input, signerAddress, signal) {
|
|
5
|
+
return "permission" in input ? prepareVerifiedPermissionWrite(deps, input, signerAddress, signal) : prepareVerifiedInvitation(deps, input, signerAddress, signal);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hand the verified identity to the caller before the approval opens. A
|
|
9
|
+
* caller that refuses it has not authorized the command: close the prepared
|
|
10
|
+
* command, so its nonce lane is free again.
|
|
11
|
+
*/
|
|
12
|
+
async function delivered(deps, executionId, deliver) {
|
|
13
|
+
let refused;
|
|
14
|
+
try {
|
|
15
|
+
const result = await deliver();
|
|
16
|
+
if (result !== void 0 && !result.ok) refused = result;
|
|
17
|
+
} catch (cause) {
|
|
18
|
+
refused = {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: asCapxulError(cause)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return refused === void 0 ? {
|
|
24
|
+
ok: true,
|
|
25
|
+
value: { executionId }
|
|
26
|
+
} : abandonPrepared(deps, executionId, "prepared_mismatch", refused);
|
|
27
|
+
}
|
|
28
|
+
/** The command a write sends, decoded exactly as its `org(id).permissions` method decodes it. */
|
|
29
|
+
function command(write) {
|
|
30
|
+
try {
|
|
31
|
+
switch (write.operation) {
|
|
32
|
+
case "create": return {
|
|
33
|
+
ok: true,
|
|
34
|
+
value: buildCommand.create(write)
|
|
35
|
+
};
|
|
36
|
+
case "change": return {
|
|
37
|
+
ok: true,
|
|
38
|
+
value: buildCommand.change(write)
|
|
39
|
+
};
|
|
40
|
+
case "assign": return {
|
|
41
|
+
ok: true,
|
|
42
|
+
value: buildCommand.assign(write)
|
|
43
|
+
};
|
|
44
|
+
case "revoke": return {
|
|
45
|
+
ok: true,
|
|
46
|
+
value: buildCommand.revoke(write)
|
|
47
|
+
};
|
|
48
|
+
case "replace": return {
|
|
49
|
+
ok: true,
|
|
50
|
+
value: {
|
|
51
|
+
operation: "replace",
|
|
52
|
+
requestKey: write.requestKey
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
default: return absurd(write);
|
|
56
|
+
}
|
|
57
|
+
} catch (cause) {
|
|
58
|
+
return {
|
|
59
|
+
ok: false,
|
|
60
|
+
error: asCapxulError(cause)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function prepareVerifiedPermissionWrite(deps, input, signerAddress, signal) {
|
|
65
|
+
const session = deps.actor?.authSession() ?? null;
|
|
66
|
+
if (session === null || deps.chainId === void 0) return {
|
|
67
|
+
ok: false,
|
|
68
|
+
error: noSessionError(deps.actor)
|
|
69
|
+
};
|
|
70
|
+
const built = command(input.permission);
|
|
71
|
+
if (!built.ok) return built;
|
|
72
|
+
const orgId = input.organizationId;
|
|
73
|
+
const expectedSnapshotHash = input.permission.operation === "replace" ? input.permission.expectedSnapshotHash : void 0;
|
|
74
|
+
const admitted = validateReplacementInput(orgId, built.value, expectedSnapshotHash);
|
|
75
|
+
if (!admitted.ok) return admitted;
|
|
76
|
+
const preparation = {
|
|
77
|
+
orgId,
|
|
78
|
+
command: built.value,
|
|
79
|
+
signerAddress,
|
|
80
|
+
email: session.email,
|
|
81
|
+
chainId: deps.chainId,
|
|
82
|
+
expectedSnapshotHash
|
|
83
|
+
};
|
|
84
|
+
const prepared = await preparePermission(deps, preparation, signal, void 0);
|
|
85
|
+
if (!prepared.ok) return prepared;
|
|
86
|
+
const executionId = prepared.value.executionId;
|
|
87
|
+
const verified = verifiedPreparation(prepared.value, preparation);
|
|
88
|
+
if (!verified.ok) return abandonPrepared(deps, executionId, "prepared_mismatch", verified);
|
|
89
|
+
const { onPrepared } = input;
|
|
90
|
+
return onPrepared === void 0 ? {
|
|
91
|
+
ok: true,
|
|
92
|
+
value: { executionId }
|
|
93
|
+
} : delivered(deps, executionId, () => onPrepared(preparedIdentity(verified.value)));
|
|
94
|
+
}
|
|
95
|
+
async function prepareVerifiedInvitation(deps, input, signerAddress, signal) {
|
|
96
|
+
const session = deps.actor?.authSession() ?? null;
|
|
97
|
+
if (session === null || deps.chainId === void 0) return {
|
|
98
|
+
ok: false,
|
|
99
|
+
error: noSessionError(deps.actor)
|
|
100
|
+
};
|
|
101
|
+
const orgId = input.organizationId;
|
|
102
|
+
const authored = await authorInvitation(deps, orgId, input.invite, signal, void 0);
|
|
103
|
+
if (!authored.ok) return authored;
|
|
104
|
+
const view = authored.value;
|
|
105
|
+
if (view.phase !== "authorizing" || view.commandId === null) return {
|
|
106
|
+
ok: false,
|
|
107
|
+
error: new CapxulError("WRONG_STATE", "The invitation's rights are already set up, or it ended: nothing is left to sign.", { details: {
|
|
108
|
+
method: CAPXUL_OPERATIONS.approvals.prepare,
|
|
109
|
+
currentState: view.phase,
|
|
110
|
+
validStates: ["authorizing"],
|
|
111
|
+
invitationId: view.id
|
|
112
|
+
} })
|
|
113
|
+
};
|
|
114
|
+
const preparation = {
|
|
115
|
+
orgId,
|
|
116
|
+
view,
|
|
117
|
+
commandId: view.commandId,
|
|
118
|
+
signerAddress,
|
|
119
|
+
email: session.email,
|
|
120
|
+
chainId: deps.chainId
|
|
121
|
+
};
|
|
122
|
+
const built = await prepareConfiguration(deps, preparation, signal, void 0);
|
|
123
|
+
if (!built.ok) return built;
|
|
124
|
+
const { executionId, invitationId, commandId } = built.value;
|
|
125
|
+
const verified = verifiedConfiguration(built.value, preparation);
|
|
126
|
+
if (!verified.ok) return abandonPrepared(deps, executionId, "prepared_mismatch", verified);
|
|
127
|
+
const { onPrepared } = input;
|
|
128
|
+
return onPrepared === void 0 ? {
|
|
129
|
+
ok: true,
|
|
130
|
+
value: { executionId }
|
|
131
|
+
} : delivered(deps, executionId, () => onPrepared({
|
|
132
|
+
invitationId,
|
|
133
|
+
commandId
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
export { prepareVerifiedPermissionChange };
|
|
@@ -1,424 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
3
|
-
/**
|
|
4
|
-
* Internal webcrypto alias.
|
|
5
|
-
* We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.
|
|
6
|
-
* Falls back to Node.js built-in crypto for Node.js <=v14.
|
|
7
|
-
* See utils.ts for details.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
const crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
|
|
13
|
-
/**
|
|
14
|
-
* Utilities for hex, bytes, CSPRNG.
|
|
15
|
-
* @module
|
|
16
|
-
*/
|
|
17
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
18
|
-
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
19
|
-
function isBytes$1(a) {
|
|
20
|
-
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
21
|
-
}
|
|
22
|
-
/** Asserts something is positive integer. */
|
|
23
|
-
function anumber(n) {
|
|
24
|
-
if (!Number.isSafeInteger(n) || n < 0) throw new Error("positive integer expected, got " + n);
|
|
25
|
-
}
|
|
26
|
-
/** Asserts something is Uint8Array. */
|
|
27
|
-
function abytes$1(b, ...lengths) {
|
|
28
|
-
if (!isBytes$1(b)) throw new Error("Uint8Array expected");
|
|
29
|
-
if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
30
|
-
}
|
|
31
|
-
/** Asserts something is hash */
|
|
32
|
-
function ahash(h) {
|
|
33
|
-
if (typeof h !== "function" || typeof h.create !== "function") throw new Error("Hash should be wrapped by utils.createHasher");
|
|
34
|
-
anumber(h.outputLen);
|
|
35
|
-
anumber(h.blockLen);
|
|
36
|
-
}
|
|
37
|
-
/** Asserts a hash instance has not been destroyed / finished */
|
|
38
|
-
function aexists(instance, checkFinished = true) {
|
|
39
|
-
if (instance.destroyed) throw new Error("Hash instance has been destroyed");
|
|
40
|
-
if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
|
|
41
|
-
}
|
|
42
|
-
/** Asserts output is properly-sized byte array */
|
|
43
|
-
function aoutput(out, instance) {
|
|
44
|
-
abytes$1(out);
|
|
45
|
-
const min = instance.outputLen;
|
|
46
|
-
if (out.length < min) throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
47
|
-
}
|
|
48
|
-
/** Cast u8 / u16 / u32 to u32. */
|
|
49
|
-
function u32(arr) {
|
|
50
|
-
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
51
|
-
}
|
|
52
|
-
/** Zeroize a byte array. Warning: JS provides no guarantees. */
|
|
53
|
-
function clean(...arrays) {
|
|
54
|
-
for (let i = 0; i < arrays.length; i++) arrays[i].fill(0);
|
|
55
|
-
}
|
|
56
|
-
/** Create DataView of an array for easy byte-level manipulation. */
|
|
57
|
-
function createView(arr) {
|
|
58
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
59
|
-
}
|
|
60
|
-
/** The rotate right (circular right shift) operation for uint32 */
|
|
61
|
-
function rotr(word, shift) {
|
|
62
|
-
return word << 32 - shift | word >>> shift;
|
|
63
|
-
}
|
|
64
|
-
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
|
65
|
-
const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
66
|
-
/** The byte swap operation for uint32 */
|
|
67
|
-
function byteSwap(word) {
|
|
68
|
-
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
69
|
-
}
|
|
70
|
-
/** In place byte swap for Uint32Array */
|
|
71
|
-
function byteSwap32(arr) {
|
|
72
|
-
for (let i = 0; i < arr.length; i++) arr[i] = byteSwap(arr[i]);
|
|
73
|
-
return arr;
|
|
74
|
-
}
|
|
75
|
-
const swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
76
|
-
/**
|
|
77
|
-
* Converts string to bytes using UTF8 encoding.
|
|
78
|
-
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
79
|
-
*/
|
|
80
|
-
function utf8ToBytes(str) {
|
|
81
|
-
if (typeof str !== "string") throw new Error("string expected");
|
|
82
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
86
|
-
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
87
|
-
* Keep in mind for future mutable operations.
|
|
88
|
-
*/
|
|
89
|
-
function toBytes(data) {
|
|
90
|
-
if (typeof data === "string") data = utf8ToBytes(data);
|
|
91
|
-
abytes$1(data);
|
|
92
|
-
return data;
|
|
93
|
-
}
|
|
94
|
-
/** Copies several Uint8Arrays into one. */
|
|
95
|
-
function concatBytes$1(...arrays) {
|
|
96
|
-
let sum = 0;
|
|
97
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
98
|
-
const a = arrays[i];
|
|
99
|
-
abytes$1(a);
|
|
100
|
-
sum += a.length;
|
|
101
|
-
}
|
|
102
|
-
const res = new Uint8Array(sum);
|
|
103
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
104
|
-
const a = arrays[i];
|
|
105
|
-
res.set(a, pad);
|
|
106
|
-
pad += a.length;
|
|
107
|
-
}
|
|
108
|
-
return res;
|
|
109
|
-
}
|
|
110
|
-
/** For runtime check if class implements interface */
|
|
111
|
-
var Hash = class {};
|
|
112
|
-
/** Wraps hash function, creating an interface on top of it */
|
|
113
|
-
function createHasher(hashCons) {
|
|
114
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
115
|
-
const tmp = hashCons();
|
|
116
|
-
hashC.outputLen = tmp.outputLen;
|
|
117
|
-
hashC.blockLen = tmp.blockLen;
|
|
118
|
-
hashC.create = () => hashCons();
|
|
119
|
-
return hashC;
|
|
120
|
-
}
|
|
121
|
-
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
122
|
-
function randomBytes(bytesLength = 32) {
|
|
123
|
-
if (crypto && typeof crypto.getRandomValues === "function") return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
124
|
-
if (crypto && typeof crypto.randomBytes === "function") return Uint8Array.from(crypto.randomBytes(bytesLength));
|
|
125
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
129
|
-
/**
|
|
130
|
-
* Internal Merkle-Damgard hash utils.
|
|
131
|
-
* @module
|
|
132
|
-
*/
|
|
133
|
-
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
|
134
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
135
|
-
if (typeof view.setBigUint64 === "function") return view.setBigUint64(byteOffset, value, isLE);
|
|
136
|
-
const _32n = BigInt(32);
|
|
137
|
-
const _u32_max = BigInt(4294967295);
|
|
138
|
-
const wh = Number(value >> _32n & _u32_max);
|
|
139
|
-
const wl = Number(value & _u32_max);
|
|
140
|
-
const h = isLE ? 4 : 0;
|
|
141
|
-
const l = isLE ? 0 : 4;
|
|
142
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
143
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
144
|
-
}
|
|
145
|
-
/** Choice: a ? b : c */
|
|
146
|
-
function Chi(a, b, c) {
|
|
147
|
-
return a & b ^ ~a & c;
|
|
148
|
-
}
|
|
149
|
-
/** Majority function, true if any two inputs is true. */
|
|
150
|
-
function Maj(a, b, c) {
|
|
151
|
-
return a & b ^ a & c ^ b & c;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Merkle-Damgard hash construction base class.
|
|
155
|
-
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
|
156
|
-
*/
|
|
157
|
-
var HashMD = class extends Hash {
|
|
158
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
159
|
-
super();
|
|
160
|
-
this.finished = false;
|
|
161
|
-
this.length = 0;
|
|
162
|
-
this.pos = 0;
|
|
163
|
-
this.destroyed = false;
|
|
164
|
-
this.blockLen = blockLen;
|
|
165
|
-
this.outputLen = outputLen;
|
|
166
|
-
this.padOffset = padOffset;
|
|
167
|
-
this.isLE = isLE;
|
|
168
|
-
this.buffer = new Uint8Array(blockLen);
|
|
169
|
-
this.view = createView(this.buffer);
|
|
170
|
-
}
|
|
171
|
-
update(data) {
|
|
172
|
-
aexists(this);
|
|
173
|
-
data = toBytes(data);
|
|
174
|
-
abytes$1(data);
|
|
175
|
-
const { view, buffer, blockLen } = this;
|
|
176
|
-
const len = data.length;
|
|
177
|
-
for (let pos = 0; pos < len;) {
|
|
178
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
179
|
-
if (take === blockLen) {
|
|
180
|
-
const dataView = createView(data);
|
|
181
|
-
for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
185
|
-
this.pos += take;
|
|
186
|
-
pos += take;
|
|
187
|
-
if (this.pos === blockLen) {
|
|
188
|
-
this.process(view, 0);
|
|
189
|
-
this.pos = 0;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
this.length += data.length;
|
|
193
|
-
this.roundClean();
|
|
194
|
-
return this;
|
|
195
|
-
}
|
|
196
|
-
digestInto(out) {
|
|
197
|
-
aexists(this);
|
|
198
|
-
aoutput(out, this);
|
|
199
|
-
this.finished = true;
|
|
200
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
201
|
-
let { pos } = this;
|
|
202
|
-
buffer[pos++] = 128;
|
|
203
|
-
clean(this.buffer.subarray(pos));
|
|
204
|
-
if (this.padOffset > blockLen - pos) {
|
|
205
|
-
this.process(view, 0);
|
|
206
|
-
pos = 0;
|
|
207
|
-
}
|
|
208
|
-
for (let i = pos; i < blockLen; i++) buffer[i] = 0;
|
|
209
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
210
|
-
this.process(view, 0);
|
|
211
|
-
const oview = createView(out);
|
|
212
|
-
const len = this.outputLen;
|
|
213
|
-
if (len % 4) throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
214
|
-
const outLen = len / 4;
|
|
215
|
-
const state = this.get();
|
|
216
|
-
if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state");
|
|
217
|
-
for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
|
|
218
|
-
}
|
|
219
|
-
digest() {
|
|
220
|
-
const { buffer, outputLen } = this;
|
|
221
|
-
this.digestInto(buffer);
|
|
222
|
-
const res = buffer.slice(0, outputLen);
|
|
223
|
-
this.destroy();
|
|
224
|
-
return res;
|
|
225
|
-
}
|
|
226
|
-
_cloneInto(to) {
|
|
227
|
-
to || (to = new this.constructor());
|
|
228
|
-
to.set(...this.get());
|
|
229
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
230
|
-
to.destroyed = destroyed;
|
|
231
|
-
to.finished = finished;
|
|
232
|
-
to.length = length;
|
|
233
|
-
to.pos = pos;
|
|
234
|
-
if (length % blockLen) to.buffer.set(buffer);
|
|
235
|
-
return to;
|
|
236
|
-
}
|
|
237
|
-
clone() {
|
|
238
|
-
return this._cloneInto();
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
|
|
243
|
-
* Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
|
|
244
|
-
*/
|
|
245
|
-
/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
|
|
246
|
-
const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
247
|
-
1779033703,
|
|
248
|
-
3144134277,
|
|
249
|
-
1013904242,
|
|
250
|
-
2773480762,
|
|
251
|
-
1359893119,
|
|
252
|
-
2600822924,
|
|
253
|
-
528734635,
|
|
254
|
-
1541459225
|
|
255
|
-
]);
|
|
256
|
-
//#endregion
|
|
257
|
-
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
|
|
258
|
-
/**
|
|
259
|
-
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
|
|
260
|
-
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
|
|
261
|
-
* Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
|
|
262
|
-
* [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
|
263
|
-
* @module
|
|
264
|
-
*/
|
|
265
|
-
/**
|
|
266
|
-
* Round constants:
|
|
267
|
-
* First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
|
|
268
|
-
*/
|
|
269
|
-
const SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
270
|
-
1116352408,
|
|
271
|
-
1899447441,
|
|
272
|
-
3049323471,
|
|
273
|
-
3921009573,
|
|
274
|
-
961987163,
|
|
275
|
-
1508970993,
|
|
276
|
-
2453635748,
|
|
277
|
-
2870763221,
|
|
278
|
-
3624381080,
|
|
279
|
-
310598401,
|
|
280
|
-
607225278,
|
|
281
|
-
1426881987,
|
|
282
|
-
1925078388,
|
|
283
|
-
2162078206,
|
|
284
|
-
2614888103,
|
|
285
|
-
3248222580,
|
|
286
|
-
3835390401,
|
|
287
|
-
4022224774,
|
|
288
|
-
264347078,
|
|
289
|
-
604807628,
|
|
290
|
-
770255983,
|
|
291
|
-
1249150122,
|
|
292
|
-
1555081692,
|
|
293
|
-
1996064986,
|
|
294
|
-
2554220882,
|
|
295
|
-
2821834349,
|
|
296
|
-
2952996808,
|
|
297
|
-
3210313671,
|
|
298
|
-
3336571891,
|
|
299
|
-
3584528711,
|
|
300
|
-
113926993,
|
|
301
|
-
338241895,
|
|
302
|
-
666307205,
|
|
303
|
-
773529912,
|
|
304
|
-
1294757372,
|
|
305
|
-
1396182291,
|
|
306
|
-
1695183700,
|
|
307
|
-
1986661051,
|
|
308
|
-
2177026350,
|
|
309
|
-
2456956037,
|
|
310
|
-
2730485921,
|
|
311
|
-
2820302411,
|
|
312
|
-
3259730800,
|
|
313
|
-
3345764771,
|
|
314
|
-
3516065817,
|
|
315
|
-
3600352804,
|
|
316
|
-
4094571909,
|
|
317
|
-
275423344,
|
|
318
|
-
430227734,
|
|
319
|
-
506948616,
|
|
320
|
-
659060556,
|
|
321
|
-
883997877,
|
|
322
|
-
958139571,
|
|
323
|
-
1322822218,
|
|
324
|
-
1537002063,
|
|
325
|
-
1747873779,
|
|
326
|
-
1955562222,
|
|
327
|
-
2024104815,
|
|
328
|
-
2227730452,
|
|
329
|
-
2361852424,
|
|
330
|
-
2428436474,
|
|
331
|
-
2756734187,
|
|
332
|
-
3204031479,
|
|
333
|
-
3329325298
|
|
334
|
-
]);
|
|
335
|
-
/** Reusable temporary buffer. "W" comes straight from spec. */
|
|
336
|
-
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
337
|
-
var SHA256 = class extends HashMD {
|
|
338
|
-
constructor(outputLen = 32) {
|
|
339
|
-
super(64, outputLen, 8, false);
|
|
340
|
-
this.A = SHA256_IV[0] | 0;
|
|
341
|
-
this.B = SHA256_IV[1] | 0;
|
|
342
|
-
this.C = SHA256_IV[2] | 0;
|
|
343
|
-
this.D = SHA256_IV[3] | 0;
|
|
344
|
-
this.E = SHA256_IV[4] | 0;
|
|
345
|
-
this.F = SHA256_IV[5] | 0;
|
|
346
|
-
this.G = SHA256_IV[6] | 0;
|
|
347
|
-
this.H = SHA256_IV[7] | 0;
|
|
348
|
-
}
|
|
349
|
-
get() {
|
|
350
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
351
|
-
return [
|
|
352
|
-
A,
|
|
353
|
-
B,
|
|
354
|
-
C,
|
|
355
|
-
D,
|
|
356
|
-
E,
|
|
357
|
-
F,
|
|
358
|
-
G,
|
|
359
|
-
H
|
|
360
|
-
];
|
|
361
|
-
}
|
|
362
|
-
set(A, B, C, D, E, F, G, H) {
|
|
363
|
-
this.A = A | 0;
|
|
364
|
-
this.B = B | 0;
|
|
365
|
-
this.C = C | 0;
|
|
366
|
-
this.D = D | 0;
|
|
367
|
-
this.E = E | 0;
|
|
368
|
-
this.F = F | 0;
|
|
369
|
-
this.G = G | 0;
|
|
370
|
-
this.H = H | 0;
|
|
371
|
-
}
|
|
372
|
-
process(view, offset) {
|
|
373
|
-
for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
|
|
374
|
-
for (let i = 16; i < 64; i++) {
|
|
375
|
-
const W15 = SHA256_W[i - 15];
|
|
376
|
-
const W2 = SHA256_W[i - 2];
|
|
377
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
378
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
379
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
380
|
-
}
|
|
381
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
382
|
-
for (let i = 0; i < 64; i++) {
|
|
383
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
384
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
385
|
-
const T2 = (rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22)) + Maj(A, B, C) | 0;
|
|
386
|
-
H = G;
|
|
387
|
-
G = F;
|
|
388
|
-
F = E;
|
|
389
|
-
E = D + T1 | 0;
|
|
390
|
-
D = C;
|
|
391
|
-
C = B;
|
|
392
|
-
B = A;
|
|
393
|
-
A = T1 + T2 | 0;
|
|
394
|
-
}
|
|
395
|
-
A = A + this.A | 0;
|
|
396
|
-
B = B + this.B | 0;
|
|
397
|
-
C = C + this.C | 0;
|
|
398
|
-
D = D + this.D | 0;
|
|
399
|
-
E = E + this.E | 0;
|
|
400
|
-
F = F + this.F | 0;
|
|
401
|
-
G = G + this.G | 0;
|
|
402
|
-
H = H + this.H | 0;
|
|
403
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
404
|
-
}
|
|
405
|
-
roundClean() {
|
|
406
|
-
clean(SHA256_W);
|
|
407
|
-
}
|
|
408
|
-
destroy() {
|
|
409
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
410
|
-
clean(this.buffer);
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* SHA2-256 hash function from RFC 4634.
|
|
415
|
-
*
|
|
416
|
-
* It is the fastest JS hash, even faster than Blake3.
|
|
417
|
-
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
|
|
418
|
-
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
419
|
-
*/
|
|
420
|
-
const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
421
|
-
//#endregion
|
|
1
|
+
import { a as ahash, c as clean, d as randomBytes, i as aexists, l as concatBytes$1, n as Hash, o as anumber, p as toBytes, r as abytes$1, t as sha256 } from "./sha2-D5rBHwg7.mjs";
|
|
422
2
|
//#region ../../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/utils.js
|
|
423
3
|
/**
|
|
424
4
|
* Hex, bytes and number utilities.
|
|
@@ -563,8 +143,8 @@ function aInRange(title, n, min, max) {
|
|
|
563
143
|
* TODO: merge with nLength in modular
|
|
564
144
|
*/
|
|
565
145
|
function bitLen(n) {
|
|
566
|
-
let len;
|
|
567
|
-
for (
|
|
146
|
+
let len = 0;
|
|
147
|
+
for (; n > _0n$4; n >>= _1n$4, len += 1);
|
|
568
148
|
return len;
|
|
569
149
|
}
|
|
570
150
|
/**
|
|
@@ -2340,4 +1920,4 @@ const secp256k1 = createCurve({
|
|
|
2340
1920
|
}
|
|
2341
1921
|
}, sha256);
|
|
2342
1922
|
//#endregion
|
|
2343
|
-
export {
|
|
1923
|
+
export { secp256k1 as t };
|
|
@@ -2620,6 +2620,13 @@ function setupIntegration(client, integration, integrationIndex) {
|
|
|
2620
2620
|
}
|
|
2621
2621
|
DEBUG_BUILD$1 && debug.log(`Integration installed: ${integration.name}`);
|
|
2622
2622
|
}
|
|
2623
|
+
/**
|
|
2624
|
+
* Define an integration function that can be used to create an integration instance.
|
|
2625
|
+
* Note that this by design hides the implementation details of the integration, as they are considered internal.
|
|
2626
|
+
*/
|
|
2627
|
+
function defineIntegration(fn) {
|
|
2628
|
+
return fn;
|
|
2629
|
+
}
|
|
2623
2630
|
//#endregion
|
|
2624
2631
|
//#region ../../node_modules/.pnpm/@sentry+core@9.47.1/node_modules/@sentry/core/build/esm/utils/clientreport.js
|
|
2625
2632
|
/**
|
|
@@ -3619,6 +3626,61 @@ function applySdkMetadata(options, name, names = [name], source = "npm") {
|
|
|
3619
3626
|
options._metadata = metadata;
|
|
3620
3627
|
}
|
|
3621
3628
|
//#endregion
|
|
3629
|
+
//#region ../../node_modules/.pnpm/@sentry+core@9.47.1/node_modules/@sentry/core/build/esm/utils/aggregate-errors.js
|
|
3630
|
+
/**
|
|
3631
|
+
* Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter.
|
|
3632
|
+
*/
|
|
3633
|
+
function applyAggregateErrorsToEvent(exceptionFromErrorImplementation, parser, key, limit, event, hint) {
|
|
3634
|
+
if (!event.exception?.values || !hint || !isInstanceOf(hint.originalException, Error)) return;
|
|
3635
|
+
const originalException = event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : void 0;
|
|
3636
|
+
if (originalException) event.exception.values = aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, hint.originalException, key, event.exception.values, originalException, 0);
|
|
3637
|
+
}
|
|
3638
|
+
function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error, key, prevExceptions, exception, exceptionId) {
|
|
3639
|
+
if (prevExceptions.length >= limit + 1) return prevExceptions;
|
|
3640
|
+
let newExceptions = [...prevExceptions];
|
|
3641
|
+
if (isInstanceOf(error[key], Error)) {
|
|
3642
|
+
applyExceptionGroupFieldsForParentException(exception, exceptionId);
|
|
3643
|
+
const newException = exceptionFromErrorImplementation(parser, error[key]);
|
|
3644
|
+
const newExceptionId = newExceptions.length;
|
|
3645
|
+
applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);
|
|
3646
|
+
newExceptions = aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error[key], key, [newException, ...newExceptions], newException, newExceptionId);
|
|
3647
|
+
}
|
|
3648
|
+
if (Array.isArray(error.errors)) error.errors.forEach((childError, i) => {
|
|
3649
|
+
if (isInstanceOf(childError, Error)) {
|
|
3650
|
+
applyExceptionGroupFieldsForParentException(exception, exceptionId);
|
|
3651
|
+
const newException = exceptionFromErrorImplementation(parser, childError);
|
|
3652
|
+
const newExceptionId = newExceptions.length;
|
|
3653
|
+
applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);
|
|
3654
|
+
newExceptions = aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, childError, key, [newException, ...newExceptions], newException, newExceptionId);
|
|
3655
|
+
}
|
|
3656
|
+
});
|
|
3657
|
+
return newExceptions;
|
|
3658
|
+
}
|
|
3659
|
+
function applyExceptionGroupFieldsForParentException(exception, exceptionId) {
|
|
3660
|
+
exception.mechanism = exception.mechanism || {
|
|
3661
|
+
type: "generic",
|
|
3662
|
+
handled: true
|
|
3663
|
+
};
|
|
3664
|
+
exception.mechanism = {
|
|
3665
|
+
...exception.mechanism,
|
|
3666
|
+
...exception.type === "AggregateError" && { is_exception_group: true },
|
|
3667
|
+
exception_id: exceptionId
|
|
3668
|
+
};
|
|
3669
|
+
}
|
|
3670
|
+
function applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) {
|
|
3671
|
+
exception.mechanism = exception.mechanism || {
|
|
3672
|
+
type: "generic",
|
|
3673
|
+
handled: true
|
|
3674
|
+
};
|
|
3675
|
+
exception.mechanism = {
|
|
3676
|
+
...exception.mechanism,
|
|
3677
|
+
type: "chained",
|
|
3678
|
+
source,
|
|
3679
|
+
exception_id: exceptionId,
|
|
3680
|
+
parent_id: parentId
|
|
3681
|
+
};
|
|
3682
|
+
}
|
|
3683
|
+
//#endregion
|
|
3622
3684
|
//#region ../../node_modules/.pnpm/@sentry+core@9.47.1/node_modules/@sentry/core/build/esm/utils/supports.js
|
|
3623
3685
|
/**
|
|
3624
3686
|
* isNative checks if the given function is a native implementation
|
|
@@ -4087,4 +4149,39 @@ const extractSafariExtensionDetails = (func, filename) => {
|
|
|
4087
4149
|
return isSafariExtension || isSafariWebExtension ? [func.indexOf("@") !== -1 ? func.split("@")[0] : "?", isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`] : [func, filename];
|
|
4088
4150
|
};
|
|
4089
4151
|
//#endregion
|
|
4090
|
-
|
|
4152
|
+
//#region ../../node_modules/.pnpm/@sentry+browser@9.47.1/node_modules/@sentry/browser/build/npm/esm/integrations/linkederrors.js
|
|
4153
|
+
const DEFAULT_KEY = "cause";
|
|
4154
|
+
const DEFAULT_LIMIT = 5;
|
|
4155
|
+
const INTEGRATION_NAME = "LinkedErrors";
|
|
4156
|
+
const _linkedErrorsIntegration = ((options = {}) => {
|
|
4157
|
+
const limit = options.limit || DEFAULT_LIMIT;
|
|
4158
|
+
const key = options.key || DEFAULT_KEY;
|
|
4159
|
+
return {
|
|
4160
|
+
name: INTEGRATION_NAME,
|
|
4161
|
+
preprocessEvent(event, hint, client) {
|
|
4162
|
+
applyAggregateErrorsToEvent(exceptionFromError, client.getOptions().stackParser, key, limit, event, hint);
|
|
4163
|
+
}
|
|
4164
|
+
};
|
|
4165
|
+
});
|
|
4166
|
+
/**
|
|
4167
|
+
* Aggregrate linked errors in an event.
|
|
4168
|
+
*/
|
|
4169
|
+
const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);
|
|
4170
|
+
//#endregion
|
|
4171
|
+
//#region ../../node_modules/.pnpm/@openfort+openfort-js@2.6.1_@typescript+typescript6@6.0.2/node_modules/@openfort/openfort-js/dist/sdk/src/core/errors/sentryClient.js
|
|
4172
|
+
/**
|
|
4173
|
+
* The only pieces of `@sentry/browser` the SDK uses, imported by name so
|
|
4174
|
+
* bundlers drop the rest (Replay, Feedback, …). Loaded lazily by
|
|
4175
|
+
* `InternalSentry.init` — never import this module statically.
|
|
4176
|
+
*/
|
|
4177
|
+
function createSentryClient(options) {
|
|
4178
|
+
return new BrowserClient({
|
|
4179
|
+
...options,
|
|
4180
|
+
integrations: [linkedErrorsIntegration()],
|
|
4181
|
+
stackParser: defaultStackParser,
|
|
4182
|
+
transport: makeFetchTransport,
|
|
4183
|
+
sendDefaultPii: false
|
|
4184
|
+
});
|
|
4185
|
+
}
|
|
4186
|
+
//#endregion
|
|
4187
|
+
export { createSentryClient };
|