@stryke/crypto 0.5.44 → 0.6.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cloudflare.cjs +960 -0
  3. package/dist/cloudflare.d.cts +251 -0
  4. package/dist/cloudflare.d.cts.map +1 -0
  5. package/dist/cloudflare.d.mts +251 -0
  6. package/dist/cloudflare.d.mts.map +1 -0
  7. package/dist/cloudflare.mjs +942 -0
  8. package/dist/cloudflare.mjs.map +1 -0
  9. package/dist/index.cjs +16 -12
  10. package/dist/index.d.cts +2 -4
  11. package/dist/index.d.mts +2 -4
  12. package/dist/index.mjs +2 -4
  13. package/dist/neutral-BISXAuIW.cjs +868 -0
  14. package/dist/{encryption.d.mts → neutral-BJmyEdJq.d.mts} +77 -2
  15. package/dist/neutral-BJmyEdJq.d.mts.map +1 -0
  16. package/dist/neutral-BtZoJSl-.mjs +779 -0
  17. package/dist/neutral-BtZoJSl-.mjs.map +1 -0
  18. package/dist/{encryption.d.cts → neutral-CW6EXiYo.d.cts} +77 -2
  19. package/dist/neutral-CW6EXiYo.d.cts.map +1 -0
  20. package/dist/neutral.cjs +16 -16
  21. package/dist/neutral.d.cts +2 -4
  22. package/dist/neutral.d.mts +2 -4
  23. package/dist/neutral.mjs +2 -4
  24. package/dist/node.cjs +663 -0
  25. package/dist/node.d.cts +117 -0
  26. package/dist/node.d.cts.map +1 -0
  27. package/dist/node.d.mts +117 -0
  28. package/dist/node.d.mts.map +1 -0
  29. package/dist/node.mjs +654 -0
  30. package/dist/node.mjs.map +1 -0
  31. package/package.json +55 -20
  32. package/dist/base-64.cjs +0 -440
  33. package/dist/base-64.d.cts +0 -40
  34. package/dist/base-64.d.cts.map +0 -1
  35. package/dist/base-64.d.mts +0 -40
  36. package/dist/base-64.d.mts.map +0 -1
  37. package/dist/base-64.mjs +0 -438
  38. package/dist/base-64.mjs.map +0 -1
  39. package/dist/convert/src/array-buffer-to-string.cjs +0 -19
  40. package/dist/convert/src/array-buffer-to-string.mjs +0 -19
  41. package/dist/convert/src/array-buffer-to-string.mjs.map +0 -1
  42. package/dist/convert/src/neutral.cjs +0 -7
  43. package/dist/convert/src/neutral.mjs +0 -9
  44. package/dist/convert/src/parse-type-definition.cjs +0 -1
  45. package/dist/convert/src/parse-type-definition.mjs +0 -3
  46. package/dist/convert/src/string-to-uint8-array.cjs +0 -24
  47. package/dist/convert/src/string-to-uint8-array.mjs +0 -23
  48. package/dist/convert/src/string-to-uint8-array.mjs.map +0 -1
  49. package/dist/convert/src/string-to-utf8-array.cjs +0 -15
  50. package/dist/convert/src/string-to-utf8-array.mjs +0 -15
  51. package/dist/convert/src/string-to-utf8-array.mjs.map +0 -1
  52. package/dist/convert/src/uint8-array-to-stream.cjs +0 -22
  53. package/dist/convert/src/uint8-array-to-stream.mjs +0 -22
  54. package/dist/convert/src/uint8-array-to-stream.mjs.map +0 -1
  55. package/dist/convert/src/uint8-array-to-string.cjs +0 -15
  56. package/dist/convert/src/uint8-array-to-string.mjs +0 -16
  57. package/dist/convert/src/uint8-array-to-string.mjs.map +0 -1
  58. package/dist/convert/src/utf8-array-to-string.cjs +0 -15
  59. package/dist/convert/src/utf8-array-to-string.mjs +0 -15
  60. package/dist/convert/src/utf8-array-to-string.mjs.map +0 -1
  61. package/dist/encryption.cjs +0 -134
  62. package/dist/encryption.d.cts.map +0 -1
  63. package/dist/encryption.d.mts.map +0 -1
  64. package/dist/encryption.mjs +0 -129
  65. package/dist/encryption.mjs.map +0 -1
  66. package/dist/encryption.node.cjs +0 -63
  67. package/dist/encryption.node.d.cts +0 -42
  68. package/dist/encryption.node.d.cts.map +0 -1
  69. package/dist/encryption.node.d.mts +0 -42
  70. package/dist/encryption.node.d.mts.map +0 -1
  71. package/dist/encryption.node.mjs +0 -62
  72. package/dist/encryption.node.mjs.map +0 -1
  73. package/dist/hex.cjs +0 -62
  74. package/dist/hex.d.cts +0 -18
  75. package/dist/hex.d.cts.map +0 -1
  76. package/dist/hex.d.mts +0 -18
  77. package/dist/hex.d.mts.map +0 -1
  78. package/dist/hex.mjs +0 -61
  79. package/dist/hex.mjs.map +0 -1
  80. package/dist/type-checks/src/index.cjs +0 -5
  81. package/dist/type-checks/src/index.mjs +0 -7
  82. package/dist/type-checks/src/is-buffer.cjs +0 -12
  83. package/dist/type-checks/src/is-buffer.mjs +0 -12
  84. package/dist/type-checks/src/is-buffer.mjs.map +0 -1
  85. package/dist/type-checks/src/is-collection.cjs +0 -1
  86. package/dist/type-checks/src/is-collection.mjs +0 -3
  87. package/dist/type-checks/src/is-string.cjs +0 -12
  88. package/dist/type-checks/src/is-string.mjs +0 -12
  89. package/dist/type-checks/src/is-string.mjs.map +0 -1
  90. package/dist/type-checks/src/is-undefined.cjs +0 -8
  91. package/dist/type-checks/src/is-undefined.mjs +0 -8
  92. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  93. package/dist/type-checks/src/type-detect.cjs +0 -15
  94. package/dist/type-checks/src/type-detect.mjs +0 -17
  95. package/dist/type-checks/src/type-detect.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neutral-BtZoJSl-.mjs","names":["isBuffer: typeof Buffer.isBuffer","isBuffer","DECODE_MAP","i","DECODE_MAP: Record<string, number>","result: string[]"],"sources":["../../convert/src/array-buffer-to-string.ts","../../type-checks/src/is-undefined.ts","../../type-checks/src/is-buffer.ts","../../type-checks/src/type-detect.ts","../../type-checks/src/is-string.ts","../../convert/src/string-to-uint8-array.ts","../../convert/src/string-to-utf8-array.ts","../../convert/src/uint8-array-to-stream.ts","../../convert/src/uint8-array-to-string.ts","../../convert/src/utf8-array-to-string.ts","../src/base-64.ts","../src/hex.ts","../src/encryption.ts","../src/random.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert an ArrayBuffer or Uint8Array to a string\n *\n * @param buffer - The ArrayBuffer or Uint8Array to convert\n * @returns The converted string\n */\nexport function arrayBufferToString(\n buffer: ArrayBuffer | ArrayBufferLike | Uint8Array\n): string {\n const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n const len = bytes.byteLength;\n if (len < 65535) {\n return String.fromCharCode.apply(null, bytes as unknown as number[]);\n }\n let binary = \"\";\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]!);\n }\n return binary;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isBufferExists = typeof Buffer !== \"undefined\";\n\n/**\n * Check if the provided value's type is `Buffer`\n */\nexport const isBuffer: typeof Buffer.isBuffer = isBufferExists\n ? Buffer.isBuffer.bind(Buffer)\n : /**\n * Check if the provided value's type is `Buffer`\n\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Buffer`\n */\n function isBuffer(\n value: Parameters<typeof Buffer.isBuffer>[0]\n ): value is Buffer {\n return false;\n };\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBuffer } from \"./is-buffer\";\n\nconst globalObject = (Obj => {\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n Object.defineProperty(Obj, \"typeDetectGlobalObject\", {\n get() {\n return this;\n },\n configurable: true\n });\n\n // // biome-ignore lint/correctness/noUndeclaredVariables: <explanation>\n // const global = typeDetectGlobalObject;\n\n // // biome-ignore lint/performance/noDelete: <explanation>\n // delete Obj.typeDetectGlobalObject;\n return globalThis;\n})(Object.prototype);\n\nexport function typeDetect(obj: unknown): string {\n // NOTE: isBuffer must execute before type-detect,\n // because type-detect returns 'Uint8Array'.\n if (isBuffer(obj)) {\n return \"Buffer\";\n }\n\n const typeofObj = typeof obj;\n if (typeofObj !== \"object\") {\n return typeofObj;\n }\n\n if (obj === null) {\n return \"null\";\n }\n\n if (obj === globalObject) {\n return \"global\";\n }\n\n if (\n Array.isArray(obj) &&\n (Symbol.toStringTag === undefined || !(Symbol.toStringTag in obj))\n ) {\n return \"Array\";\n }\n\n // https://html.spec.whatwg.org/multipage/browsers.html#location\n if (typeof globalThis === \"object\" && globalThis !== null) {\n if (\n typeof (globalThis as any).location === \"object\" &&\n obj === (globalThis as any).location\n ) {\n return \"Location\";\n }\n\n // https://html.spec.whatwg.org/#document\n if (\n typeof (globalThis as any).document === \"object\" &&\n obj === (globalThis as any).document\n ) {\n return \"Document\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray\n if (typeof (globalThis as any).navigator === \"object\") {\n if (\n typeof (globalThis as any).navigator.mimeTypes === \"object\" &&\n obj === (globalThis as any).navigator.mimeTypes\n ) {\n return \"MimeTypeArray\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n typeof (globalThis as any).navigator.plugins === \"object\" &&\n obj === (globalThis as any).navigator.plugins\n ) {\n return \"PluginArray\";\n }\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n (typeof (globalThis as any).HTMLElement === \"function\" ||\n typeof (globalThis as any).HTMLElement === \"object\") &&\n obj instanceof (globalThis as any).HTMLElement\n ) {\n if ((obj as any).tagName === \"BLOCKQUOTE\") {\n return \"HTMLQuoteElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltabledatacellelement\n if ((obj as any).tagName === \"TD\") {\n return \"HTMLTableDataCellElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltableheadercellelement\n if ((obj as any).tagName === \"TH\") {\n return \"HTMLTableHeaderCellElement\";\n }\n }\n }\n\n const stringTag =\n Symbol.toStringTag !== undefined && (obj as any)[Symbol.toStringTag];\n if (typeof stringTag === \"string\") {\n return stringTag;\n }\n\n const objPrototype = Object.getPrototypeOf(obj);\n if (objPrototype === RegExp.prototype) {\n return \"RegExp\";\n }\n\n if (objPrototype === Date.prototype) {\n return \"Date\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag\n if (typeof Promise !== \"undefined\" && objPrototype === Promise.prototype) {\n return \"Promise\";\n }\n\n if (typeof Set !== \"undefined\" && objPrototype === Set.prototype) {\n return \"Set\";\n }\n\n if (typeof Map !== \"undefined\" && objPrototype === Map.prototype) {\n return \"Map\";\n }\n\n if (typeof WeakSet !== \"undefined\" && objPrototype === WeakSet.prototype) {\n return \"WeakSet\";\n }\n\n if (typeof WeakMap !== \"undefined\" && objPrototype === WeakMap.prototype) {\n return \"WeakMap\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag\n if (typeof DataView !== \"undefined\" && objPrototype === DataView.prototype) {\n return \"DataView\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag\n if (\n typeof Map !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Map().entries())\n ) {\n return \"Map Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag\n if (\n typeof Set !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Set().entries())\n ) {\n return \"Set Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag\n if (\n typeof Array.prototype[Symbol.iterator] === \"function\" &&\n objPrototype === Object.getPrototypeOf([][Symbol.iterator]())\n ) {\n return \"Array Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag\n if (\n Symbol.iterator !== undefined &&\n typeof String.prototype[Symbol.iterator] === \"function\" &&\n Object.getPrototypeOf(\"\"[Symbol.iterator]()) &&\n objPrototype === Object.getPrototypeOf(\"\"[Symbol.iterator]())\n ) {\n return \"String Iterator\";\n }\n\n if (objPrototype === null) {\n return \"Object\";\n }\n\n return Object.prototype.toString.call(obj).slice(8, -1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a string to Uint8Array\n *\n * @param text - The text to convert\n * @returns The converted Uint8Array\n */\nexport function stringToUint8Array(text: string): Uint8Array {\n return Uint8Array.from(\n [...encodeURIComponent(text)].map(letter => letter.codePointAt(0)!)\n );\n}\n\n/**\n * Convert a binary string to Uint8Array\n *\n * @param binary - The binary string to convert\n * @returns The converted Uint8Array\n */\nexport function binaryStringToUint8Array(binary: string): Uint8Array {\n const len = binary.length;\n const arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binary.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Convert a base64 string to a Uint8Array\n *\n * @param data - The base64 string to convert\n * @returns The converted Uint8Array\n */\nexport function base64StringToUint8Array(data: string): Uint8Array {\n return stringToUint8Array(atob(data));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst encoder = new TextEncoder();\n\n/**\n * Convert a string to a utf-8 array\n *\n * @param input - The string to convert\n * @returns The converted utf-8 array\n */\nexport function stringToUtf8Array(input: string): Uint8Array {\n return encoder.encode(input);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a Uint8Array to a ReadableStream\n *\n * @param data - The Uint8Array to convert\n * @returns The converted ReadableStream\n */\nexport function uint8ArrayToStream(\n data: Uint8Array\n): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(data);\n controller.close();\n }\n });\n}\n\n/**\n * Concatenate an array of Uint8Array chunks into a single Uint8Array\n *\n * @param chunks - Array of Uint8Array chunks to concatenate\n * @returns The concatenated Uint8Array\n */\nexport function concatUint8Array(chunks: Uint8Array[]): Uint8Array {\n let total = 0;\n for (const chunk of chunks) {\n total += chunk.length;\n }\n const result = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n\n/**\n * Concatenate a ReadableStream of Uint8Array chunks into a single Uint8Array\n *\n * @param stream - The ReadableStream of Uint8Array chunks to concatenate\n * @returns A promise that resolves to the concatenated Uint8Array\n */\nexport async function concatUint8ArrayStream(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n const chunks: Uint8Array[] = [];\n await stream.pipeTo(\n new WritableStream({\n write(chunk) {\n chunks.push(chunk);\n }\n })\n );\n\n return concatUint8Array(chunks);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { arrayBufferToString } from \"./array-buffer-to-string\";\n\n/**\n * Convert a Uint8Array to a base64 string\n *\n * @param buffer - The Uint8Array to convert\n * @returns The converted base64 string\n */\nexport function uint8ArrayToString(buffer: Uint8Array): string {\n return btoa(arrayBufferToString(buffer));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst decoder = new TextDecoder();\n\n/**\n * Convert a utf-8 array to string\n *\n * @param input - Utf-8 Array\n * @returns The converted string\n */\nexport function utf8ArrayToString(\n input: NodeJS.ArrayBufferView | ArrayBuffer\n): string {\n return decoder.decode(input);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringToUint8Array } from \"@stryke/convert/neutral\";\nimport { utf8ArrayToString } from \"@stryke/convert/utf8-array-to-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\n// map 6 bits [0, 64) into ascii byte (8 bits)\n// generated by\n// Array.from(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", c => c.charCodeAt(0))\n// biome-ignore format:\nconst ENCODE_MAP = new Uint8Array([\n 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,\n 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,\n 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,\n 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47\n]);\n\n// \"=\".codePointAt(0)\nconst ENCODE_PAD = 61;\n\n// inverse of ENCODE_MAP\n// generated by\n// ENCODE_MAP.reduce((acc, v, i) => { acc[v] = i; return acc }, Array(255).fill(100))\n// biome-ignore format:\nconst DECODE_MAP = new Uint8Array([\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 62, 100, 100,\n 100, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 100, 100, 100, 100, 100, 100,\n 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n 21, 22, 23, 24, 25, 100, 100, 100, 100, 100, 100, 26, 27, 28, 29, 30, 31, 32,\n 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,\n 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100\n]);\n\n/**\n * Encodes a Uint8Array into a Base64 encoded Uint8Array.\n *\n * @credit https://github.com/hi-ogawa/js-utils\n *\n * @param input - The input Uint8Array or string to encode.\n * @returns The Base64 encoded Uint8Array.\n */\nexport function encodeBase64(input: Uint8Array | string): string {\n if (isString(input)) {\n input = stringToUint8Array(input);\n }\n\n const xLen = input.length;\n const result = new Uint8Array(Math.ceil(xLen / 3) * 4);\n const chunkLen = Math.floor(xLen / 3);\n\n // encode complete chunks\n for (let i = 0; i < chunkLen; i++) {\n const chunk =\n (input[3 * i + 0]! << 16) | (input[3 * i + 1]! << 8) | input[3 * i + 2]!;\n result[4 * i + 0] = ENCODE_MAP[(chunk >> 18) & 0b111111]!;\n result[4 * i + 1] = ENCODE_MAP[(chunk >> 12) & 0b111111]!;\n result[4 * i + 2] = ENCODE_MAP[(chunk >> 6) & 0b111111]!;\n result[4 * i + 3] = ENCODE_MAP[(chunk >> 0) & 0b111111]!;\n }\n\n // encode partial chunk with padding\n const i = chunkLen;\n switch (xLen % 3) {\n case 1: {\n const chunk = input[3 * i + 0]! << 16;\n result[4 * i + 0] = ENCODE_MAP[(chunk >> 18) & 0b111111]!;\n result[4 * i + 1] = ENCODE_MAP[(chunk >> 12) & 0b111111]!;\n result[4 * i + 2] = ENCODE_PAD;\n result[4 * i + 3] = ENCODE_PAD;\n break;\n }\n case 2: {\n const chunk = (input[3 * i + 0]! << 16) | (input[3 * i + 1]! << 8);\n result[4 * i + 0] = ENCODE_MAP[(chunk >> 18) & 0b111111]!;\n result[4 * i + 1] = ENCODE_MAP[(chunk >> 12) & 0b111111]!;\n result[4 * i + 2] = ENCODE_MAP[(chunk >> 6) & 0b111111]!;\n result[4 * i + 3] = ENCODE_PAD;\n break;\n }\n }\n\n return utf8ArrayToString(result);\n}\n\n/**\n * Decodes a Base64 encoded Uint8Array into a Uint8Array.\n *\n * @credit https://github.com/hi-ogawa/js-utils\n *\n * @param input - The Base64 encoded Uint8Array or string to decode.\n * @returns The decoded Uint8Array.\n */\nexport function decodeBase64(input: Uint8Array | string): Uint8Array {\n if (isString(input)) {\n input = stringToUint8Array(input);\n }\n\n const yLen = input.length;\n\n // validate length\n if (yLen % 4 !== 0) {\n throw new Error(\"invalid length\");\n }\n\n // get padding length\n let padLen = 0;\n while (\n padLen < 2 &&\n padLen < input.length &&\n input[input.length - 1 - padLen] === ENCODE_PAD\n ) {\n padLen++;\n }\n\n // validate encoding\n for (let i = 0; i < input.length - padLen; i++) {\n if (\n isUndefined(input[i]) ||\n isUndefined(DECODE_MAP[input[i]!]) ||\n DECODE_MAP[input[i]!]! >= 64\n ) {\n throw new Error(\"invalid data\");\n }\n }\n\n // validate encoding\n const chunkLen = Math.floor((yLen - padLen) / 4);\n const xLen = 3 * chunkLen + ((3 - padLen) % 3);\n const result = new Uint8Array(xLen);\n\n // decode complete chunks\n for (let i = 0; i < chunkLen; i++) {\n const chunk =\n (DECODE_MAP[input[4 * i + 0]!]! << 18) |\n (DECODE_MAP[input[4 * i + 1]!]! << 12) |\n (DECODE_MAP[input[4 * i + 2]!]! << 6) |\n (DECODE_MAP[input[4 * i + 3]!]! << 0);\n result[3 * i] = (chunk >> 16) & 0xff;\n result[3 * i + 1] = (chunk >> 8) & 0xff;\n result[3 * i + 2] = (chunk >> 0) & 0xff;\n }\n\n // decode partial chunk\n const i = chunkLen;\n switch (xLen % 3) {\n case 1: {\n const chunk =\n (DECODE_MAP[input[4 * i + 0]!]! << 18) |\n (DECODE_MAP[input[4 * i + 1]!]! << 12);\n result[3 * i] = (chunk >> 16) & 0xff;\n break;\n }\n case 2: {\n const chunk =\n (DECODE_MAP[input[4 * i + 0]!]! << 18) |\n (DECODE_MAP[input[4 * i + 1]!]! << 12) |\n (DECODE_MAP[input[4 * i + 2]!]! << 6);\n result[3 * i] = (chunk >> 16) & 0xff;\n result[3 * i + 1] = (chunk >> 8) & 0xff;\n break;\n }\n }\n\n return result;\n}\n\n/**\n * Converts a Base64 encoded string to a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C\n *\n * @param base64 - The Base64 encoded string to convert.\n * @returns The Base64url encoded string.\n */\nexport function base64UrlEncode(base64: Uint8Array): string {\n return btoa(String.fromCharCode(...base64))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=/g, \"\");\n}\n\n/**\n * Converts a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string to a Base64 encoded string.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C\n *\n * @param base64url - The Base64url encoded string to convert.\n * @returns The Base64 encoded string.\n */\nexport function base64UrlDecode(base64url: string): Uint8Array {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n return new Uint8Array(\n [...atob(base64 + \"=\".repeat((4 - (base64.length % 4)) % 4))].map(c =>\n c.charCodeAt(0)\n )\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst ALPHABET = \"0123456789ABCDEF\";\nconst DECODE_MAP: Record<string, number> = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n a: 10,\n A: 10,\n b: 11,\n B: 11,\n c: 12,\n C: 12,\n d: 13,\n D: 13,\n e: 14,\n E: 14,\n f: 15,\n F: 15\n};\n\n/**\n * Encodes a Uint8Array into a hexadecimal string.\n *\n * @param input - The input Uint8Array.\n * @returns The hexadecimal string.\n */\nexport function encodeHex(input: Uint8Array): string {\n let result = \"\";\n for (let i = 0; i < input.length; i++) {\n result += ALPHABET[input[i]! >> 4];\n result += ALPHABET[input[i]! & 0x0f];\n }\n return result;\n}\n\n/**\n * Encodes a Uint8Array into an uppercase hexadecimal string.\n *\n * @param input - The input Uint8Array.\n * @returns The uppercase hexadecimal string.\n */\nexport function decodeHex(input: string): Uint8Array {\n if (input.length % 2 !== 0) {\n throw new Error(\"Invalid hex string\");\n }\n const result = new Uint8Array(input.length / 2);\n for (let i = 0; i < input.length; i += 2) {\n if (!(input[i]! in DECODE_MAP)) {\n throw new Error(\"Invalid character\");\n }\n if (!(input[i + 1]! in DECODE_MAP)) {\n throw new Error(\"Invalid character\");\n }\n result[i / 2]! |= DECODE_MAP[input[i]!]! << 4;\n result[i / 2]! |= DECODE_MAP[input[i + 1]!]!;\n }\n return result;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n base64StringToUint8Array,\n concatUint8Array,\n stringToUtf8Array,\n uint8ArrayToString,\n utf8ArrayToString\n} from \"@stryke/convert/neutral\";\nimport { decodeBase64, encodeBase64 } from \"./base-64\";\nimport { decodeHex, encodeHex } from \"./hex\";\n\n/**\n * Creates a CryptoKey object that can be used to encrypt any string.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey\n *\n * @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings.\n */\nexport async function createKey(): Promise<CryptoKey> {\n return crypto.subtle.generateKey(\n {\n name: \"AES-GCM\",\n length: 256\n },\n true,\n [\"encrypt\", \"decrypt\"]\n );\n}\n\n/**\n * Encodes a CryptoKey to base64 string, so that it can be embedded in JSON / JavaScript\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey\n *\n * @param key - The CryptoKey to encode\n * @returns A promise that resolves to a base64 string representing the key\n */\nexport async function encodeKey(key: CryptoKey): Promise<string> {\n const exported = await crypto.subtle.exportKey(\"raw\", key);\n\n return encodeBase64(new Uint8Array(exported)).toString();\n}\n\n/**\n * Decodes a base64 string into bytes and then imports the key.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey\n *\n * @param encoded - The base64 encoded key\n * @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings\n */\nexport async function decodeKey(encoded: string): Promise<CryptoKey> {\n const bytes = decodeBase64(encoded);\n\n return crypto.subtle.importKey(\n \"raw\",\n bytes.buffer as ArrayBuffer,\n \"AES-GCM\",\n true,\n [\"encrypt\", \"decrypt\"]\n );\n}\n\n// The length of the initialization vector\n// See https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams\nconst IV_LENGTH = 24;\n\n/**\n * Using a CryptoKey, use AES-GCM to encrypt a string into a base64 string.\n *\n * @remarks\n * The initialization vector is randomly generated and prepended to the encrypted string. The IV is required for decryption, so it must be stored alongside the encrypted data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt\n *\n * @param key - The CryptoKey to use for encryption\n * @param plaintext - The plaintext string to encrypt\n * @returns A promise that resolves to a base64 string representing the encrypted data\n */\nexport async function encrypt(\n key: CryptoKey,\n plaintext: string\n): Promise<string> {\n const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH / 2));\n const encrypted = await crypto.subtle.encrypt(\n {\n name: \"AES-GCM\",\n iv\n },\n key,\n stringToUtf8Array(plaintext) as BufferSource\n );\n\n // iv is 12, hex brings it to 24\n return encodeHex(iv) + encodeBase64(new Uint8Array(encrypted));\n}\n\n/**\n * Takes a base64 encoded string, decodes it and returns the AES-GCM decrypted text.\n *\n * @remarks\n * The initialization vector is expected to be prepended to the encrypted string. The IV is required for decryption, so it must be extracted from the start of the string.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt\n *\n * @param key - The CryptoKey to use for decryption\n * @param encrypted - The encrypted base64 encoded string to decrypt\n * @returns A promise that resolves to the decrypted string\n */\nexport async function decrypt(\n key: CryptoKey,\n encrypted: string\n): Promise<string> {\n const decrypted = await crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: decodeHex(encrypted.slice(0, IV_LENGTH)) as Uint8Array<ArrayBuffer>\n },\n key,\n decodeBase64(encrypted.slice(IV_LENGTH)) as BufferSource\n );\n\n return utf8ArrayToString(decrypted);\n}\n\n/**\n * Encrypts a buffer using AES-GCM with a given CryptoKey.\n *\n * @remarks\n * The initialization vector (IV) is randomly generated and prepended to the encrypted data. The resulting data is then encoded as a base64 string for easy storage/transmission.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt\n *\n * @param key - The CryptoKey to use for encryption\n * @param buffer - The buffer to encrypt\n * @returns A promise that resolves to a base64 string representing the encrypted data\n */\nexport async function encryptBuffer(\n key: CryptoKey,\n buffer: BufferSource\n): Promise<string> {\n const iv = crypto.getRandomValues(new Uint8Array(16));\n const encrypted = await crypto.subtle.encrypt(\n {\n name: \"AES-GCM\",\n iv\n },\n key,\n buffer\n );\n\n return uint8ArrayToString(concatUint8Array([iv, new Uint8Array(encrypted)]));\n}\n\n/**\n * Decrypts a buffer using AES-GCM with a given CryptoKey.\n *\n * @remarks\n * The initialization vector (IV) is expected to be prepended to the encrypted data. The IV is required for decryption, so it must be extracted from the start of the buffer.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt\n *\n * @param key - The CryptoKey to use for decryption\n * @param encrypted - The encrypted base64 encoded string to decrypt\n * @returns A promise that resolves to the decrypted string\n */\nexport async function decryptBuffer(\n key: CryptoKey,\n encrypted: string\n): Promise<ArrayBuffer> {\n const concatenated = base64StringToUint8Array(encrypted);\n\n return crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: concatenated.slice(0, 16)\n },\n key,\n concatenated.slice(16)\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Generate a random byte array of the specified length using the Web Crypto API.\n *\n * @param length - The length of the random byte array to generate (default is 32 bytes)\n * @returns A Uint8Array containing random bytes of the specified length\n */\nexport function generateRandomBytes(length: number = 32): Uint8Array {\n return crypto.getRandomValues(new Uint8Array(length));\n}\n\n/**\n * Generate a random string of the specified length using characters A-Z, a-z, and 0-9 for CSRF tokens, etc.\n *\n * @remarks\n * This function uses the Web Crypto API's `crypto.getRandomValues` to generate secure random bytes,\n * and then maps those bytes to characters in the specified character set. It uses rejection sampling\n * to ensure a uniform distribution of characters without modulo bias.\n *\n * @param length - The length of the random string to generate (default is 32 characters)\n * @returns A random string of the specified length\n */\nexport function generateRandomString(length: number = 32): string {\n const chars =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n const charsLen = chars.length; // 62 characters\n // Use rejection sampling to avoid modulo bias\n // 256 % 62 = 8, so we reject values >= 248 to ensure uniform distribution\n const maxValid = 256 - (256 % charsLen); // 248\n const result: string[] = [];\n\n while (result.length < length) {\n const bytes = generateRandomBytes(length - result.length);\n for (const b of bytes) {\n if (b < maxValid && result.length < length && chars[b % charsLen]) {\n result.push(chars[b % charsLen]!);\n }\n }\n }\n\n return result.join(\"\");\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,oBACd,QACQ;CACR,MAAM,QAAQ,kBAAkB,aAAa,SAAS,IAAI,WAAW,OAAO;CAC5E,MAAM,MAAM,MAAM;AAClB,KAAI,MAAM,MACR,QAAO,OAAO,aAAa,MAAM,MAAM,MAA6B;CAEtE,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IACvB,WAAU,OAAO,aAAa,MAAM,GAAI;AAE1C,QAAO;;;;;AClBT,MAAa,eAAe,UAAuC;AACjE,QAAO,UAAU;;;;;ACDnB,MAAa,iBAAiB,OAAO,WAAW;;;;AAKhD,MAAaA,WAAmC,iBAC5C,OAAO,SAAS,KAAK,OAAO,GAO5B,SAASC,WACP,OACiB;AACjB,QAAO;;;;;ACdb,MAAM,iBAAgB,QAAO;AAC3B,KAAI,OAAO,eAAe,SACxB,QAAO;AAET,QAAO,eAAe,KAAK,0BAA0B;EACnD,MAAM;AACJ,UAAO;;EAET,cAAc;EACf,CAAC;AAOF,QAAO;GACN,OAAO,UAAU;;;;ACn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
