@crvouga/mockingbird-service-slack 3.2.0 → 3.4.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/CHANGELOG.md +18 -4
- package/DISCOVERY.md +23 -0
- package/README.md +17 -17
- package/dist/chunk-4JPRLFNZ.js +12740 -0
- package/dist/chunk-4JPRLFNZ.js.map +7 -0
- package/dist/{chunk-M73LWCCP.js → chunk-6Z2MR3PO.js} +33 -3
- package/dist/{chunk-M73LWCCP.js.map → chunk-6Z2MR3PO.js.map} +2 -2
- package/dist/chunk-DHAINBRN.js +5113 -0
- package/dist/chunk-DHAINBRN.js.map +7 -0
- package/dist/cli.js +3 -3
- package/dist/crypto-II2ETGQQ.js +21 -0
- package/dist/{helpers-BMHFVPFA.js → helpers-5D4ROPWG.js} +2 -2
- package/dist/index.d.ts +360 -42
- package/dist/index.js +2 -2
- package/dist/server.d.ts +715 -83
- package/dist/server.js +3 -3
- package/package.json +3 -2
- package/dist/chunk-B4MV67Z4.js +0 -10836
- package/dist/chunk-B4MV67Z4.js.map +0 -7
- package/dist/chunk-IM5DJEPT.js +0 -1194
- package/dist/chunk-IM5DJEPT.js.map +0 -7
- package/dist/crypto-I5AVO7Q3.js +0 -15
- /package/dist/{crypto-I5AVO7Q3.js.map → crypto-II2ETGQQ.js.map} +0 -0
- /package/dist/{helpers-BMHFVPFA.js.map → helpers-5D4ROPWG.js.map} +0 -0
|
@@ -42,11 +42,38 @@ function createHmac(algorithm, key) {
|
|
|
42
42
|
};
|
|
43
43
|
return hash;
|
|
44
44
|
}
|
|
45
|
+
var source;
|
|
46
|
+
function useRandom(next) {
|
|
47
|
+
source = next;
|
|
48
|
+
}
|
|
49
|
+
function withRandom(next, run) {
|
|
50
|
+
const previous = source;
|
|
51
|
+
source = next;
|
|
52
|
+
try {
|
|
53
|
+
return run();
|
|
54
|
+
} finally {
|
|
55
|
+
source = previous;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function random() {
|
|
59
|
+
return source ? source() : Math.random();
|
|
60
|
+
}
|
|
45
61
|
function randomBytes(length) {
|
|
46
|
-
|
|
62
|
+
if (!source)
|
|
63
|
+
return Buffer.from(crypto.getRandomValues(new Uint8Array(length)));
|
|
64
|
+
const out = new Uint8Array(length);
|
|
65
|
+
for (let i = 0; i < length; i++)
|
|
66
|
+
out[i] = Math.floor(source() * 256);
|
|
67
|
+
return Buffer.from(out);
|
|
47
68
|
}
|
|
48
69
|
function randomUUID() {
|
|
49
|
-
|
|
70
|
+
if (!source)
|
|
71
|
+
return crypto.randomUUID();
|
|
72
|
+
const b = randomBytes(16);
|
|
73
|
+
b[6] = b[6] & 15 | 64;
|
|
74
|
+
b[8] = b[8] & 63 | 128;
|
|
75
|
+
const hex = b.toString("hex");
|
|
76
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
50
77
|
}
|
|
51
78
|
function timingSafeEqual(a, b) {
|
|
52
79
|
if (a.length !== b.length)
|
|
@@ -60,8 +87,11 @@ function timingSafeEqual(a, b) {
|
|
|
60
87
|
export {
|
|
61
88
|
createHash,
|
|
62
89
|
createHmac,
|
|
90
|
+
useRandom,
|
|
91
|
+
withRandom,
|
|
92
|
+
random,
|
|
63
93
|
randomBytes,
|
|
64
94
|
randomUUID,
|
|
65
95
|
timingSafeEqual
|
|
66
96
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-6Z2MR3PO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../http/provider/src/vendor/core/crypto.ts"],
|
|
4
|
-
"sourcesContent": ["import { hmac } from \"@noble/hashes/hmac.js\"\nimport { sha1 } from \"@noble/hashes/legacy.js\"\nimport { md5 } from \"@noble/hashes/legacy.js\"\nimport { sha256 } from \"@noble/hashes/sha2.js\"\nimport { Buffer } from \"buffer\"\n\nconst digest = (algorithm: string) => {\n if (algorithm === \"sha256\") return sha256\n if (algorithm === \"sha1\") return sha1\n if (algorithm === \"md5\") return md5\n throw new Error(`Unsupported digest ${algorithm}`)\n}\nconst bytes = (input: string | Uint8Array) => typeof input === \"string\" ? new TextEncoder().encode(input) : input\ninterface Hash {\n update(input: string | Uint8Array): Hash\n digest(): Buffer\n digest(encoding: string): string\n}\nexport function createHash(algorithm: string): Hash {\n const parts: Uint8Array[] = []\n const hash = {\n update(input: string | Uint8Array) { parts.push(bytes(input)); return hash },\n digest(encoding?: string): Buffer | string {\n const result = Buffer.from(digest(algorithm)(Buffer.concat(parts)))\n return encoding === \"base64url\" ? result.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\") : encoding ? result.toString(encoding as BufferEncoding) : result\n },\n }\n return hash as Hash\n}\nexport function createHmac(algorithm: string, key: string | Uint8Array): Hash {\n const parts: Uint8Array[] = []\n const hash = {\n update(input: string | Uint8Array) { parts.push(bytes(input)); return hash },\n digest(encoding?: string): Buffer | string {\n const result = Buffer.from(hmac(digest(algorithm), bytes(key), Buffer.concat(parts)))\n return encoding === \"base64url\" ? result.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\") : encoding ? result.toString(encoding as BufferEncoding) : result\n },\n }\n return hash as Hash\n}\nexport function randomBytes(length: number): Buffer {\n return Buffer.from(crypto.getRandomValues(new Uint8Array(length)))\n}\nexport function randomUUID(): string { return crypto.randomUUID() }\nexport function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) throw new Error(\"Buffers must have equal lengths\")\n let difference = 0\n for (let i = 0; i < a.length; i++) difference |= a[i] ^ b[i]\n return difference === 0\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc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 } from \"@noble/hashes/legacy.js\"\nimport { sha256 } from \"@noble/hashes/sha2.js\"\nimport { Buffer } from \"buffer\"\n\nconst digest = (algorithm: string) => {\n if (algorithm === \"sha256\") return sha256\n if (algorithm === \"sha1\") return sha1\n if (algorithm === \"md5\") return md5\n throw new Error(`Unsupported digest ${algorithm}`)\n}\nconst bytes = (input: string | Uint8Array) => typeof input === \"string\" ? new TextEncoder().encode(input) : input\ninterface Hash {\n update(input: string | Uint8Array): Hash\n digest(): Buffer\n digest(encoding: string): string\n}\nexport function createHash(algorithm: string): Hash {\n const parts: Uint8Array[] = []\n const hash = {\n update(input: string | Uint8Array) { parts.push(bytes(input)); return hash },\n digest(encoding?: string): Buffer | string {\n const result = Buffer.from(digest(algorithm)(Buffer.concat(parts)))\n return encoding === \"base64url\" ? result.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\") : encoding ? result.toString(encoding as BufferEncoding) : result\n },\n }\n return hash as Hash\n}\nexport function createHmac(algorithm: string, key: string | Uint8Array): Hash {\n const parts: Uint8Array[] = []\n const hash = {\n update(input: string | Uint8Array) { parts.push(bytes(input)); return hash },\n digest(encoding?: string): Buffer | string {\n const result = Buffer.from(hmac(digest(algorithm), bytes(key), Buffer.concat(parts)))\n return encoding === \"base64url\" ? result.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\") : encoding ? result.toString(encoding as BufferEncoding) : result\n },\n }\n return hash as Hash\n}\n/**\n * Mockingbird: where ids and tokens come from. With a seeded stream in place, everything the\n * vendor code mints replays from the seed; without one it is the platform's own randomness.\n */\nlet source: (() => number) | undefined\n/** Mint from `next` (a seeded stream of `[0, 1)`) until told otherwise. */\nexport function useRandom(next: (() => number) | undefined): void { source = next }\n/** Mint from `next` for one synchronous section, then put the previous source back. */\nexport function withRandom<T>(next: (() => number) | undefined, run: () => T): T {\n const previous = source\n source = next\n try { return run() } finally { source = previous }\n}\n/** `Math.random`, from the seeded stream when one is in place. */\nexport function random(): number { return source ? source() : Math.random() }\nexport function randomBytes(length: number): Buffer {\n if (!source) return Buffer.from(crypto.getRandomValues(new Uint8Array(length)))\n const out = new Uint8Array(length)\n for (let i = 0; i < length; i++) out[i] = Math.floor(source() * 256)\n return Buffer.from(out)\n}\nexport function randomUUID(): string {\n if (!source) return crypto.randomUUID()\n const b = randomBytes(16)\n b[6] = (b[6] & 0x0f) | 0x40\n b[8] = (b[8] & 0x3f) | 0x80\n const hex = b.toString(\"hex\")\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`\n}\nexport function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) throw new Error(\"Buffers must have equal lengths\")\n let difference = 0\n for (let i = 0; i < a.length; i++) difference |= a[i] ^ b[i]\n return difference === 0\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AAEvB,IAAM,SAAS,CAAC,cAAqB;AACnC,MAAI,cAAc;AAAU,WAAO;AACnC,MAAI,cAAc;AAAQ,WAAO;AACjC,MAAI,cAAc;AAAO,WAAO;AAChC,QAAM,IAAI,MAAM,sBAAsB,SAAS,EAAE;AACnD;AACA,IAAM,QAAQ,CAAC,UAA+B,OAAO,UAAU,WAAW,IAAI,YAAW,EAAG,OAAO,KAAK,IAAI;AAMtG,SAAU,WAAW,WAAiB;AAC1C,QAAM,QAAsB,CAAA;AAC5B,QAAM,OAAO;IACX,OAAO,OAA0B;AAAI,YAAM,KAAK,MAAM,KAAK,CAAC;AAAG,aAAO;IAAK;IAC3E,OAAO,UAAiB;AACtB,YAAM,SAAS,OAAO,KAAK,OAAO,SAAS,EAAE,OAAO,OAAO,KAAK,CAAC,CAAC;AAClE,aAAO,aAAa,cAAc,OAAO,SAAS,QAAQ,EAAE,QAAQ,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