@fgv/ts-extras-webauthn 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.
- package/.rush/temp/c06e70432add5dcc09de9e5fad9e50ea43f2c62d.tar.log +30 -0
- package/.rush/temp/chunked-rush-logs/ts-extras-webauthn.build.chunks.jsonl +9 -0
- package/.rush/temp/operation/build/all.log +9 -0
- package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
- package/.rush/temp/operation/build/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +8 -7
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/test/unit/webauthn.test.js +115 -0
- package/dist/test/unit/webauthn.test.js.map +1 -0
- package/dist/ts-extras-webauthn.d.ts +72 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +49 -0
- package/lib/index.js.map +1 -0
- package/lib/test/unit/webauthn.test.d.ts +2 -0
- package/lib/test/unit/webauthn.test.d.ts.map +1 -0
- package/lib/test/unit/webauthn.test.js +150 -0
- package/lib/test/unit/webauthn.test.js.map +1 -0
- package/package.json +18 -18
- package/rush-logs/ts-extras-webauthn.build.cache.log +3 -0
- package/rush-logs/ts-extras-webauthn.build.log +9 -0
- package/temp/build/lint/_eslint-5eVG3S6w.json +14 -0
- package/temp/build/typescript/ts_8nwakTlr.json +1 -0
- package/temp/ts-extras-webauthn.api.json +470 -0
- package/temp/ts-extras-webauthn.api.md +56 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Start time: Tue May 19 2026 18:39:34 GMT+0000 (Coordinated Universal Time)
|
|
2
|
+
Invoking "/usr/bin/tar -c -f /home/runner/work/fgv/fgv/common/temp/build-cache/c06e70432add5dcc09de9e5fad9e50ea43f2c62d-681a2662185d106d.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/test/unit/webauthn.test.js
|
|
11
|
+
dist/test/unit/webauthn.test.js.map
|
|
12
|
+
dist/ts-extras-webauthn.d.ts
|
|
13
|
+
dist/tsdoc-metadata.json
|
|
14
|
+
lib/index.d.ts
|
|
15
|
+
lib/index.d.ts.map
|
|
16
|
+
lib/index.js
|
|
17
|
+
lib/index.js.map
|
|
18
|
+
lib/test/unit/webauthn.test.d.ts
|
|
19
|
+
lib/test/unit/webauthn.test.d.ts.map
|
|
20
|
+
lib/test/unit/webauthn.test.js
|
|
21
|
+
lib/test/unit/webauthn.test.js.map
|
|
22
|
+
temp/build/lint/_eslint-5eVG3S6w.json
|
|
23
|
+
temp/build/typescript/ts_8nwakTlr.json
|
|
24
|
+
temp/ts-extras-webauthn.api.json
|
|
25
|
+
temp/ts-extras-webauthn.api.md
|
|
26
|
+
======== END PROCESS INPUT =======
|
|
27
|
+
======= BEGIN PROCESS OUTPUT =======
|
|
28
|
+
======== END PROCESS OUTPUT ========
|
|
29
|
+
|
|
30
|
+
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 (18.628s) ---- \n"}
|
|
9
|
+
{"kind":"O","text":"-------------------- Finished (18.631s) --------------------\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 (18.628s) ----
|
|
9
|
+
-------------------- Finished (18.631s) --------------------
|
|
@@ -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 (18.628s) ---- \n"}
|
|
9
|
+
{"kind":"O","text":"-------------------- Finished (18.631s) --------------------\n"}
|
|
@@ -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)):
|
|
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:
|
|
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=:",
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
"@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=:",
|
|
172
172
|
"@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=:",
|
|
173
173
|
"@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=:",
|
|
174
|
-
"@typescript-eslint/project-service@8.56.1(typescript@5.8.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.8.3):
|
|
175
|
-
"@typescript-eslint/project-service@8.56.1(typescript@5.9.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.9.3):
|
|
174
|
+
"@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=:",
|
|
175
|
+
"@typescript-eslint/project-service@8.56.1(typescript@5.9.3)": "@typescript-eslint/project-service@8.56.1(typescript@5.9.3):GSD5sT6y3sR1zlsIgMPHy0OlPy4VfklleV3legIGWOs=:",
|
|
176
176
|
"@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=:",
|
|
177
177
|
"@typescript-eslint/scope-manager@8.56.1": "@typescript-eslint/scope-manager@8.56.1:oakiB4Lxz5IzduhJyobePnldPnbj+7aVEx2xiDKHndY=:",
|
|
178
178
|
"@typescript-eslint/scope-manager@8.59.3": "@typescript-eslint/scope-manager@8.59.3:Ts9EflddW/+1TZMWGiBwaa+te9EFZTwTiltllXqs2fk=:",
|
|
@@ -200,9 +200,10 @@
|
|
|
200
200
|
"acorn@8.16.0": "acorn@8.16.0:jUfpbMqUSWQXeMk9lBKufnFEiAXwmYW9Gyao55/YJG0=:",
|
|
201
201
|
"agent-base@6.0.2": "agent-base@6.0.2:s+vm2vdDiTWD5EEK8YZUuCJ8nNJVPz+o/sVHEzuEw90=:",
|
|
202
202
|
"ajv-draft-04@1.0.0(ajv@8.18.0)": "ajv-draft-04@1.0.0(ajv@8.18.0):JG8wTlojY/flM3PwHQclVQAYfj7Apf56biGgSdOawQA=:",
|
|
203
|
-
"ajv-formats@3.0.1": "ajv-formats@3.0.1:
|
|
203
|
+
"ajv-formats@3.0.1": "ajv-formats@3.0.1:7+hwYT+T7Wmw6jFzMzBm5dGWCyFLue4kddTc+2OQECA=:",
|
|
204
204
|
"ajv@6.15.0": "ajv@6.15.0:SD87QJjJxWrlD9SUV0MTNqxBwRwf0xRmGzKqFBfAZSg=:",
|
|
205
205
|
"ajv@8.18.0": "ajv@8.18.0:fTpbnLje6H+gfMLuSRWwe2Qp/VZ11RZHypBNhBPLmX8=:",
|
|
206
|
+
"ajv@8.20.0": "ajv@8.20.0:/ablYS+O64orF8yVeWOKxUDKBphSTMP9xnFhKylMYb0=:",
|
|
206
207
|
"ansi-escapes@4.3.2": "ansi-escapes@4.3.2:krrUMjeesFpE6MS4Ii5hJdNFd3JYXKgtoieUIuY2ico=:",
|
|
207
208
|
"ansi-regex@5.0.1": "ansi-regex@5.0.1:cbFbJn342lSe4Qm0qQ4VieLS/1iZGV2bhNms0khI14g=:",
|
|
208
209
|
"ansi-styles@4.3.0": "ansi-styles@4.3.0:ZWSFBwfXYCdLBmX2ZXoVqBWX7sfMR5ZmhLs9Hyh39XY=:",
|
|
@@ -442,7 +443,7 @@
|
|
|
442
443
|
"jest-changed-files@29.7.0": "jest-changed-files@29.7.0:oQS4ZWmXYqUwlExhMtgIYgDrwHDfmSOPex9x9R1BwUQ=:",
|
|
443
444
|
"jest-circus@29.7.0": "jest-circus@29.7.0:yKDzkjQNELGCvKM8K1D/BYsyoDeetnFypU+2dKjWLrw=:",
|
|
444
445
|
"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=:",
|
|
445
|
-
"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)):
|
|
446
|
+
"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=:",
|
|
446
447
|
"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=:",
|
|
447
448
|
"jest-diff@29.7.0": "jest-diff@29.7.0:Ul5FBhhA/MnkZjU6Dat9uRuf6qcBfKMXWTGRugGLmDY=:",
|
|
448
449
|
"jest-docblock@29.7.0": "jest-docblock@29.7.0:pvQX9Pr6W46Wv/xaMCwWM5f6zyR3WoTJC/YHcZu48HU=:",
|
|
@@ -464,7 +465,7 @@
|
|
|
464
465
|
"jest-resolve@29.7.0": "jest-resolve@29.7.0:hvpSASO6uKsWu0SgUVZVsNF5S0LSrMpEb1G6FwvShKo=:",
|
|
465
466
|
"jest-runner@29.7.0": "jest-runner@29.7.0:5+B6nV1nN59/Eg+IsyyAqFFiKLiMsiUc88cR+p1HE3U=:",
|
|
466
467
|
"jest-runtime@29.7.0": "jest-runtime@29.7.0:nRTNmq97N5lDhQkiTdeeRwvDOtYleSbv0G0VPVt3q2Q=:",
|
|
467
|
-
"jest-snapshot@29.5.0": "jest-snapshot@29.5.0:
|
|
468
|
+
"jest-snapshot@29.5.0": "jest-snapshot@29.5.0:QntNipgva8RvAs1Nhm45LPl5b2PU7nNaTd2XwI6Xwas=:",
|
|
468
469
|
"jest-snapshot@29.7.0": "jest-snapshot@29.7.0:kggrREcar663ZeUts8W+NgpOyg8GFr1lEOh1Lj1SiUI=:",
|
|
469
470
|
"jest-util@29.7.0": "jest-util@29.7.0:gHlcHPbEBD1XLvUIxS8pkftzVgiU9ELvAxf4UXScHRc=:",
|
|
470
471
|
"jest-validate@29.7.0": "jest-validate@29.7.0:X0BFNNuaTkbRX14EvARv9uObBFs94o3bDjvhgzQqER4=:",
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { generateRegistrationOptions as _generateRegistrationOptions, verifyRegistrationResponse as _verifyRegistrationResponse, generateAuthenticationOptions as _generateAuthenticationOptions, verifyAuthenticationResponse as _verifyAuthenticationResponse } from '@simplewebauthn/server';
|
|
2
|
+
import { captureAsyncResult } from '@fgv/ts-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.
|
|
5
|
+
* Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured
|
|
6
|
+
* as `Failure` with the original message.
|
|
7
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export async function generateRegistrationOptions(options) {
|
|
11
|
+
return captureAsyncResult(() => _generateRegistrationOptions(options));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.
|
|
15
|
+
* Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured
|
|
16
|
+
* as `Failure` with the original message.
|
|
17
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export async function verifyRegistrationResponse(options) {
|
|
21
|
+
return captureAsyncResult(() => _verifyRegistrationResponse(options));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.
|
|
25
|
+
* Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured
|
|
26
|
+
* as `Failure` with the original message.
|
|
27
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export async function generateAuthenticationOptions(options) {
|
|
31
|
+
return captureAsyncResult(() => _generateAuthenticationOptions(options));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.
|
|
35
|
+
* Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured
|
|
36
|
+
* as `Failure` with the original message.
|
|
37
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export async function verifyAuthenticationResponse(options) {
|
|
41
|
+
return captureAsyncResult(() => _verifyAuthenticationResponse(options));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,IAAI,4BAA4B,EAC3D,0BAA0B,IAAI,2BAA2B,EACzD,6BAA6B,IAAI,8BAA8B,EAC/D,4BAA4B,IAAI,6BAA6B,EAC9D,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAE,kBAAkB,EAAe,MAAM,eAAe,CAAC;AAgBhE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAwC;IAExC,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAAuC;IAEvC,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAA0C;IAE1C,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAAyC;IAEzC,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import {\n generateRegistrationOptions as _generateRegistrationOptions,\n verifyRegistrationResponse as _verifyRegistrationResponse,\n generateAuthenticationOptions as _generateAuthenticationOptions,\n verifyAuthenticationResponse as _verifyAuthenticationResponse\n} from '@simplewebauthn/server';\nimport type {\n GenerateRegistrationOptionsOpts,\n PublicKeyCredentialCreationOptionsJSON,\n VerifyRegistrationResponseOpts,\n VerifiedRegistrationResponse,\n GenerateAuthenticationOptionsOpts,\n PublicKeyCredentialRequestOptionsJSON,\n VerifyAuthenticationResponseOpts,\n VerifiedAuthenticationResponse,\n WebAuthnCredential,\n RegistrationResponseJSON,\n AuthenticationResponseJSON\n} from '@simplewebauthn/server';\nimport { captureAsyncResult, type Result } from '@fgv/ts-utils';\n\nexport type {\n GenerateRegistrationOptionsOpts,\n PublicKeyCredentialCreationOptionsJSON,\n VerifyRegistrationResponseOpts,\n VerifiedRegistrationResponse,\n GenerateAuthenticationOptionsOpts,\n PublicKeyCredentialRequestOptionsJSON,\n VerifyAuthenticationResponseOpts,\n VerifiedAuthenticationResponse,\n WebAuthnCredential,\n RegistrationResponseJSON,\n AuthenticationResponseJSON\n};\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.\n * Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function generateRegistrationOptions(\n options: GenerateRegistrationOptionsOpts\n): Promise<Result<PublicKeyCredentialCreationOptionsJSON>> {\n return captureAsyncResult(() => _generateRegistrationOptions(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.\n * Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function verifyRegistrationResponse(\n options: VerifyRegistrationResponseOpts\n): Promise<Result<VerifiedRegistrationResponse>> {\n return captureAsyncResult(() => _verifyRegistrationResponse(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.\n * Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function generateAuthenticationOptions(\n options: GenerateAuthenticationOptionsOpts\n): Promise<Result<PublicKeyCredentialRequestOptionsJSON>> {\n return captureAsyncResult(() => _generateAuthenticationOptions(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.\n * Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function verifyAuthenticationResponse(\n options: VerifyAuthenticationResponseOpts\n): Promise<Result<VerifiedAuthenticationResponse>> {\n return captureAsyncResult(() => _verifyAuthenticationResponse(options));\n}\n"]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
jest.mock('@simplewebauthn/server');
|
|
2
|
+
import '@fgv/ts-utils-jest';
|
|
3
|
+
import * as upstream from '@simplewebauthn/server';
|
|
4
|
+
import { generateAuthenticationOptions, generateRegistrationOptions, verifyAuthenticationResponse, verifyRegistrationResponse } from '../../index';
|
|
5
|
+
describe('generateRegistrationOptions', () => {
|
|
6
|
+
const mockOpts = {
|
|
7
|
+
rpName: 'Test RP',
|
|
8
|
+
rpID: 'test.example.com',
|
|
9
|
+
userName: 'user@test.com'
|
|
10
|
+
};
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.resetAllMocks();
|
|
13
|
+
});
|
|
14
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
15
|
+
const mockResult = { challenge: 'abc123' };
|
|
16
|
+
jest.mocked(upstream.generateRegistrationOptions).mockResolvedValueOnce(mockResult);
|
|
17
|
+
expect(await generateRegistrationOptions(mockOpts)).toSucceedWith(mockResult);
|
|
18
|
+
});
|
|
19
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
20
|
+
jest
|
|
21
|
+
.mocked(upstream.generateRegistrationOptions)
|
|
22
|
+
.mockRejectedValueOnce(new Error('Challenge is not in the correct format'));
|
|
23
|
+
expect(await generateRegistrationOptions(mockOpts)).toFailWith(/challenge is not in the correct format/i);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('verifyRegistrationResponse', () => {
|
|
27
|
+
const mockOpts = {
|
|
28
|
+
response: {
|
|
29
|
+
id: 'cred-id',
|
|
30
|
+
rawId: 'cred-raw-id',
|
|
31
|
+
response: {
|
|
32
|
+
clientDataJSON: 'client-data',
|
|
33
|
+
attestationObject: 'attestation-object'
|
|
34
|
+
},
|
|
35
|
+
clientExtensionResults: {},
|
|
36
|
+
type: 'public-key'
|
|
37
|
+
},
|
|
38
|
+
expectedChallenge: 'challenge123',
|
|
39
|
+
expectedOrigin: 'https://test.example.com',
|
|
40
|
+
expectedRPID: 'test.example.com'
|
|
41
|
+
};
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
jest.resetAllMocks();
|
|
44
|
+
});
|
|
45
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
46
|
+
const mockResult = { verified: true };
|
|
47
|
+
jest.mocked(upstream.verifyRegistrationResponse).mockResolvedValueOnce(mockResult);
|
|
48
|
+
expect(await verifyRegistrationResponse(mockOpts)).toSucceedWith(mockResult);
|
|
49
|
+
});
|
|
50
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
51
|
+
jest
|
|
52
|
+
.mocked(upstream.verifyRegistrationResponse)
|
|
53
|
+
.mockRejectedValueOnce(new Error('The authenticator response contained invalid attestation'));
|
|
54
|
+
expect(await verifyRegistrationResponse(mockOpts)).toFailWith(/invalid attestation/i);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('generateAuthenticationOptions', () => {
|
|
58
|
+
const mockOpts = {
|
|
59
|
+
rpID: 'test.example.com'
|
|
60
|
+
};
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
jest.resetAllMocks();
|
|
63
|
+
});
|
|
64
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
65
|
+
const mockResult = { challenge: 'xyz789' };
|
|
66
|
+
jest.mocked(upstream.generateAuthenticationOptions).mockResolvedValueOnce(mockResult);
|
|
67
|
+
expect(await generateAuthenticationOptions(mockOpts)).toSucceedWith(mockResult);
|
|
68
|
+
});
|
|
69
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
70
|
+
jest
|
|
71
|
+
.mocked(upstream.generateAuthenticationOptions)
|
|
72
|
+
.mockRejectedValueOnce(new Error('Unexpected authentication response type'));
|
|
73
|
+
expect(await generateAuthenticationOptions(mockOpts)).toFailWith(/unexpected authentication response type/i);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('verifyAuthenticationResponse', () => {
|
|
77
|
+
const mockCredential = {
|
|
78
|
+
id: 'cred-id',
|
|
79
|
+
publicKey: new Uint8Array([1, 2, 3]),
|
|
80
|
+
counter: 0,
|
|
81
|
+
transports: ['usb']
|
|
82
|
+
};
|
|
83
|
+
const mockOpts = {
|
|
84
|
+
response: {
|
|
85
|
+
id: 'cred-id',
|
|
86
|
+
rawId: 'cred-raw-id',
|
|
87
|
+
response: {
|
|
88
|
+
clientDataJSON: 'client-data',
|
|
89
|
+
authenticatorData: 'auth-data',
|
|
90
|
+
signature: 'sig'
|
|
91
|
+
},
|
|
92
|
+
clientExtensionResults: {},
|
|
93
|
+
type: 'public-key'
|
|
94
|
+
},
|
|
95
|
+
expectedChallenge: 'challenge123',
|
|
96
|
+
expectedOrigin: 'https://test.example.com',
|
|
97
|
+
expectedRPID: 'test.example.com',
|
|
98
|
+
credential: mockCredential
|
|
99
|
+
};
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
jest.resetAllMocks();
|
|
102
|
+
});
|
|
103
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
104
|
+
const mockResult = { verified: true };
|
|
105
|
+
jest.mocked(upstream.verifyAuthenticationResponse).mockResolvedValueOnce(mockResult);
|
|
106
|
+
expect(await verifyAuthenticationResponse(mockOpts)).toSucceedWith(mockResult);
|
|
107
|
+
});
|
|
108
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
109
|
+
jest
|
|
110
|
+
.mocked(upstream.verifyAuthenticationResponse)
|
|
111
|
+
.mockRejectedValueOnce(new Error('Credential counter value for given response must be larger than 0'));
|
|
112
|
+
expect(await verifyAuthenticationResponse(mockOpts)).toFailWith(/credential counter value/i);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=webauthn.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.test.js","sourceRoot":"","sources":["../../../src/test/unit/webauthn.test.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAEpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAY3B,MAAM,aAAa,CAAC;AAErB,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,QAAQ,GAAoC;QAChD,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,eAAe;KAC1B,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,UAAU,GAAG,EAAE,SAAS,EAAE,QAAQ,EAA4C,CAAC;QACrF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACpF,MAA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,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@simplewebauthn/server');\n\nimport '@fgv/ts-utils-jest';\nimport * as upstream from '@simplewebauthn/server';\nimport {\n generateAuthenticationOptions,\n generateRegistrationOptions,\n verifyAuthenticationResponse,\n verifyRegistrationResponse,\n type AuthenticationResponseJSON,\n type GenerateAuthenticationOptionsOpts,\n type GenerateRegistrationOptionsOpts,\n type PublicKeyCredentialCreationOptionsJSON,\n type PublicKeyCredentialRequestOptionsJSON,\n type RegistrationResponseJSON,\n type VerifiedAuthenticationResponse,\n type VerifiedRegistrationResponse,\n type VerifyAuthenticationResponseOpts,\n type VerifyRegistrationResponseOpts,\n type WebAuthnCredential\n} from '../../index';\n\ndescribe('generateRegistrationOptions', () => {\n const mockOpts: GenerateRegistrationOptionsOpts = {\n rpName: 'Test RP',\n rpID: 'test.example.com',\n userName: 'user@test.com'\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { challenge: 'abc123' } as PublicKeyCredentialCreationOptionsJSON;\n jest.mocked(upstream.generateRegistrationOptions).mockResolvedValueOnce(mockResult);\n expect(await generateRegistrationOptions(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.generateRegistrationOptions)\n .mockRejectedValueOnce(new Error('Challenge is not in the correct format'));\n expect(await generateRegistrationOptions(mockOpts)).toFailWith(/challenge is not in the correct format/i);\n });\n});\n\ndescribe('verifyRegistrationResponse', () => {\n const mockOpts: VerifyRegistrationResponseOpts = {\n response: {\n id: 'cred-id',\n rawId: 'cred-raw-id',\n response: {\n clientDataJSON: 'client-data',\n attestationObject: 'attestation-object'\n },\n clientExtensionResults: {},\n type: 'public-key'\n } as RegistrationResponseJSON,\n expectedChallenge: 'challenge123',\n expectedOrigin: 'https://test.example.com',\n expectedRPID: 'test.example.com'\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { verified: true } as VerifiedRegistrationResponse;\n jest.mocked(upstream.verifyRegistrationResponse).mockResolvedValueOnce(mockResult);\n expect(await verifyRegistrationResponse(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.verifyRegistrationResponse)\n .mockRejectedValueOnce(new Error('The authenticator response contained invalid attestation'));\n expect(await verifyRegistrationResponse(mockOpts)).toFailWith(/invalid attestation/i);\n });\n});\n\ndescribe('generateAuthenticationOptions', () => {\n const mockOpts: GenerateAuthenticationOptionsOpts = {\n rpID: 'test.example.com'\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { challenge: 'xyz789' } as PublicKeyCredentialRequestOptionsJSON;\n jest.mocked(upstream.generateAuthenticationOptions).mockResolvedValueOnce(mockResult);\n expect(await generateAuthenticationOptions(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.generateAuthenticationOptions)\n .mockRejectedValueOnce(new Error('Unexpected authentication response type'));\n expect(await generateAuthenticationOptions(mockOpts)).toFailWith(\n /unexpected authentication response type/i\n );\n });\n});\n\ndescribe('verifyAuthenticationResponse', () => {\n const mockCredential: WebAuthnCredential = {\n id: 'cred-id',\n publicKey: new Uint8Array([1, 2, 3]),\n counter: 0,\n transports: ['usb']\n };\n\n const mockOpts: VerifyAuthenticationResponseOpts = {\n response: {\n id: 'cred-id',\n rawId: 'cred-raw-id',\n response: {\n clientDataJSON: 'client-data',\n authenticatorData: 'auth-data',\n signature: 'sig'\n },\n clientExtensionResults: {},\n type: 'public-key'\n } as AuthenticationResponseJSON,\n expectedChallenge: 'challenge123',\n expectedOrigin: 'https://test.example.com',\n expectedRPID: 'test.example.com',\n credential: mockCredential\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { verified: true } as unknown as VerifiedAuthenticationResponse;\n jest.mocked(upstream.verifyAuthenticationResponse).mockResolvedValueOnce(mockResult);\n expect(await verifyAuthenticationResponse(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.verifyAuthenticationResponse)\n .mockRejectedValueOnce(new Error('Credential counter value for given response must be larger than 0'));\n expect(await verifyAuthenticationResponse(mockOpts)).toFailWith(/credential counter value/i);\n });\n});\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
2
|
+
import type { GenerateAuthenticationOptionsOpts } from '@simplewebauthn/server';
|
|
3
|
+
import type { GenerateRegistrationOptionsOpts } from '@simplewebauthn/server';
|
|
4
|
+
import type { PublicKeyCredentialCreationOptionsJSON as PublicKeyCredentialCreationOptionsJSON_2 } from '@simplewebauthn/server';
|
|
5
|
+
import type { PublicKeyCredentialRequestOptionsJSON as PublicKeyCredentialRequestOptionsJSON_2 } from '@simplewebauthn/server';
|
|
6
|
+
import type { RegistrationResponseJSON } from '@simplewebauthn/server';
|
|
7
|
+
import { Result } from '@fgv/ts-utils';
|
|
8
|
+
import type { VerifiedAuthenticationResponse } from '@simplewebauthn/server';
|
|
9
|
+
import type { VerifiedRegistrationResponse } from '@simplewebauthn/server';
|
|
10
|
+
import type { VerifyAuthenticationResponseOpts } from '@simplewebauthn/server';
|
|
11
|
+
import type { VerifyRegistrationResponseOpts } from '@simplewebauthn/server';
|
|
12
|
+
import type { WebAuthnCredential } from '@simplewebauthn/server';
|
|
13
|
+
|
|
14
|
+
export { AuthenticationResponseJSON }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.
|
|
18
|
+
* Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured
|
|
19
|
+
* as `Failure` with the original message.
|
|
20
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateAuthenticationOptions(options: GenerateAuthenticationOptionsOpts): Promise<Result<PublicKeyCredentialRequestOptionsJSON_2>>;
|
|
24
|
+
|
|
25
|
+
export { GenerateAuthenticationOptionsOpts }
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.
|
|
29
|
+
* Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured
|
|
30
|
+
* as `Failure` with the original message.
|
|
31
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateRegistrationOptions(options: GenerateRegistrationOptionsOpts): Promise<Result<PublicKeyCredentialCreationOptionsJSON_2>>;
|
|
35
|
+
|
|
36
|
+
export { GenerateRegistrationOptionsOpts }
|
|
37
|
+
|
|
38
|
+
export { PublicKeyCredentialCreationOptionsJSON_2 as PublicKeyCredentialCreationOptionsJSON }
|
|
39
|
+
|
|
40
|
+
export { PublicKeyCredentialRequestOptionsJSON_2 as PublicKeyCredentialRequestOptionsJSON }
|
|
41
|
+
|
|
42
|
+
export { RegistrationResponseJSON }
|
|
43
|
+
|
|
44
|
+
export { VerifiedAuthenticationResponse }
|
|
45
|
+
|
|
46
|
+
export { VerifiedRegistrationResponse }
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.
|
|
50
|
+
* Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured
|
|
51
|
+
* as `Failure` with the original message.
|
|
52
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare function verifyAuthenticationResponse(options: VerifyAuthenticationResponseOpts): Promise<Result<VerifiedAuthenticationResponse>>;
|
|
56
|
+
|
|
57
|
+
export { VerifyAuthenticationResponseOpts }
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.
|
|
61
|
+
* Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured
|
|
62
|
+
* as `Failure` with the original message.
|
|
63
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare function verifyRegistrationResponse(options: VerifyRegistrationResponseOpts): Promise<Result<VerifiedRegistrationResponse>>;
|
|
67
|
+
|
|
68
|
+
export { VerifyRegistrationResponseOpts }
|
|
69
|
+
|
|
70
|
+
export { WebAuthnCredential }
|
|
71
|
+
|
|
72
|
+
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,36 @@
|
|
|
1
|
+
import type { GenerateRegistrationOptionsOpts, PublicKeyCredentialCreationOptionsJSON, VerifyRegistrationResponseOpts, VerifiedRegistrationResponse, GenerateAuthenticationOptionsOpts, PublicKeyCredentialRequestOptionsJSON, VerifyAuthenticationResponseOpts, VerifiedAuthenticationResponse, WebAuthnCredential, RegistrationResponseJSON, AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
2
|
+
import { type Result } from '@fgv/ts-utils';
|
|
3
|
+
export type { GenerateRegistrationOptionsOpts, PublicKeyCredentialCreationOptionsJSON, VerifyRegistrationResponseOpts, VerifiedRegistrationResponse, GenerateAuthenticationOptionsOpts, PublicKeyCredentialRequestOptionsJSON, VerifyAuthenticationResponseOpts, VerifiedAuthenticationResponse, WebAuthnCredential, RegistrationResponseJSON, AuthenticationResponseJSON };
|
|
4
|
+
/**
|
|
5
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.
|
|
6
|
+
* Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured
|
|
7
|
+
* as `Failure` with the original message.
|
|
8
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateRegistrationOptions(options: GenerateRegistrationOptionsOpts): Promise<Result<PublicKeyCredentialCreationOptionsJSON>>;
|
|
12
|
+
/**
|
|
13
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.
|
|
14
|
+
* Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured
|
|
15
|
+
* as `Failure` with the original message.
|
|
16
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function verifyRegistrationResponse(options: VerifyRegistrationResponseOpts): Promise<Result<VerifiedRegistrationResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.
|
|
22
|
+
* Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured
|
|
23
|
+
* as `Failure` with the original message.
|
|
24
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateAuthenticationOptions(options: GenerateAuthenticationOptionsOpts): Promise<Result<PublicKeyCredentialRequestOptionsJSON>>;
|
|
28
|
+
/**
|
|
29
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.
|
|
30
|
+
* Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured
|
|
31
|
+
* as `Failure` with the original message.
|
|
32
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function verifyAuthenticationResponse(options: VerifyAuthenticationResponseOpts): Promise<Result<VerifiedAuthenticationResponse>>;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,+BAA+B,EAC/B,sCAAsC,EACtC,8BAA8B,EAC9B,4BAA4B,EAC5B,iCAAiC,EACjC,qCAAqC,EACrC,gCAAgC,EAChC,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAEhE,YAAY,EACV,+BAA+B,EAC/B,sCAAsC,EACtC,8BAA8B,EAC9B,4BAA4B,EAC5B,iCAAiC,EACjC,qCAAqC,EACrC,gCAAgC,EAChC,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAEzD;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAE/C;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAExD;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAEjD"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateRegistrationOptions = generateRegistrationOptions;
|
|
4
|
+
exports.verifyRegistrationResponse = verifyRegistrationResponse;
|
|
5
|
+
exports.generateAuthenticationOptions = generateAuthenticationOptions;
|
|
6
|
+
exports.verifyAuthenticationResponse = verifyAuthenticationResponse;
|
|
7
|
+
const server_1 = require("@simplewebauthn/server");
|
|
8
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
9
|
+
/**
|
|
10
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.
|
|
11
|
+
* Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured
|
|
12
|
+
* as `Failure` with the original message.
|
|
13
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
async function generateRegistrationOptions(options) {
|
|
17
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, server_1.generateRegistrationOptions)(options));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.
|
|
21
|
+
* Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured
|
|
22
|
+
* as `Failure` with the original message.
|
|
23
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
async function verifyRegistrationResponse(options) {
|
|
27
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, server_1.verifyRegistrationResponse)(options));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.
|
|
31
|
+
* Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured
|
|
32
|
+
* as `Failure` with the original message.
|
|
33
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
async function generateAuthenticationOptions(options) {
|
|
37
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, server_1.generateAuthenticationOptions)(options));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.
|
|
41
|
+
* Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured
|
|
42
|
+
* as `Failure` with the original message.
|
|
43
|
+
* @see https://simplewebauthn.dev/docs/packages/server
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
async function verifyAuthenticationResponse(options) {
|
|
47
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, server_1.verifyAuthenticationResponse)(options));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AA0CA,kEAIC;AASD,gEAIC;AASD,sEAIC;AASD,oEAIC;AArFD,mDAKgC;AAchC,4CAAgE;AAgBhE;;;;;;GAMG;AACI,KAAK,UAAU,2BAA2B,CAC/C,OAAwC;IAExC,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,oCAA4B,EAAC,OAAO,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,0BAA0B,CAC9C,OAAuC;IAEvC,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,mCAA2B,EAAC,OAAO,CAAC,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,6BAA6B,CACjD,OAA0C;IAE1C,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,sCAA8B,EAAC,OAAO,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,4BAA4B,CAChD,OAAyC;IAEzC,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,qCAA6B,EAAC,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import {\n generateRegistrationOptions as _generateRegistrationOptions,\n verifyRegistrationResponse as _verifyRegistrationResponse,\n generateAuthenticationOptions as _generateAuthenticationOptions,\n verifyAuthenticationResponse as _verifyAuthenticationResponse\n} from '@simplewebauthn/server';\nimport type {\n GenerateRegistrationOptionsOpts,\n PublicKeyCredentialCreationOptionsJSON,\n VerifyRegistrationResponseOpts,\n VerifiedRegistrationResponse,\n GenerateAuthenticationOptionsOpts,\n PublicKeyCredentialRequestOptionsJSON,\n VerifyAuthenticationResponseOpts,\n VerifiedAuthenticationResponse,\n WebAuthnCredential,\n RegistrationResponseJSON,\n AuthenticationResponseJSON\n} from '@simplewebauthn/server';\nimport { captureAsyncResult, type Result } from '@fgv/ts-utils';\n\nexport type {\n GenerateRegistrationOptionsOpts,\n PublicKeyCredentialCreationOptionsJSON,\n VerifyRegistrationResponseOpts,\n VerifiedRegistrationResponse,\n GenerateAuthenticationOptionsOpts,\n PublicKeyCredentialRequestOptionsJSON,\n VerifyAuthenticationResponseOpts,\n VerifiedAuthenticationResponse,\n WebAuthnCredential,\n RegistrationResponseJSON,\n AuthenticationResponseJSON\n};\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `generateRegistrationOptions`.\n * Returns `Promise<Result<PublicKeyCredentialCreationOptionsJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function generateRegistrationOptions(\n options: GenerateRegistrationOptionsOpts\n): Promise<Result<PublicKeyCredentialCreationOptionsJSON>> {\n return captureAsyncResult(() => _generateRegistrationOptions(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `verifyRegistrationResponse`.\n * Returns `Promise<Result<VerifiedRegistrationResponse>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function verifyRegistrationResponse(\n options: VerifyRegistrationResponseOpts\n): Promise<Result<VerifiedRegistrationResponse>> {\n return captureAsyncResult(() => _verifyRegistrationResponse(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `generateAuthenticationOptions`.\n * Returns `Promise<Result<PublicKeyCredentialRequestOptionsJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function generateAuthenticationOptions(\n options: GenerateAuthenticationOptionsOpts\n): Promise<Result<PublicKeyCredentialRequestOptionsJSON>> {\n return captureAsyncResult(() => _generateAuthenticationOptions(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/server`'s `verifyAuthenticationResponse`.\n * Returns `Promise<Result<VerifiedAuthenticationResponse>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/server\n * @public\n */\nexport async function verifyAuthenticationResponse(\n options: VerifyAuthenticationResponseOpts\n): Promise<Result<VerifiedAuthenticationResponse>> {\n return captureAsyncResult(() => _verifyAuthenticationResponse(options));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.test.d.ts","sourceRoot":"","sources":["../../../src/test/unit/webauthn.test.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC"}
|