+ *
5
+ * @credit https://github.com/hi-ogawa/js-utils
6
+ *
7
+ * @param input - The input Uint8Array or string to encode.
8
+ * @returns The Base64 encoded Uint8Array.
9
+ */
10
+ declare function encodeBase64(input: Uint8Array | string): string;
11
+ /**
12
+ * Decodes a Base64 encoded Uint8Array into a Uint8Array.
13
+ *
14
+ * @credit https://github.com/hi-ogawa/js-utils
15
+ *
16
+ * @param input - The Base64 encoded Uint8Array or string to decode.
17
+ * @returns The decoded Uint8Array.
18
+ */
19
+ declare function decodeBase64(input: Uint8Array | string): Uint8Array;
20
+ /**
21
+ * Converts a Base64 encoded string to a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string.
22
+ *
23
+ * @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
24
+ *
25
+ * @param base64 - The Base64 encoded string to convert.
26
+ * @returns The Base64url encoded string.
27
+ */
28
+ declare function base64UrlEncode(base64: Uint8Array): string;
29
+ /**
30
+ * Converts a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string to a Base64 encoded string.
31
+ *
32
+ * @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
33
+ *
34
+ * @param base64url - The Base64url encoded string to convert.
35
+ * @returns The Base64 encoded string.
36
+ */
37
+ declare function base64UrlDecode(base64url: string): Uint8Array;
38
+ //#endregion
1
39
  //#region src/encryption.d.ts
