@fgv/ts-extras-argon2 5.1.0-27 → 5.1.0-29

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 (45) hide show
  1. package/.rush/temp/1eeff6c792a22da33ec43389adf2e5a1cc51a542.tar.log +48 -0
  2. package/.rush/temp/chunked-rush-logs/ts-extras-argon2.build.chunks.jsonl +9 -0
  3. package/.rush/temp/operation/build/all.log +9 -0
  4. package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
  5. package/.rush/temp/operation/build/state.json +3 -0
  6. package/.rush/temp/shrinkwrap-deps.json +8 -7
  7. package/dist/index.js +21 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/packlets/argon2/index.js +24 -0
  10. package/dist/packlets/argon2/index.js.map +1 -0
  11. package/dist/packlets/argon2/nodeArgon2Provider.js +80 -0
  12. package/dist/packlets/argon2/nodeArgon2Provider.js.map +1 -0
  13. package/dist/test/unit/argon2/crossRuntime.test.js +96 -0
  14. package/dist/test/unit/argon2/crossRuntime.test.js.map +1 -0
  15. package/dist/test/unit/argon2/nodeArgon2Provider.test.js +100 -0
  16. package/dist/test/unit/argon2/nodeArgon2Provider.test.js.map +1 -0
  17. package/dist/ts-extras-argon2.d.ts +32 -0
  18. package/dist/tsdoc-metadata.json +11 -0
  19. package/lib/index.d.ts +2 -0
  20. package/lib/index.d.ts.map +1 -0
  21. package/lib/index.js +26 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/packlets/argon2/index.d.ts +3 -0
  24. package/lib/packlets/argon2/index.d.ts.map +1 -0
  25. package/lib/packlets/argon2/index.js +29 -0
  26. package/lib/packlets/argon2/index.js.map +1 -0
  27. package/lib/packlets/argon2/nodeArgon2Provider.d.ts +28 -0
  28. package/lib/packlets/argon2/nodeArgon2Provider.d.ts.map +1 -0
  29. package/lib/packlets/argon2/nodeArgon2Provider.js +117 -0
  30. package/lib/packlets/argon2/nodeArgon2Provider.js.map +1 -0
  31. package/lib/test/unit/argon2/crossRuntime.test.d.ts +2 -0
  32. package/lib/test/unit/argon2/crossRuntime.test.d.ts.map +1 -0
  33. package/lib/test/unit/argon2/crossRuntime.test.js +98 -0
  34. package/lib/test/unit/argon2/crossRuntime.test.js.map +1 -0
  35. package/lib/test/unit/argon2/nodeArgon2Provider.test.d.ts +2 -0
  36. package/lib/test/unit/argon2/nodeArgon2Provider.test.d.ts.map +1 -0
  37. package/lib/test/unit/argon2/nodeArgon2Provider.test.js +102 -0
  38. package/lib/test/unit/argon2/nodeArgon2Provider.test.js.map +1 -0
  39. package/package.json +20 -20
  40. package/rush-logs/ts-extras-argon2.build.cache.log +3 -0
  41. package/rush-logs/ts-extras-argon2.build.log +9 -0
  42. package/temp/build/lint/_eslint-5eVG3S6w.json +26 -0
  43. package/temp/build/typescript/ts_8nwakTlr.json +1 -0
  44. package/temp/ts-extras-argon2.api.json +382 -0
  45. package/temp/ts-extras-argon2.api.md +20 -0
