@capxul/mcp 4.20.0-beta.3 → 4.20.0-beta.31
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 +13 -15
- 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 +13885 -31519
- package/dist/organizations-5k-F_fa-.mjs +38628 -0
- package/dist/permission-approvals-B2xmvEKE.mjs +137 -0
- package/dist/secp256k1-BSimfttS.mjs +2 -0
- package/dist/{secp256k1-oe2FO-K6.mjs → secp256k1-b-_IancF.mjs} +4 -130
- package/dist/utils-CenTnkL6.mjs +128 -0
- package/package.json +12 -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 { Gn as CapxulError, H as asCapxulError, R as abandonPrepared, Wn as Errors, a as verifiedConfiguration, c as preparePermission, d as buildCommand, f as validateReplacementInput, i as prepareConfiguration, l as preparedIdentity, mt as CAPXUL_OPERATIONS, nn as absurd, r as authorInvitation, u as verifiedPreparation } from "./organizations-5k-F_fa-.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: Errors.notAuthenticated()
|
|
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: Errors.notAuthenticated()
|
|
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,130 +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
|
|
1
|
+
import { a as anumber, c as concatBytes$1, d as randomBytes, f as rotr, i as ahash, l as createHasher, m as toBytes, n as abytes$1, o as aoutput, r as aexists, s as clean, t as Hash, u as createView } from "./utils-CenTnkL6.mjs";
|
|
128
2
|
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
129
3
|
/**
|
|
130
4
|
* Internal Merkle-Damgard hash utils.
|
|
@@ -563,8 +437,8 @@ function aInRange(title, n, min, max) {
|
|
|
563
437
|
* TODO: merge with nLength in modular
|
|
564
438
|
*/
|
|
565
439
|
function bitLen(n) {
|
|
566
|
-
let len;
|
|
567
|
-
for (
|
|
440
|
+
let len = 0;
|
|
441
|
+
for (; n > _0n$4; n >>= _1n$4, len += 1);
|
|
568
442
|
return len;
|
|
569
443
|
}
|
|
570
444
|
/**
|
|
@@ -2340,4 +2214,4 @@ const secp256k1 = createCurve({
|
|
|
2340
2214
|
}
|
|
2341
2215
|
}, sha256);
|
|
2342
2216
|
//#endregion
|
|
2343
|
-
export {
|
|
2217
|
+
export { sha256 as n, secp256k1 as t };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as nc from "node:crypto";
|
|
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(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(b, ...lengths) {
|
|
28
|
+
if (!isBytes(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(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(data);
|
|
92
|
+
return data;
|
|
93
|
+
}
|
|
94
|
+
/** Copies several Uint8Arrays into one. */
|
|
95
|
+
function concatBytes(...arrays) {
|
|
96
|
+
let sum = 0;
|
|
97
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
98
|
+
const a = arrays[i];
|
|
99
|
+
abytes(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
|
+
export { anumber as a, concatBytes as c, randomBytes as d, rotr as f, u32 as h, ahash as i, createHasher as l, toBytes as m, abytes as n, aoutput as o, swap32IfBE as p, aexists as r, clean as s, Hash as t, createView as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/mcp",
|
|
3
|
-
"version": "4.20.0-beta.
|
|
3
|
+
"version": "4.20.0-beta.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Capxul MCP server for auth, Account readiness, identity, Organizations, relationships, requests, destinations, and testnet funding over Streamable HTTP.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"README.md"
|
|
33
33
|
],
|
|
34
34
|
"type": "module",
|
|
35
|
+
"imports": {
|
|
36
|
+
"#*": "./src/*.ts"
|
|
37
|
+
},
|
|
35
38
|
"publishConfig": {
|
|
36
39
|
"access": "public"
|
|
37
40
|
},
|
|
@@ -39,26 +42,26 @@
|
|
|
39
42
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
40
43
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
41
44
|
"@posthog/mcp": "0.13.0",
|
|
42
|
-
"effect": "4.0.0
|
|
45
|
+
"effect": "4.0.0",
|
|
43
46
|
"posthog-node": "5.51.6",
|
|
44
47
|
"zod": "^4.2.0"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
50
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
51
|
+
"@total-typescript/shoehorn": "0.1.2",
|
|
48
52
|
"@types/node": "^22.15.3",
|
|
49
53
|
"tsx": "^4.19.0",
|
|
50
54
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
51
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
52
|
-
"vite-plus": "0.
|
|
53
|
-
"@capxul/
|
|
54
|
-
"@capxul/
|
|
55
|
-
"@capxul/
|
|
55
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
56
|
+
"vite-plus": "1.0.0",
|
|
57
|
+
"@capxul/protocol": "0.2.0-beta.4",
|
|
58
|
+
"@capxul/sdk": "4.20.0-beta.31",
|
|
59
|
+
"@capxul/typescript-config": "0.0.0"
|
|
56
60
|
},
|
|
57
61
|
"scripts": {
|
|
58
62
|
"dev": "vp exec tsx src/main.ts serve",
|
|
59
|
-
"journey:staff": "vp exec bun run journeys/staff-proof.ts",
|
|
60
63
|
"check-types": "vp exec ../../node_modules/@typescript/native/bin/tsc -p tsconfig.json --noEmit",
|
|
61
|
-
"lint": "vp lint
|
|
64
|
+
"lint": "vp lint -c ../../.oxlintrc.json .",
|
|
62
65
|
"build": "NODE_OPTIONS=--max-old-space-size=12288 vp pack",
|
|
63
66
|
"_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are defined as cache-augmented tasks in vite.config.ts so vitest's self-writes don't bust input fingerprinting (#205)."
|
|
64
67
|
}
|
package/dist/lib-BNmz42MT.mjs
DELETED
package/dist/lib-DRIaj4W_.mjs
DELETED
package/dist/lib-DZmUoBjo.mjs
DELETED
package/dist/lib-F14n2Pis.mjs
DELETED