2
40
  /**
3
41
  * Creates a CryptoKey object that can be used to encrypt any string.
@@ -78,5 +116,42 @@ declare function encryptBuffer(key: CryptoKey, buffer: BufferSource): Promise<st
78
116
  */
79
117
  declare function decryptBuffer(key: CryptoKey, encrypted: string): Promise<ArrayBuffer>;
80
118
  //#endregion
81
- export { createKey, decodeKey, decrypt, decryptBuffer, encodeKey, encrypt, encryptBuffer };
82
- //# sourceMappingURL=encryption.d.cts.map
119
+ //#region src/hex.d.ts
120
+ /**
121
+ * Encodes a Uint8Array into a hexadecimal string.
122
+ *
123
+ * @param input - The input Uint8Array.
124
+ * @returns The hexadecimal string.
125
+ */
126
+ declare function encodeHex(input: Uint8Array): string;
127
+ /**
128
+ * Encodes a Uint8Array into an uppercase hexadecimal string.
129
+ *
130
+ * @param input - The input Uint8Array.
131
+ * @returns The uppercase hexadecimal string.
132
+ */
133
+ declare function decodeHex(input: string): Uint8Array;
134
+ //#endregion
135
+ //#region src/random.d.ts
136
+ /**
137
+ * Generate a random byte array of the specified length using the Web Crypto API.
138
+ *
139
+ * @param length - The length of the random byte array to generate (default is 32 bytes)
140
+ * @returns A Uint8Array containing random bytes of the specified length
141
+ */
142
+ declare function generateRandomBytes(length?: number): Uint8Array;
143
+ /**
144
+ * Generate a random string of the specified length using characters A-Z, a-z, and 0-9 for CSRF tokens, etc.
145
+ *
146
+ * @remarks
147
+ * This function uses the Web Crypto API's `crypto.getRandomValues` to generate secure random bytes,
148
+ * and then maps those bytes to characters in the specified character set. It uses rejection sampling
149
+ * to ensure a uniform distribution of characters without modulo bias.
150
+ *
151
+ * @param length - The length of the random string to generate (default is 32 characters)
152
+ * @returns A random string of the specified length
153
+ */
154
+ declare function generateRandomString(length?: number): string;
155
+ //#endregion
156
+ export { createKey as a, decryptBuffer as c, encryptBuffer as d, base64UrlDecode as f, encodeBase64 as h, encodeHex as i, encodeKey as l, decodeBase64 as m, generateRandomString as n, decodeKey as o, base64UrlEncode as p, decodeHex as r, decrypt as s, generateRandomBytes as t, encrypt as u };
157
+ //# sourceMappingURL=neutral-CW6EXiYo.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neutral-CW6EXiYo.d.cts","names":[],"sources":["../src/base-64.ts","../src/encryption.ts","../src/hex.ts","../src/random.ts"],"sourcesContent":[],"mappings":";;AAoEA;AAmDA;AAkFA;AAeA;;;;ACrLsB,iBDiCN,YAAA,CCjC2B,KAAR,EDiCC,UCjCM,GAAA,MAAA,CAAA,EAAA,MAAA;AAmB1C;AAcA;AA4BA;AA8BA;AA4BA;;;;AAGU,iBDtCM,YAAA,CCsCN,KAAA,EDtC0B,UCsC1B,GAAA,MAAA,CAAA,EDtCgD,UCsChD;AA0BV;;;;;;;;ACrIgB,iBFuJA,eAAA,CEvJ2B,MAAA,EFuJH,UEvJG,CAAA,EAAA,MAAA;AAe3C;;;;ACzCA;AAeA;;;iBHiLgB,eAAA,qBAAoC;;;;AApJpD;AAmDA;AAkFA;AAeA;;;iBCrLsB,SAAA,CAAA,GAAa,QAAQ;AAA3C;AAmBA;AAcA;AA4BA;AA8BA;AA4BA;;;AAGG,iBAvGmB,SAAA,CAuGnB,GAAA,EAvGkC,SAuGlC,CAAA,EAvG8C,OAuG9C,CAAA,MAAA,CAAA;;AA0BH;;;;;;;iBAnHsB,SAAA,mBAA4B,QAAQ;AClB1D;AAeA;;;;ACzCA;AAeA;;;;;;iBFyDsB,OAAA,MACf,+BAEJ;;;;;;;;;;;;;iBA2BmB,OAAA,MACf,+BAEJ;;;;;;;;;;;;;iBAyBmB,aAAA,MACf,mBACG,eACP;;;;;;;;;;;;;iBA0BmB,aAAA,MACf,+BAEJ,QAAQ;;;;ADtHX;AAmDA;AAkFA;AAeA;;iBEtKgB,SAAA,QAAiB;;ADfjC;AAmBA;AAcA;AA4BA;AA8BA;AA4BsB,iBCzFN,SAAA,CDyFmB,KAAA,EAAA,MAAA,CAAA,ECzFO,UDyFP;;;;ADtFnC;AAmDA;AAkFA;AAeA;;iBGhMgB,mBAAA,mBAA0C;;AFW1D;AAmBA;AAcA;AA4BA;AA8BA;AA4BA;;;;;AA6BsB,iBEhJN,oBAAA,CFgJmB,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
package/dist/neutral.cjs CHANGED
@@ -1,17 +1,17 @@
1
- const require_base_64 = require('./base-64.cjs');
2
- const require_hex = require('./hex.cjs');
3
- const require_encryption = require('./encryption.cjs');
1
+ const require_neutral = require('./neutral-BISXAuIW.cjs');
4
2
 