@@ -0,0 +1,48 @@
1
+ Start time: Tue May 19 2026 18:40:59 GMT+0000 (Coordinated Universal Time)
2
+ Invoking "/usr/bin/tar -c -f /home/runner/work/fgv/fgv/common/temp/build-cache/1eeff6c792a22da33ec43389adf2e5a1cc51a542-c28e0894e1234cc0.temp -z --files-from=-"
3
+
4
+ ======= BEGIN PROCESS INPUT ======
5
+ .rush/temp/operation/build/all.log
6
+ .rush/temp/operation/build/log-chunks.jsonl
7
+ .rush/temp/operation/build/state.json
8
+ dist/index.js
9
+ dist/index.js.map
10
+ dist/packlets/argon2/index.js
11
+ dist/packlets/argon2/index.js.map
12
+ dist/packlets/argon2/nodeArgon2Provider.js
13
+ dist/packlets/argon2/nodeArgon2Provider.js.map
14
+ dist/test/unit/argon2/crossRuntime.test.js
15
+ dist/test/unit/argon2/crossRuntime.test.js.map
16
+ dist/test/unit/argon2/nodeArgon2Provider.test.js
17
+ dist/test/unit/argon2/nodeArgon2Provider.test.js.map
18
+ dist/ts-extras-argon2.d.ts
19
+ dist/tsdoc-metadata.json
20
+ lib/index.d.ts
21
+ lib/index.d.ts.map
22
+ lib/index.js
23
+ lib/index.js.map
24
+ lib/packlets/argon2/index.d.ts
25
+ lib/packlets/argon2/index.d.ts.map
26
+ lib/packlets/argon2/index.js
27
+ lib/packlets/argon2/index.js.map
28
+ lib/packlets/argon2/nodeArgon2Provider.d.ts
29
+ lib/packlets/argon2/nodeArgon2Provider.d.ts.map
30
+ lib/packlets/argon2/nodeArgon2Provider.js
31
+ lib/packlets/argon2/nodeArgon2Provider.js.map
32
+ lib/test/unit/argon2/crossRuntime.test.d.ts
33
+ lib/test/unit/argon2/crossRuntime.test.d.ts.map
34
+ lib/test/unit/argon2/crossRuntime.test.js
35
+ lib/test/unit/argon2/crossRuntime.test.js.map
36
+ lib/test/unit/argon2/nodeArgon2Provider.test.d.ts
37
+ lib/test/unit/argon2/nodeArgon2Provider.test.d.ts.map
38
+ lib/test/unit/argon2/nodeArgon2Provider.test.js
39
+ lib/test/unit/argon2/nodeArgon2Provider.test.js.map
40
+ temp/build/lint/_eslint-5eVG3S6w.json
41
+ temp/build/typescript/ts_8nwakTlr.json
42
+ temp/ts-extras-argon2.api.json
43
+ temp/ts-extras-argon2.api.md
44
+ ======== END PROCESS INPUT =======
45
+ ======= BEGIN PROCESS OUTPUT =======
46
+ ======== END PROCESS OUTPUT ========
47
+
48
+ Exited with code "0"
@@ -0,0 +1,9 @@
1
+ {"kind":"O","text":"Invoking: heft build --clean \n"}
2
+ {"kind":"O","text":" ---- build started ---- \n"}
3
+ {"kind":"O","text":"[build:typescript] The TypeScript compiler version 5.9.3 is newer than the latest version that was tested with Heft (5.8); it may not work correctly.\n"}
4
+ {"kind":"O","text":"[build:typescript] Using TypeScript version 5.9.3\n"}
5
+ {"kind":"O","text":"[build:lint] Using ESLint version 9.39.4\n"}
6
+ {"kind":"O","text":"[build:api-extractor] Using API Extractor version 7.58.7\n"}
7
+ {"kind":"O","text":"[build:api-extractor] Analysis will use the bundled TypeScript version 5.9.3\n"}
8
+ {"kind":"O","text":" ---- build finished (17.433s) ---- \n"}
9
+ {"kind":"O","text":"-------------------- Finished (17.442s) --------------------\n"}
@@ -0,0 +1,9 @@
1
+ Invoking: heft build --clean
2
+ ---- build started ----
3
+ [build:typescript] The TypeScript compiler version 5.9.3 is newer than the latest version that was tested with Heft (5.8); it may not work correctly.
4
+ [build:typescript] Using TypeScript version 5.9.3
5
+ [build:lint] Using ESLint version 9.39.4
6
+ [build:api-extractor] Using API Extractor version 7.58.7
7
+ [build:api-extractor] Analysis will use the bundled TypeScript version 5.9.3
8
+ ---- build finished (17.433s) ----
9
+ -------------------- Finished (17.442s) --------------------
@@ -0,0 +1,9 @@
1
+ {"kind":"O","text":"Invoking: heft build --clean \n"}
2
+ {"kind":"O","text":" ---- build started ---- \n"}
3
+ {"kind":"O","text":"[build:typescript] The TypeScript compiler version 5.9.3 is newer than the latest version that was tested with Heft (5.8); it may not work correctly.\n"}
4
+ {"kind":"O","text":"[build:typescript] Using TypeScript version 5.9.3\n"}
5
+ {"kind":"O","text":"[build:lint] Using ESLint version 9.39.4\n"}
6
+ {"kind":"O","text":"[build:api-extractor] Using API Extractor version 7.58.7\n"}
7
+ {"kind":"O","text":"[build:api-extractor] Analysis will use the bundled TypeScript version 5.9.3\n"}
8
+ {"kind":"O","text":" ---- build finished (17.433s) ---- \n"}
9
+ {"kind":"O","text":"-------------------- Finished (17.442s) --------------------\n"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "nonCachedDurationMs": 18958.439717999994
3
+ }
@@ -57,14 +57,14 @@
57
57
  "@istanbuljs/load-nyc-config@1.1.0": "@istanbuljs/load-nyc-config@1.1.0:+tylbO0guJzkDbovYDgbHxTUl8kcvrir2peVAz60F9g=:",
58
58
  "@istanbuljs/schema@0.1.6": "@istanbuljs/schema@0.1.6:kHUsJhhk+xYurqEbatAwNKyk2wIdJh5oEFxE+OA9lAI=:",
59
59
  "@jest/console@29.7.0": "@jest/console@29.7.0:TQRkf42vTpyRj6JKPw9BkdMha9I54trgb3XRAe32Pl0=:",
60
- "@jest/core@29.5.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "@jest/core@29.5.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):V0zwu+VAbcIqksDeTe5n4d5ZTagkHAxWMk+ZDMS/d8s=:",
60
+ "@jest/core@29.5.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "@jest/core@29.5.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):vfQwH98lHyFmOMKFwuLSUMu2oYc+jo7kNYES54VpHpM=:",
61
61
  "@jest/core@29.7.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "@jest/core@29.7.0(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):b1NlQGJwtwPo53fIAa52W7sL74ntIH9Gd71zkNZjtQU=:",
62
62
  "@jest/environment@29.7.0": "@jest/environment@29.7.0:OccT6t+RUEze2pPv2096Z0ZxEfPR51vzs3/M92hG+lg=:",
63
63
  "@jest/expect-utils@29.7.0": "@jest/expect-utils@29.7.0:/5kYHU3SqucZ7ntrJG7Xb6LROYA/xdv03kWifxweOOE=:",
64
64
  "@jest/expect@29.7.0": "@jest/expect@29.7.0:5RHpcXNns1pWGTly3ZEOXwfx30hQaVIQ/8ZSq+ggjXI=:",
65
65
  "@jest/fake-timers@29.7.0": "@jest/fake-timers@29.7.0:JvLOwTWmr/YwC0klYOyunqcJz4R6q9PWAQ9QL6BQGXU=:",
66
66
  "@jest/globals@29.7.0": "@jest/globals@29.7.0:rn89P6vMp8c61OyeFehs6p5mXPyh1Mg7SlqmQWtTqnk=:",
67
- "@jest/reporters@29.5.0": "@jest/reporters@29.5.0:ZiTpAQdVIeEqE4kKPlJw5c+M6YeyZu1cxnKpzGXMKb0=:",
67
+ "@jest/reporters@29.5.0": "@jest/reporters@29.5.0:QAx67DoDgrmxGGeOO9XnaWpsolOsg2mf8YgGBlIjOhM=:",
68
68
  "@jest/reporters@29.7.0": "@jest/reporters@29.7.0:Tpczh4EpmTvIn/FN76ivA6tR31dNM++7NkS9J7dt4mE=:",
69
69
  "@jest/schemas@29.6.3": "@jest/schemas@29.6.3:k3bivx0mavN4Y4JNrlgZwLcSoyQrOCZXUXmIQ1Nsblc=:",
70
70
  "@jest/source-map@29.6.3": "@jest/source-map@29.6.3:YrWW+6HHLR2tfBDJ0S2FXQEQC+LRLZAxnV8EE+gaNkg=:",
@@ -159,8 +159,8 @@
159
159
  "@typescript-eslint/parser@8.56.1(eslint@9.37.0(jiti@2.7.0))(typescript@5.8.3)": "@typescript-eslint/parser@8.56.1(eslint@9.37.0(jiti@2.7.0))(typescript@5.8.3):gY3oJ8Qa8yQw9MilFm9zL330Ig+ihnjnAFKtjOpL+JM=:",
160
160
  "@typescript-eslint/parser@8.56.1(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3)": "@typescript-eslint/parser@8.56.1(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3):IObb8qC909jXqUvvc2AGU4SXIVCm64dC/YgeexZXn5k=:",
161
161
  "@typescript-eslint/parser@8.59.3(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3)": "@typescript-eslint/parser@8.59.3(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3):DWHVak7g3z8Gq6oXyoVHa09NFMm+1YrikFbi//bjj8I=:",
162
- "@typescript-eslint/project-service@8.56.1(typescript@5.8.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.8.3):FfgcSYlXvtFZ/3N7mrxILyidaGkI2MvkdZFemEaPrlc=:",
163
- "@typescript-eslint/project-service@8.56.1(typescript@5.9.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.9.3):rkrN1q21SxLWTf+VycNAkuMIJ6+fX1fKMfYYLvcugh0=:",
162
+ "@typescript-eslint/project-service@8.56.1(typescript@5.8.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.8.3):L+l5gLoQs5jJA99jom0A+h+VN2ISYACSekXHA1c1EwI=:",
163
+ "@typescript-eslint/project-service@8.56.1(typescript@5.9.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.9.3):GSD5sT6y3sR1zlsIgMPHy0OlPy4VfklleV3legIGWOs=:",
164
164
  "@typescript-eslint/project-service@8.59.3(typescript@5.9.3)": "@typescript-eslint/project-service@8.59.3(typescript@5.9.3):TdtQIDvh8U+Zg9ZhH+lSb++qqy5nbqa8kGNXmm0SjTs=:",
165
165
  "@typescript-eslint/scope-manager@8.56.1": "@typescript-eslint/scope-manager@8.56.1:oakiB4Lxz5IzduhJyobePnldPnbj+7aVEx2xiDKHndY=:",
166
166
  "@typescript-eslint/scope-manager@8.59.3": "@typescript-eslint/scope-manager@8.59.3:Ts9EflddW/+1TZMWGiBwaa+te9EFZTwTiltllXqs2fk=:",
@@ -188,9 +188,10 @@
188
188
  "acorn@8.16.0": "acorn@8.16.0:jUfpbMqUSWQXeMk9lBKufnFEiAXwmYW9Gyao55/YJG0=:",
189
189
  "agent-base@6.0.2": "agent-base@6.0.2:s+vm2vdDiTWD5EEK8YZUuCJ8nNJVPz+o/sVHEzuEw90=:",
190
190
  "ajv-draft-04@1.0.0(ajv@8.18.0)": "ajv-draft-04@1.0.0(ajv@8.18.0):JG8wTlojY/flM3PwHQclVQAYfj7Apf56biGgSdOawQA=:",
191
- "ajv-formats@3.0.1": "ajv-formats@3.0.1:UsGmpDGZlVReLuxRucUPL4JVD/HgxRGxNHwFFDT4HgQ=:",
191
+ "ajv-formats@3.0.1": "ajv-formats@3.0.1:7+hwYT+T7Wmw6jFzMzBm5dGWCyFLue4kddTc+2OQECA=:",
192
192
  "ajv@6.15.0": "ajv@6.15.0:SD87QJjJxWrlD9SUV0MTNqxBwRwf0xRmGzKqFBfAZSg=:",
193
193
  "ajv@8.18.0": "ajv@8.18.0:fTpbnLje6H+gfMLuSRWwe2Qp/VZ11RZHypBNhBPLmX8=:",
194
+ "ajv@8.20.0": "ajv@8.20.0:/ablYS+O64orF8yVeWOKxUDKBphSTMP9xnFhKylMYb0=:",
194
195
  "ansi-escapes@4.3.2": "ansi-escapes@4.3.2:krrUMjeesFpE6MS4Ii5hJdNFd3JYXKgtoieUIuY2ico=:",
195
196
  "ansi-regex@5.0.1": "ansi-regex@5.0.1:cbFbJn342lSe4Qm0qQ4VieLS/1iZGV2bhNms0khI14g=:",
196
197
  "ansi-styles@4.3.0": "ansi-styles@4.3.0:ZWSFBwfXYCdLBmX2ZXoVqBWX7sfMR5ZmhLs9Hyh39XY=:",
@@ -434,7 +435,7 @@
434
435
  "jest-changed-files@29.7.0": "jest-changed-files@29.7.0:oQS4ZWmXYqUwlExhMtgIYgDrwHDfmSOPex9x9R1BwUQ=:",
435
436
  "jest-circus@29.7.0": "jest-circus@29.7.0:yKDzkjQNELGCvKM8K1D/BYsyoDeetnFypU+2dKjWLrw=:",
436
437
  "jest-cli@29.7.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "jest-cli@29.7.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):sid6fyxWeD2LmzsKeuE9ulLUfPuKWIe3mrX89qQvdUg=:",