5
- exports.base64FromBase64url = require_base_64.base64FromBase64url;
6
- exports.base64ToBase64url = require_base_64.base64ToBase64url;
7
- exports.createKey = require_encryption.createKey;
8
- exports.decodeBase64 = require_base_64.decodeBase64;
9
- exports.decodeHex = require_hex.decodeHex;
10
- exports.decodeKey = require_encryption.decodeKey;
11
- exports.decrypt = require_encryption.decrypt;
12
- exports.decryptBuffer = require_encryption.decryptBuffer;
13
- exports.encodeBase64 = require_base_64.encodeBase64;
14
- exports.encodeHex = require_hex.encodeHex;
15
- exports.encodeKey = require_encryption.encodeKey;
16
- exports.encrypt = require_encryption.encrypt;
17
- exports.encryptBuffer = require_encryption.encryptBuffer;
3
+ exports.base64UrlDecode = require_neutral.base64UrlDecode;
4
+ exports.base64UrlEncode = require_neutral.base64UrlEncode;
5
+ exports.createKey = require_neutral.createKey;
6
+ exports.decodeBase64 = require_neutral.decodeBase64;
7
+ exports.decodeHex = require_neutral.decodeHex;
8
+ exports.decodeKey = require_neutral.decodeKey;
9
+ exports.decrypt = require_neutral.decrypt;
10
+ exports.decryptBuffer = require_neutral.decryptBuffer;
11
+ exports.encodeBase64 = require_neutral.encodeBase64;
12
+ exports.encodeHex = require_neutral.encodeHex;
13
+ exports.encodeKey = require_neutral.encodeKey;
14
+ exports.encrypt = require_neutral.encrypt;
15
+ exports.encryptBuffer = require_neutral.encryptBuffer;
16
+ exports.generateRandomBytes = require_neutral.generateRandomBytes;
17
+ exports.generateRandomString = require_neutral.generateRandomString;
@@ -1,4 +1,2 @@
1
- import { base64FromBase64url, base64ToBase64url, decodeBase64, encodeBase64 } from "./base-64.cjs";
2
- import { createKey, decodeKey, decrypt, decryptBuffer, encodeKey, encrypt, encryptBuffer } from "./encryption.cjs";
3
- import { decodeHex, encodeHex } from "./hex.cjs";
4
- export { base64FromBase64url, base64ToBase64url, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer };
1
+ import { a as createKey, c as decryptBuffer, d as encryptBuffer, f as base64UrlDecode, h as encodeBase64, i as encodeHex, l as encodeKey, m as decodeBase64, n as generateRandomString, o as decodeKey, p as base64UrlEncode, r as decodeHex, s as decrypt, t as generateRandomBytes, u as encrypt } from "./neutral-CW6EXiYo.cjs";
2
+ export { base64UrlDecode, base64UrlEncode, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer, generateRandomBytes, generateRandomString };
@@ -1,4 +1,2 @@
1
- import { base64FromBase64url, base64ToBase64url, decodeBase64, encodeBase64 } from "./base-64.mjs";
2
- import { createKey, decodeKey, decrypt, decryptBuffer, encodeKey, encrypt, encryptBuffer } from "./encryption.mjs";
3
- import { decodeHex, encodeHex } from "./hex.mjs";
4
- export { base64FromBase64url, base64ToBase64url, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer };
1
+ import { a as createKey, c as decryptBuffer, d as encryptBuffer, f as base64UrlDecode, h as encodeBase64, i as encodeHex, l as encodeKey, m as decodeBase64, n as generateRandomString, o as decodeKey, p as base64UrlEncode, r as decodeHex, s as decrypt, t as generateRandomBytes, u as encrypt } from "./neutral-BJmyEdJq.mjs";
2
+ export { base64UrlDecode, base64UrlEncode, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer, generateRandomBytes, generateRandomString };
package/dist/neutral.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import { base64FromBase64url, base64ToBase64url, decodeBase64, encodeBase64 } from "./base-64.mjs";
2
- import { decodeHex, encodeHex } from "./hex.mjs";
3
- import { createKey, decodeKey, decrypt, decryptBuffer, encodeKey, encrypt, encryptBuffer } from "./encryption.mjs";
1
+ import { a as decrypt, c as encrypt, d as encodeHex, f as base64UrlDecode, h as encodeBase64, i as decodeKey, l as encryptBuffer, m as decodeBase64, n as generateRandomString, o as decryptBuffer, p as base64UrlEncode, r as createKey, s as encodeKey, t as generateRandomBytes, u as decodeHex } from "./neutral-BtZoJSl-.mjs";
4
2
 
5
- export { base64FromBase64url, base64ToBase64url, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer };
3
+ export { base64UrlDecode, base64UrlEncode, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer, generateRandomBytes, generateRandomString };