437
- "jest-config@29.5.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "jest-config@29.5.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):bdseYaXTdKR2bnqvvkKVkXc6oiy1i5XV15pv2y90AZI=:",
438
+ "jest-config@29.5.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "jest-config@29.5.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):lS+QCqueeY8mS0Dqn36KKAbEXQEsDuU+i6KMbrKL/GQ=:",
438
439
  "jest-config@29.7.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))": "jest-config@29.7.0(@types/node@20.19.41)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3)):UT4Gi5l03YYG8sqOkmsIqMrvyBccuYh7Lb46SznLdO4=:",
439
440
  "jest-diff@29.7.0": "jest-diff@29.7.0:Ul5FBhhA/MnkZjU6Dat9uRuf6qcBfKMXWTGRugGLmDY=:",
440
441
  "jest-docblock@29.7.0": "jest-docblock@29.7.0:pvQX9Pr6W46Wv/xaMCwWM5f6zyR3WoTJC/YHcZu48HU=:",
@@ -456,7 +457,7 @@
456
457
  "jest-resolve@29.7.0": "jest-resolve@29.7.0:hvpSASO6uKsWu0SgUVZVsNF5S0LSrMpEb1G6FwvShKo=:",
457
458
  "jest-runner@29.7.0": "jest-runner@29.7.0:5+B6nV1nN59/Eg+IsyyAqFFiKLiMsiUc88cR+p1HE3U=:",
458
459
  "jest-runtime@29.7.0": "jest-runtime@29.7.0:nRTNmq97N5lDhQkiTdeeRwvDOtYleSbv0G0VPVt3q2Q=:",
459
- "jest-snapshot@29.5.0": "jest-snapshot@29.5.0:zd7GXLUt/VoNTVpYF5W2mQWcnrkmG1j1FHLm/4cjoHo=:",
460
+ "jest-snapshot@29.5.0": "jest-snapshot@29.5.0:QntNipgva8RvAs1Nhm45LPl5b2PU7nNaTd2XwI6Xwas=:",
460
461
  "jest-snapshot@29.7.0": "jest-snapshot@29.7.0:kggrREcar663ZeUts8W+NgpOyg8GFr1lEOh1Lj1SiUI=:",
461
462
  "jest-util@29.7.0": "jest-util@29.7.0:gHlcHPbEBD1XLvUIxS8pkftzVgiU9ELvAxf4UXScHRc=:",
462
463
  "jest-validate@29.7.0": "jest-validate@29.7.0:X0BFNNuaTkbRX14EvARv9uObBFs94o3bDjvhgzQqER4=:",
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // Copyright (c) 2026 Erik Fortune
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in all
11
+ // copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ // SOFTWARE.
20
+ export { NodeArgon2Provider, CryptoUtils } from './packlets/argon2';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nexport { NodeArgon2Provider, CryptoUtils } from './packlets/argon2';\n"]}
@@ -0,0 +1,24 @@
1
+ // Copyright (c) 2026 Erik Fortune
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in all
11
+ // copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ // SOFTWARE.
20
+ export { NodeArgon2Provider } from './nodeArgon2Provider';
21
+ // Re-export CryptoUtils namespace from ts-extras for consumer convenience
22
+ // (provides IArgon2idProvider, IArgon2idParams, ARGON2ID_OWASP_MIN, ARGON2ID_PASSPHRASE).
23
+ export { CryptoUtils } from '@fgv/ts-extras';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/argon2/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,0EAA0E;AAC1E,0FAA0F;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nexport { NodeArgon2Provider } from './nodeArgon2Provider';\n\n// Re-export CryptoUtils namespace from ts-extras for consumer convenience\n// (provides IArgon2idProvider, IArgon2idParams, ARGON2ID_OWASP_MIN, ARGON2ID_PASSPHRASE).\nexport { CryptoUtils } from '@fgv/ts-extras';\n"]}
@@ -0,0 +1,80 @@
1
+ // Copyright (c) 2026 Erik Fortune
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in all
11
+ // copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ // SOFTWARE.
20
+ import * as argon2 from 'argon2';
21
+ import { captureAsyncResult, fail, succeed } from '@fgv/ts-utils';
22
+ /**
23
+ * Node.js implementation of {@link @fgv/ts-extras#IArgon2idProvider} backed by the
24
+ * `argon2` (kelektiv) native binding.
25
+ * @public
26
+ */
27
+ export class NodeArgon2Provider {
28
+ constructor() { }
29
+ /**
30
+ * Creates a new {@link NodeArgon2Provider} instance.
31
+ * @returns Success with a new provider instance.
32
+ * @public
33
+ */
34
+ static create() {
35
+ return succeed(new NodeArgon2Provider());
36
+ }
37
+ /**
38
+ * Derives a key using Argon2id.
39
+ *
40
+ * @param password - The password or passphrase (string or raw bytes).
41
+ * @param salt - The salt (must be at least 8 bytes; 16+ bytes recommended).
42
+ * @param params - Argon2id parameters. All values are validated before derivation.
43
+ * @returns Success with the derived key bytes, or Failure with a descriptive message.
44
+ * @public
45
+ */
46
+ async argon2id(password, salt, params) {
47
+ const error = NodeArgon2Provider._validateParams(params);
48
+ if (error !== undefined) {
49
+ return fail(error);
50
+ }
51
+ return captureAsyncResult(async () => {
52
+ const result = await argon2.hash(password instanceof Uint8Array ? Buffer.from(password) : password, {
53
+ type: argon2.argon2id,
54
+ salt: Buffer.from(salt),
55
+ memoryCost: params.memoryKiB,
56
+ timeCost: params.iterations,
57
+ parallelism: params.parallelism,
58
+ hashLength: params.outputBytes,
59
+ raw: true
60
+ });
61
+ return Uint8Array.from(result);
62
+ });
63
+ }
64
+ static _validateParams(params) {
65
+ if (params.memoryKiB < 8) {
66
+ return `argon2id: memoryKiB must be >= 8, got ${params.memoryKiB}`;
67
+ }
68
+ if (params.iterations < 1) {
69
+ return `argon2id: iterations must be >= 1, got ${params.iterations}`;
70
+ }
71
+ if (params.parallelism < 1 || params.parallelism > 255) {
72
+ return `argon2id: parallelism must be 1..255, got ${params.parallelism}`;
73
+ }
74
+ if (params.outputBytes < 4) {
75
+ return `argon2id: outputBytes must be >= 4, got ${params.outputBytes}`;
76
+ }
77
+ return undefined;
78
+ }
79
+ }
80
+ //# sourceMappingURL=nodeArgon2Provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeArgon2Provider.js","sourceRoot":"","sources":["../../../src/packlets/argon2/nodeArgon2Provider.ts"],"names":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;gBAC/B,UAAU,EAAE,MAAM,CAAC,WAAW;gBAC9B,GAAG,EAAE,IAAI;aACV,CAAC,CAAC;YACH,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,eAAe,CAAC,MAAmC;QAChE,IAAI,MAAM,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;YACzB,OAAO,yCAAyC,MAAM,CAAC,SAAS,EAAE,CAAC;QACrE,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,0CAA0C,MAAM,CAAC,UAAU,EAAE,CAAC;QACvE,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,GAAG,CAAC,IAAI,MAAM,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC;YACvD,OAAO,6CAA6C,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3E,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,2CAA2C,MAAM,CAAC,WAAW,EAAE,CAAC;QACzE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport * as argon2 from 'argon2';\nimport { Result, captureAsyncResult, fail, succeed } from '@fgv/ts-utils';\nimport { CryptoUtils } from '@fgv/ts-extras';\n\n/**\n * Node.js implementation of {@link @fgv/ts-extras#IArgon2idProvider} backed by the\n * `argon2` (kelektiv) native binding.\n * @public\n */\nexport class NodeArgon2Provider implements CryptoUtils.IArgon2idProvider {\n private constructor() {}\n\n /**\n * Creates a new {@link NodeArgon2Provider} instance.\n * @returns Success with a new provider instance.\n * @public\n */\n public static create(): Result<NodeArgon2Provider> {\n return succeed(new NodeArgon2Provider());\n }\n\n /**\n * Derives a key using Argon2id.\n *\n * @param password - The password or passphrase (string or raw bytes).\n * @param salt - The salt (must be at least 8 bytes; 16+ bytes recommended).\n * @param params - Argon2id parameters. All values are validated before derivation.\n * @returns Success with the derived key bytes, or Failure with a descriptive message.\n * @public\n */\n public async argon2id(\n password: Uint8Array | string,\n salt: Uint8Array,\n params: CryptoUtils.IArgon2idParams\n ): Promise<Result<Uint8Array>> {\n const error = NodeArgon2Provider._validateParams(params);\n if (error !== undefined) {\n return fail(error);\n }\n\n return captureAsyncResult(async () => {\n const result = await argon2.hash(password instanceof Uint8Array ? Buffer.from(password) : password, {\n type: argon2.argon2id,\n salt: Buffer.from(salt),\n memoryCost: params.memoryKiB,\n timeCost: params.iterations,\n parallelism: params.parallelism,\n hashLength: params.outputBytes,\n raw: true\n });\n return Uint8Array.from(result);\n });\n }\n\n private static _validateParams(params: CryptoUtils.IArgon2idParams): string | undefined {\n if (params.memoryKiB < 8) {\n return `argon2id: memoryKiB must be >= 8, got ${params.memoryKiB}`;\n }\n if (params.iterations < 1) {\n return `argon2id: iterations must be >= 1, got ${params.iterations}`;\n }\n if (params.parallelism < 1 || params.parallelism > 255) {\n return `argon2id: parallelism must be 1..255, got ${params.parallelism}`;\n }\n if (params.outputBytes < 4) {\n return `argon2id: outputBytes must be >= 4, got ${params.outputBytes}`;\n }\n return undefined;\n }\n}\n"]}
@@ -0,0 +1,96 @@
1
+ // Copyright (c) 2026 Erik Fortune
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in all
11
+ // copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ // SOFTWARE.
20
+ import '@fgv/ts-utils-jest';
21
+ import { NodeArgon2Provider } from '../../../packlets/argon2';
22
+ import { BrowserArgon2Provider } from '@fgv/ts-web-extras-argon2';
23
+ // RFC 9106 §B.3 parameter set (no secret/AD — our IArgon2idParams interface does not expose
24
+ // those optional Argon2 fields). Both implementations must agree on this exact output.
25
+ const RFC_PARAMS = {
26
+ memoryKiB: 32,
27
+ iterations: 3,
28
+ parallelism: 4,
29
+ outputBytes: 32
30
+ };
31
+ const RFC_PASSWORD = new Uint8Array(32).fill(0x01);
32
+ const RFC_SALT = new Uint8Array(16).fill(0x02);
33
+ // Verified independently against both argon2 (kelektiv) and hash-wasm.
34
+ const RFC_EXPECTED_HEX = '03aab965c12001c9d7d0d2de33192c0494b684bb148196d73c1df1acaf6d0c2e';
35
+ const SWEEP = [
36
+ {
37
+ label: 'RFC §B.3 base case',
38
+ password: RFC_PASSWORD,
39
+ salt: RFC_SALT,
40
+ params: RFC_PARAMS
41
+ },
42
+ {
43
+ label: 'string password',
44
+ password: 'correct horse battery staple',
45
+ salt: RFC_SALT,
46
+ params: RFC_PARAMS
47
+ },
48
+ {
49
+ label: 'higher memoryKiB',
50
+ password: RFC_PASSWORD,
51
+ salt: RFC_SALT,
52
+ params: Object.assign(Object.assign({}, RFC_PARAMS), { memoryKiB: 64 })
53
+ },
54
+ {
55
+ label: 'more iterations',
56
+ password: RFC_PASSWORD,
57
+ salt: RFC_SALT,
58
+ params: Object.assign(Object.assign({}, RFC_PARAMS), { iterations: 5 })
59
+ },
60
+ {
61
+ label: 'parallelism=1',
62
+ password: RFC_PASSWORD,
63
+ salt: RFC_SALT,
64
+ params: Object.assign(Object.assign({}, RFC_PARAMS), { parallelism: 1 })
65
+ },
66
+ {
67
+ label: 'longer output (64 bytes)',
68
+ password: RFC_PASSWORD,
69
+ salt: RFC_SALT,
70
+ params: Object.assign(Object.assign({}, RFC_PARAMS), { outputBytes: 64 })
71
+ },
72
+ {
73
+ label: 'different salt',
74
+ password: RFC_PASSWORD,
75
+ salt: new Uint8Array(16).fill(0x07),
76
+ params: RFC_PARAMS
77
+ }
78
+ ];
79
+ describe('cross-runtime equivalence: NodeArgon2Provider vs BrowserArgon2Provider', () => {
80
+ let node;
81
+ let browser;
82
+ beforeEach(() => {
83
+ node = NodeArgon2Provider.create().orThrow();
84
+ browser = BrowserArgon2Provider.create().orThrow();
85
+ });
86
+ test('RFC §B.3 parameter set matches known-good hex output', async () => {
87
+ const nodeBytes = (await node.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();
88
+ expect(Buffer.from(nodeBytes).toString('hex')).toBe(RFC_EXPECTED_HEX);
89
+ });
90
+ test.each(SWEEP)('$label: outputs are byte-identical', async ({ password, salt, params }) => {
91
+ const nodeBytes = (await node.argon2id(password, salt, params)).orThrow();
92
+ const browserBytes = (await browser.argon2id(password, salt, params)).orThrow();
93
+ expect(nodeBytes).toEqual(browserBytes);
94
+ });
95
+ });
96
+ //# sourceMappingURL=crossRuntime.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crossRuntime.test.js","sourceRoot":"","sources":["../../../../src/test/unit/argon2/crossRuntime.test.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,4FAA4F;AAC5F,uFAAuF;AACvF,MAAM,UAAU,GAAgC;IAC9C,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,EAAE;CAChB,CAAC;AACF,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE/C,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,kEAAkE,CAAC;AAU5F,MAAM,KAAK,GAA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ACrD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACtF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,oCAAoC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1F,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC1E,MAAM,YAAY,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAChF,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport '@fgv/ts-utils-jest';\nimport { NodeArgon2Provider } from '../../../packlets/argon2';\nimport { BrowserArgon2Provider } from '@fgv/ts-web-extras-argon2';\nimport { CryptoUtils } from '@fgv/ts-extras';\n\n// RFC 9106 §B.3 parameter set (no secret/AD — our IArgon2idParams interface does not expose\n// those optional Argon2 fields). Both implementations must agree on this exact output.\nconst RFC_PARAMS: CryptoUtils.IArgon2idParams = {\n memoryKiB: 32,\n iterations: 3,\n parallelism: 4,\n outputBytes: 32\n};\nconst RFC_PASSWORD = new Uint8Array(32).fill(0x01);\nconst RFC_SALT = new Uint8Array(16).fill(0x02);\n\n// Verified independently against both argon2 (kelektiv) and hash-wasm.\nconst RFC_EXPECTED_HEX = '03aab965c12001c9d7d0d2de33192c0494b684bb148196d73c1df1acaf6d0c2e';\n\n// Parameter sweep — covers variation in each dimension independently.\ninterface ITestCase {\n label: string;\n password: Uint8Array | string;\n salt: Uint8Array;\n params: CryptoUtils.IArgon2idParams;\n}\n\nconst SWEEP: ITestCase[] = [\n {\n label: 'RFC §B.3 base case',\n password: RFC_PASSWORD,\n salt: RFC_SALT,\n params: RFC_PARAMS\n },\n {\n label: 'string password',\n password: 'correct horse battery staple',\n salt: RFC_SALT,\n params: RFC_PARAMS\n },\n {\n label: 'higher memoryKiB',\n password: RFC_PASSWORD,\n salt: RFC_SALT,\n params: { ...RFC_PARAMS, memoryKiB: 64 }\n },\n {\n label: 'more iterations',\n password: RFC_PASSWORD,\n salt: RFC_SALT,\n params: { ...RFC_PARAMS, iterations: 5 }\n },\n {\n label: 'parallelism=1',\n password: RFC_PASSWORD,\n salt: RFC_SALT,\n params: { ...RFC_PARAMS, parallelism: 1 }\n },\n {\n label: 'longer output (64 bytes)',\n password: RFC_PASSWORD,\n salt: RFC_SALT,\n params: { ...RFC_PARAMS, outputBytes: 64 }\n },\n {\n label: 'different salt',\n password: RFC_PASSWORD,\n salt: new Uint8Array(16).fill(0x07),\n params: RFC_PARAMS\n }\n];\n\ndescribe('cross-runtime equivalence: NodeArgon2Provider vs BrowserArgon2Provider', () => {\n let node: NodeArgon2Provider;\n let browser: BrowserArgon2Provider;\n\n beforeEach(() => {\n node = NodeArgon2Provider.create().orThrow();\n browser = BrowserArgon2Provider.create().orThrow();\n });\n\n test('RFC §B.3 parameter set matches known-good hex output', async () => {\n const nodeBytes = (await node.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();\n expect(Buffer.from(nodeBytes).toString('hex')).toBe(RFC_EXPECTED_HEX);\n });\n\n test.each(SWEEP)('$label: outputs are byte-identical', async ({ password, salt, params }) => {\n const nodeBytes = (await node.argon2id(password, salt, params)).orThrow();\n const browserBytes = (await browser.argon2id(password, salt, params)).orThrow();\n expect(nodeBytes).toEqual(browserBytes);\n });\n});\n"]}
@@ -0,0 +1,100 @@
1
+ // Copyright (c) 2026 Erik Fortune
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in all
11
+ // copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ // SOFTWARE.
20
+ import '@fgv/ts-utils-jest';
21
+ import { NodeArgon2Provider } from '../../../packlets/argon2';
22
+ // RFC 9106 §B.3 parameter set (no secret/AD — our interface does not expose those fields).
23
+ // t=3, m=32, p=4, tag=32. Used for determinism and cross-runtime agreement.
24
+ const RFC_PARAMS = {
25
+ memoryKiB: 32,
26
+ iterations: 3,
27
+ parallelism: 4,
28
+ outputBytes: 32
29
+ };
30
+ const RFC_PASSWORD = new Uint8Array(32).fill(0x01);
31
+ const RFC_SALT = new Uint8Array(16).fill(0x02);
32
+ describe('NodeArgon2Provider', () => {
33
+ let provider;
34
+ beforeEach(() => {
35
+ provider = NodeArgon2Provider.create().orThrow();
36
+ });
37
+ describe('create()', () => {
38
+ test('returns a provider instance', () => {
39
+ expect(NodeArgon2Provider.create()).toSucceedAndSatisfy((p) => {
40
+ expect(p).toBeInstanceOf(NodeArgon2Provider);
41
+ });
42
+ });
43
+ });
44
+ describe('argon2id()', () => {
45
+ test('derives a key with Uint8Array password', async () => {
46
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).toSucceedAndSatisfy((bytes) => {
47
+ expect(bytes).toBeInstanceOf(Uint8Array);
48
+ expect(bytes.length).toBe(RFC_PARAMS.outputBytes);
49
+ });
50
+ });
51
+ test('derives a key with string password', async () => {
52
+ expect(await provider.argon2id('password', RFC_SALT, RFC_PARAMS)).toSucceedAndSatisfy((bytes) => {
53
+ expect(bytes).toBeInstanceOf(Uint8Array);
54
+ expect(bytes.length).toBe(RFC_PARAMS.outputBytes);
55
+ });
56
+ });
57
+ test('is deterministic — same inputs produce identical bytes', async () => {
58
+ const r1 = (await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();
59
+ const r2 = (await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();
60
+ expect(r1).toEqual(r2);
61
+ });
62
+ test('different passwords produce different bytes', async () => {
63
+ const a = (await provider.argon2id(new Uint8Array(32).fill(0x01), RFC_SALT, RFC_PARAMS)).orThrow();
64
+ const b = (await provider.argon2id(new Uint8Array(32).fill(0x02), RFC_SALT, RFC_PARAMS)).orThrow();
65
+ expect(a).not.toEqual(b);
66
+ });
67
+ test('different salts produce different bytes', async () => {
68
+ const a = (await provider.argon2id(RFC_PASSWORD, new Uint8Array(16).fill(0x02), RFC_PARAMS)).orThrow();
69
+ const b = (await provider.argon2id(RFC_PASSWORD, new Uint8Array(16).fill(0x03), RFC_PARAMS)).orThrow();
70
+ expect(a).not.toEqual(b);
71
+ });
72
+ test('respects outputBytes', async () => {
73
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { outputBytes: 64 }))).toSucceedAndSatisfy((bytes) => {
74
+ expect(bytes.length).toBe(64);
75
+ });
76
+ });
77
+ test('returns failure when underlying library rejects (salt too short)', async () => {
78
+ const tinySalt = new Uint8Array(1).fill(0x02); // argon2 requires >= 8 bytes
79
+ expect(await provider.argon2id(RFC_PASSWORD, tinySalt, RFC_PARAMS)).toFail();
80
+ });
81
+ });
82
+ describe('parameter validation', () => {
83
+ test('fails when memoryKiB < 8', async () => {
84
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { memoryKiB: 7 }))).toFailWith(/memoryKiB must be >= 8/i);
85
+ });
86
+ test('fails when iterations < 1', async () => {
87
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { iterations: 0 }))).toFailWith(/iterations must be >= 1/i);
88
+ });
89
+ test('fails when parallelism < 1', async () => {
90
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { parallelism: 0 }))).toFailWith(/parallelism must be 1\.\.255/i);
91
+ });
92
+ test('fails when parallelism > 255', async () => {
93
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { parallelism: 256 }))).toFailWith(/parallelism must be 1\.\.255/i);
94
+ });
95
+ test('fails when outputBytes < 4', async () => {
96
+ expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, Object.assign(Object.assign({}, RFC_PARAMS), { outputBytes: 3 }))).toFailWith(/outputBytes must be >= 4/i);
97
+ });
98
+ });
99
+ });
100
+ //# sourceMappingURL=nodeArgon2Provider.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeArgon2Provider.test.js","sourceRoot":"","sources":["../../../../src/test/unit/argon2/nodeArgon2Provider.test.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,2FAA2F;AAC3F,4EAA4E;AAC5E,MAAM,UAAU,GAAgC;IAC9C,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,EAAE;CAChB,CAAC;AACF,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CA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software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport '@fgv/ts-utils-jest';\nimport { NodeArgon2Provider } from '../../../packlets/argon2';\nimport { CryptoUtils } from '@fgv/ts-extras';\n\n// RFC 9106 §B.3 parameter set (no secret/AD — our interface does not expose those fields).\n// t=3, m=32, p=4, tag=32. Used for determinism and cross-runtime agreement.\nconst RFC_PARAMS: CryptoUtils.IArgon2idParams = {\n memoryKiB: 32,\n iterations: 3,\n parallelism: 4,\n outputBytes: 32\n};\nconst RFC_PASSWORD = new Uint8Array(32).fill(0x01);\nconst RFC_SALT = new Uint8Array(16).fill(0x02);\n\ndescribe('NodeArgon2Provider', () => {\n let provider: NodeArgon2Provider;\n\n beforeEach(() => {\n provider = NodeArgon2Provider.create().orThrow();\n });\n\n describe('create()', () => {\n test('returns a provider instance', () => {\n expect(NodeArgon2Provider.create()).toSucceedAndSatisfy((p) => {\n expect(p).toBeInstanceOf(NodeArgon2Provider);\n });\n });\n });\n\n describe('argon2id()', () => {\n test('derives a key with Uint8Array password', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).toSucceedAndSatisfy((bytes) => {\n expect(bytes).toBeInstanceOf(Uint8Array);\n expect(bytes.length).toBe(RFC_PARAMS.outputBytes);\n });\n });\n\n test('derives a key with string password', async () => {\n expect(await provider.argon2id('password', RFC_SALT, RFC_PARAMS)).toSucceedAndSatisfy((bytes) => {\n expect(bytes).toBeInstanceOf(Uint8Array);\n expect(bytes.length).toBe(RFC_PARAMS.outputBytes);\n });\n });\n\n test('is deterministic — same inputs produce identical bytes', async () => {\n const r1 = (await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();\n const r2 = (await provider.argon2id(RFC_PASSWORD, RFC_SALT, RFC_PARAMS)).orThrow();\n expect(r1).toEqual(r2);\n });\n\n test('different passwords produce different bytes', async () => {\n const a = (await provider.argon2id(new Uint8Array(32).fill(0x01), RFC_SALT, RFC_PARAMS)).orThrow();\n const b = (await provider.argon2id(new Uint8Array(32).fill(0x02), RFC_SALT, RFC_PARAMS)).orThrow();\n expect(a).not.toEqual(b);\n });\n\n test('different salts produce different bytes', async () => {\n const a = (await provider.argon2id(RFC_PASSWORD, new Uint8Array(16).fill(0x02), RFC_PARAMS)).orThrow();\n const b = (await provider.argon2id(RFC_PASSWORD, new Uint8Array(16).fill(0x03), RFC_PARAMS)).orThrow();\n expect(a).not.toEqual(b);\n });\n\n test('respects outputBytes', async () => {\n expect(\n await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, outputBytes: 64 })\n ).toSucceedAndSatisfy((bytes) => {\n expect(bytes.length).toBe(64);\n });\n });\n\n test('returns failure when underlying library rejects (salt too short)', async () => {\n const tinySalt = new Uint8Array(1).fill(0x02); // argon2 requires >= 8 bytes\n expect(await provider.argon2id(RFC_PASSWORD, tinySalt, RFC_PARAMS)).toFail();\n });\n });\n\n describe('parameter validation', () => {\n test('fails when memoryKiB < 8', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, memoryKiB: 7 })).toFailWith(\n /memoryKiB must be >= 8/i\n );\n });\n\n test('fails when iterations < 1', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, iterations: 0 })).toFailWith(\n /iterations must be >= 1/i\n );\n });\n\n test('fails when parallelism < 1', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, parallelism: 0 })).toFailWith(\n /parallelism must be 1\\.\\.255/i\n );\n });\n\n test('fails when parallelism > 255', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, parallelism: 256 })).toFailWith(\n /parallelism must be 1\\.\\.255/i\n );\n });\n\n test('fails when outputBytes < 4', async () => {\n expect(await provider.argon2id(RFC_PASSWORD, RFC_SALT, { ...RFC_PARAMS, outputBytes: 3 })).toFailWith(\n /outputBytes must be >= 4/i\n );\n });\n });\n});\n"]}
@@ -0,0 +1,32 @@
1
+ import { CryptoUtils } from '@fgv/ts-extras';
2
+ import { Result } from '@fgv/ts-utils';
3
+
4
+ export { CryptoUtils }
5
+
6
+ /**
7
+ * Node.js implementation of {@link @fgv/ts-extras#IArgon2idProvider} backed by the
8
+ * `argon2` (kelektiv) native binding.
9
+ * @public
10
+ */
11
+ export declare class NodeArgon2Provider implements CryptoUtils.IArgon2idProvider {
12
+ private constructor();
13
+ /**
14
+ * Creates a new {@link NodeArgon2Provider} instance.
15
+ * @returns Success with a new provider instance.
16
+ * @public
17
+ */
18
+ static create(): Result<NodeArgon2Provider>;
19
+ /**
20
+ * Derives a key using Argon2id.
21
+ *
22
+ * @param password - The password or passphrase (string or raw bytes).
23
+ * @param salt - The salt (must be at least 8 bytes; 16+ bytes recommended).
24
+ * @param params - Argon2id parameters. All values are validated before derivation.
25
+ * @returns Success with the derived key bytes, or Failure with a descriptive message.
26
+ * @public
27
+ */
28
+ argon2id(password: Uint8Array | string, salt: Uint8Array, params: CryptoUtils.IArgon2idParams): Promise<Result<Uint8Array>>;
29
+ private static _validateParams;
30
+ }
31
+
32
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.58.7"
9
+ }
10
+ ]
11
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { NodeArgon2Provider, CryptoUtils } from './packlets/argon2';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // Copyright (c) 2026 Erik Fortune
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal
6
+ // in the Software without restriction, including without limitation the rights
7
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ // copies of the Software, and to permit persons to whom the Software is
9
+ // furnished to do so, subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in all
12
+ // copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ // SOFTWARE.
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.CryptoUtils = exports.NodeArgon2Provider = void 0;
23
+ var argon2_1 = require("./packlets/argon2");
24
+ Object.defineProperty(exports, "NodeArgon2Provider", { enumerable: true, get: function () { return argon2_1.NodeArgon2Provider; } });
25
+ Object.defineProperty(exports, "CryptoUtils", { enumerable: true, get: function () { return argon2_1.CryptoUtils; } });
26
+ //# sourceMappingURL=index.js.map