@fgv/ts-web-extras-webauthn 5.1.0-27 → 5.1.0-28
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/9e1eca90588fe0b2288c89625b3f13f9ecfaa179.tar.log +52 -0
- package/.rush/temp/chunked-rush-logs/ts-web-extras-webauthn.build.chunks.jsonl +27 -0
- package/.rush/temp/operation/build/all.log +27 -0
- package/.rush/temp/operation/build/log-chunks.jsonl +27 -0
- package/.rush/temp/operation/build/state.json +3 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/test/unit/webauthn.test.js +55 -0
- package/dist/test/unit/webauthn.test.js.map +1 -0
- package/dist/ts-web-extras-webauthn.d.ts +33 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +27 -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 +90 -0
- package/lib/test/unit/webauthn.test.js.map +1 -0
- package/package.json +18 -18
- package/rush-logs/ts-web-extras-webauthn.build.cache.log +3 -0
- package/rush-logs/ts-web-extras-webauthn.build.log +27 -0
- package/temp/build/lint/_eslint-5eVG3S6w.json +14 -0
- package/temp/build/typescript/ts_8nwakTlr.json +1 -0
- package/temp/coverage/base.css +224 -0
- package/temp/coverage/block-navigation.js +87 -0
- package/temp/coverage/favicon.png +0 -0
- package/temp/coverage/index.html +116 -0
- package/temp/coverage/index.ts.html +217 -0
- package/temp/coverage/lcov-report/base.css +224 -0
- package/temp/coverage/lcov-report/block-navigation.js +87 -0
- package/temp/coverage/lcov-report/favicon.png +0 -0
- package/temp/coverage/lcov-report/index.html +116 -0
- package/temp/coverage/lcov-report/index.ts.html +217 -0
- package/temp/coverage/lcov-report/prettify.css +1 -0
- package/temp/coverage/lcov-report/prettify.js +2 -0
- package/temp/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/temp/coverage/lcov-report/sorter.js +210 -0
- package/temp/coverage/lcov.info +61 -0
- package/temp/coverage/prettify.css +1 -0
- package/temp/coverage/prettify.js +2 -0
- package/temp/coverage/sort-arrow-sprite.png +0 -0
- package/temp/coverage/sorter.js +210 -0
- package/temp/test/jest/haste-map-cb73e455090cee755bd1216e62c3411e-dd1700f1a674257780709faabd59fed2-201bc87eb61075d812fbe7c5abccbcfc +0 -0
- package/temp/test/jest/jest-transform-cache-cb73e455090cee755bd1216e62c3411e-79ef2876fae7ca75eedb2aa53dc48338/33/package_3363becd7de1a287babdb84f8092f5aa +53 -0
- package/temp/test/jest/perf-cache-cb73e455090cee755bd1216e62c3411e-da39a3ee5e6b4b0d3255bfef95601890 +1 -0
- package/temp/ts-web-extras-webauthn.api.json +332 -0
- package/temp/ts-web-extras-webauthn.api.md +29 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Start time: Wed May 13 2026 10:33:25 GMT+0000 (Coordinated Universal Time)
|
|
2
|
+
Invoking "/usr/bin/tar -c -f /home/runner/work/fgv/fgv/common/temp/build-cache/9e1eca90588fe0b2288c89625b3f13f9ecfaa179-8f01b02584a6b732.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-web-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/coverage/base.css
|
|
25
|
+
temp/coverage/block-navigation.js
|
|
26
|
+
temp/coverage/favicon.png
|
|
27
|
+
temp/coverage/index.html
|
|
28
|
+
temp/coverage/index.ts.html
|
|
29
|
+
temp/coverage/lcov-report/base.css
|
|
30
|
+
temp/coverage/lcov-report/block-navigation.js
|
|
31
|
+
temp/coverage/lcov-report/favicon.png
|
|
32
|
+
temp/coverage/lcov-report/index.html
|
|
33
|
+
temp/coverage/lcov-report/index.ts.html
|
|
34
|
+
temp/coverage/lcov-report/prettify.css
|
|
35
|
+
temp/coverage/lcov-report/prettify.js
|
|
36
|
+
temp/coverage/lcov-report/sort-arrow-sprite.png
|
|
37
|
+
temp/coverage/lcov-report/sorter.js
|
|
38
|
+
temp/coverage/lcov.info
|
|
39
|
+
temp/coverage/prettify.css
|
|
40
|
+
temp/coverage/prettify.js
|
|
41
|
+
temp/coverage/sort-arrow-sprite.png
|
|
42
|
+
temp/coverage/sorter.js
|
|
43
|
+
temp/test/jest/haste-map-cb73e455090cee755bd1216e62c3411e-dd1700f1a674257780709faabd59fed2-201bc87eb61075d812fbe7c5abccbcfc
|
|
44
|
+
temp/test/jest/jest-transform-cache-cb73e455090cee755bd1216e62c3411e-79ef2876fae7ca75eedb2aa53dc48338/33/package_3363becd7de1a287babdb84f8092f5aa
|
|
45
|
+
temp/test/jest/perf-cache-cb73e455090cee755bd1216e62c3411e-da39a3ee5e6b4b0d3255bfef95601890
|
|
46
|
+
temp/ts-web-extras-webauthn.api.json
|
|
47
|
+
temp/ts-web-extras-webauthn.api.md
|
|
48
|
+
======== END PROCESS INPUT =======
|
|
49
|
+
======= BEGIN PROCESS OUTPUT =======
|
|
50
|
+
======== END PROCESS OUTPUT ========
|
|
51
|
+
|
|
52
|
+
Exited with code "0"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: NODE_OPTIONS=--disable-warning=DEP0040 heft test --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.033s) ---- \n"}
|
|
9
|
+
{"kind":"O","text":" ---- test started ---- \n"}
|
|
10
|
+
{"kind":"O","text":"[test:jest] Using Jest version 29.5.0\n"}
|
|
11
|
+
{"kind":"O","text":"[test:jest] \n"}
|
|
12
|
+
{"kind":"O","text":"[test:jest] Run start. 1 test suite\n"}
|
|
13
|
+
{"kind":"O","text":"[test:jest] START lib/test/unit/webauthn.test.js\n"}
|
|
14
|
+
{"kind":"O","text":"[test:jest] PASS lib/test/unit/webauthn.test.js (duration: 2.413s, 4 passed, 0 failed)\n"}
|
|
15
|
+
{"kind":"O","text":"[test:jest] \n"}
|
|
16
|
+
{"kind":"O","text":"[test:jest] Tests finished:\n"}
|
|
17
|
+
{"kind":"O","text":"[test:jest] Successes: 4\n"}
|
|
18
|
+
{"kind":"O","text":"[test:jest] Failures: 0\n"}
|
|
19
|
+
{"kind":"O","text":"[test:jest] Total: 4\n"}
|
|
20
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
21
|
+
{"kind":"O","text":"File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n"}
|
|
22
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
23
|
+
{"kind":"O","text":"All files | 100 | 100 | 100 | 100 | \n"}
|
|
24
|
+
{"kind":"O","text":" index.ts | 100 | 100 | 100 | 100 | \n"}
|
|
25
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
26
|
+
{"kind":"O","text":" ---- test finished (4.069s) ---- \n"}
|
|
27
|
+
{"kind":"O","text":"-------------------- Finished (22.107s) --------------------\n"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Invoking: NODE_OPTIONS=--disable-warning=DEP0040 heft test --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.033s) ----
|
|
9
|
+
---- test started ----
|
|
10
|
+
[test:jest] Using Jest version 29.5.0
|
|
11
|
+
[test:jest]
|
|
12
|
+
[test:jest] Run start. 1 test suite
|
|
13
|
+
[test:jest] START lib/test/unit/webauthn.test.js
|
|
14
|
+
[test:jest] PASS lib/test/unit/webauthn.test.js (duration: 2.413s, 4 passed, 0 failed)
|
|
15
|
+
[test:jest]
|
|
16
|
+
[test:jest] Tests finished:
|
|
17
|
+
[test:jest] Successes: 4
|
|
18
|
+
[test:jest] Failures: 0
|
|
19
|
+
[test:jest] Total: 4
|
|
20
|
+
----------|---------|----------|---------|---------|-------------------
|
|
21
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
22
|
+
----------|---------|----------|---------|---------|-------------------
|
|
23
|
+
All files | 100 | 100 | 100 | 100 |
|
|
24
|
+
index.ts | 100 | 100 | 100 | 100 |
|
|
25
|
+
----------|---------|----------|---------|---------|-------------------
|
|
26
|
+
---- test finished (4.069s) ----
|
|
27
|
+
-------------------- Finished (22.107s) --------------------
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: NODE_OPTIONS=--disable-warning=DEP0040 heft test --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.033s) ---- \n"}
|
|
9
|
+
{"kind":"O","text":" ---- test started ---- \n"}
|
|
10
|
+
{"kind":"O","text":"[test:jest] Using Jest version 29.5.0\n"}
|
|
11
|
+
{"kind":"O","text":"[test:jest] \n"}
|
|
12
|
+
{"kind":"O","text":"[test:jest] Run start. 1 test suite\n"}
|
|
13
|
+
{"kind":"O","text":"[test:jest] START lib/test/unit/webauthn.test.js\n"}
|
|
14
|
+
{"kind":"O","text":"[test:jest] PASS lib/test/unit/webauthn.test.js (duration: 2.413s, 4 passed, 0 failed)\n"}
|
|
15
|
+
{"kind":"O","text":"[test:jest] \n"}
|
|
16
|
+
{"kind":"O","text":"[test:jest] Tests finished:\n"}
|
|
17
|
+
{"kind":"O","text":"[test:jest] Successes: 4\n"}
|
|
18
|
+
{"kind":"O","text":"[test:jest] Failures: 0\n"}
|
|
19
|
+
{"kind":"O","text":"[test:jest] Total: 4\n"}
|
|
20
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
21
|
+
{"kind":"O","text":"File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n"}
|
|
22
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
23
|
+
{"kind":"O","text":"All files | 100 | 100 | 100 | 100 | \n"}
|
|
24
|
+
{"kind":"O","text":" index.ts | 100 | 100 | 100 | 100 | \n"}
|
|
25
|
+
{"kind":"O","text":"----------|---------|----------|---------|---------|-------------------\n"}
|
|
26
|
+
{"kind":"O","text":" ---- test finished (4.069s) ---- \n"}
|
|
27
|
+
{"kind":"O","text":"-------------------- Finished (22.107s) --------------------\n"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { startRegistration as _startRegistration, startAuthentication as _startAuthentication } from '@simplewebauthn/browser';
|
|
2
|
+
import { captureAsyncResult } from '@fgv/ts-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.
|
|
5
|
+
* Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured
|
|
6
|
+
* as `Failure` with the original message.
|
|
7
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export async function startRegistration(options) {
|
|
11
|
+
return captureAsyncResult(() => _startRegistration(options));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.
|
|
15
|
+
* Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured
|
|
16
|
+
* as `Failure` with the original message.
|
|
17
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export async function startAuthentication(options) {
|
|
21
|
+
return captureAsyncResult(() => _startAuthentication(options));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,IAAI,kBAAkB,EACvC,mBAAmB,IAAI,oBAAoB,EAC5C,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,kBAAkB,EAAe,MAAM,eAAe,CAAC;AAShE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA8B;IAE9B,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAgC;IAEhC,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import {\n startRegistration as _startRegistration,\n startAuthentication as _startAuthentication\n} from '@simplewebauthn/browser';\nimport type {\n StartRegistrationOpts,\n RegistrationResponseJSON,\n StartAuthenticationOpts,\n AuthenticationResponseJSON\n} from '@simplewebauthn/browser';\nimport { captureAsyncResult, type Result } from '@fgv/ts-utils';\n\nexport type {\n StartRegistrationOpts,\n RegistrationResponseJSON,\n StartAuthenticationOpts,\n AuthenticationResponseJSON\n};\n\n/**\n * Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.\n * Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/browser\n * @public\n */\nexport async function startRegistration(\n options: StartRegistrationOpts\n): Promise<Result<RegistrationResponseJSON>> {\n return captureAsyncResult(() => _startRegistration(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.\n * Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/browser\n * @public\n */\nexport async function startAuthentication(\n options: StartAuthenticationOpts\n): Promise<Result<AuthenticationResponseJSON>> {\n return captureAsyncResult(() => _startAuthentication(options));\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
jest.mock('@simplewebauthn/browser');
|
|
2
|
+
import '@fgv/ts-utils-jest';
|
|
3
|
+
import * as upstream from '@simplewebauthn/browser';
|
|
4
|
+
import { startAuthentication, startRegistration } from '../../index';
|
|
5
|
+
describe('startRegistration', () => {
|
|
6
|
+
const mockOpts = {
|
|
7
|
+
optionsJSON: {
|
|
8
|
+
challenge: 'abc123',
|
|
9
|
+
rp: { name: 'Test RP', id: 'test.example.com' },
|
|
10
|
+
user: { id: 'user-id', name: 'user@test.com', displayName: 'Test User' },
|
|
11
|
+
pubKeyCredParams: [{ alg: -7, type: 'public-key' }],
|
|
12
|
+
timeout: 60000,
|
|
13
|
+
attestation: 'none'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
jest.resetAllMocks();
|
|
18
|
+
});
|
|
19
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
20
|
+
const mockResult = { id: 'cred-id', type: 'public-key' };
|
|
21
|
+
jest.mocked(upstream.startRegistration).mockResolvedValueOnce(mockResult);
|
|
22
|
+
expect(await startRegistration(mockOpts)).toSucceedWith(mockResult);
|
|
23
|
+
});
|
|
24
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
25
|
+
jest
|
|
26
|
+
.mocked(upstream.startRegistration)
|
|
27
|
+
.mockRejectedValueOnce(new Error('Registration ceremony was sent an abort signal'));
|
|
28
|
+
expect(await startRegistration(mockOpts)).toFailWith(/registration ceremony was sent an abort signal/i);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('startAuthentication', () => {
|
|
32
|
+
const mockOpts = {
|
|
33
|
+
optionsJSON: {
|
|
34
|
+
challenge: 'xyz789',
|
|
35
|
+
rpId: 'test.example.com',
|
|
36
|
+
timeout: 60000,
|
|
37
|
+
userVerification: 'preferred'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
jest.resetAllMocks();
|
|
42
|
+
});
|
|
43
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
44
|
+
const mockResult = { id: 'cred-id', type: 'public-key' };
|
|
45
|
+
jest.mocked(upstream.startAuthentication).mockResolvedValueOnce(mockResult);
|
|
46
|
+
expect(await startAuthentication(mockOpts)).toSucceedWith(mockResult);
|
|
47
|
+
});
|
|
48
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
49
|
+
jest
|
|
50
|
+
.mocked(upstream.startAuthentication)
|
|
51
|
+
.mockRejectedValueOnce(new Error('Authentication ceremony was sent an abort signal'));
|
|
52
|
+
expect(await startAuthentication(mockOpts)).toFailWith(/authentication ceremony was sent an abort signal/i);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# 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,yBAAyB,CAAC,CAAC;AAErC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAKlB,MAAM,aAAa,CAAC;AAErB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,QAAQ,GAA0B;QACtC,WAAW,EAAE;YACX,SAAS,EAAE,QAAQ;YACnB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE;YACxE,gBAAgB,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;YACnD,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,MAAM;SACpB;KACF,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,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAA8B,CAAC;QACrF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,IAAI;aACD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC;aAClC,qBAAqB,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;QACtF,MAAM,CAAC,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,iDAAiD,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,QAAQ,GAA4B;QACxC,WAAW,EAAE;YACX,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,KAAK;YACd,gBAAgB,EAAE,WAAW;SAC9B;KACF,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,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAgC,CAAC;QACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC5E,MAAM,CAAC,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,IAAI;aACD,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;aACpC,qBAAqB,CAAC,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC,CAAC;QACxF,MAAM,CAAC,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CACpD,mDAAmD,CACpD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@simplewebauthn/browser');\n\nimport '@fgv/ts-utils-jest';\nimport * as upstream from '@simplewebauthn/browser';\nimport {\n startAuthentication,\n startRegistration,\n type AuthenticationResponseJSON,\n type RegistrationResponseJSON,\n type StartAuthenticationOpts,\n type StartRegistrationOpts\n} from '../../index';\n\ndescribe('startRegistration', () => {\n const mockOpts: StartRegistrationOpts = {\n optionsJSON: {\n challenge: 'abc123',\n rp: { name: 'Test RP', id: 'test.example.com' },\n user: { id: 'user-id', name: 'user@test.com', displayName: 'Test User' },\n pubKeyCredParams: [{ alg: -7, type: 'public-key' }],\n timeout: 60000,\n attestation: 'none'\n }\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { id: 'cred-id', type: 'public-key' } as RegistrationResponseJSON;\n jest.mocked(upstream.startRegistration).mockResolvedValueOnce(mockResult);\n expect(await startRegistration(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.startRegistration)\n .mockRejectedValueOnce(new Error('Registration ceremony was sent an abort signal'));\n expect(await startRegistration(mockOpts)).toFailWith(/registration ceremony was sent an abort signal/i);\n });\n});\n\ndescribe('startAuthentication', () => {\n const mockOpts: StartAuthenticationOpts = {\n optionsJSON: {\n challenge: 'xyz789',\n rpId: 'test.example.com',\n timeout: 60000,\n userVerification: 'preferred'\n }\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { id: 'cred-id', type: 'public-key' } as AuthenticationResponseJSON;\n jest.mocked(upstream.startAuthentication).mockResolvedValueOnce(mockResult);\n expect(await startAuthentication(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.startAuthentication)\n .mockRejectedValueOnce(new Error('Authentication ceremony was sent an abort signal'));\n expect(await startAuthentication(mockOpts)).toFailWith(\n /authentication ceremony was sent an abort signal/i\n );\n });\n});\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
2
|
+
import type { RegistrationResponseJSON } from '@simplewebauthn/browser';
|
|
3
|
+
import { Result } from '@fgv/ts-utils';
|
|
4
|
+
import type { StartAuthenticationOpts } from '@simplewebauthn/browser';
|
|
5
|
+
import type { StartRegistrationOpts } from '@simplewebauthn/browser';
|
|
6
|
+
|
|
7
|
+
export { AuthenticationResponseJSON }
|
|
8
|
+
|
|
9
|
+
export { RegistrationResponseJSON }
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.
|
|
13
|
+
* Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured
|
|
14
|
+
* as `Failure` with the original message.
|
|
15
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare function startAuthentication(options: StartAuthenticationOpts): Promise<Result<AuthenticationResponseJSON>>;
|
|
19
|
+
|
|
20
|
+
export { StartAuthenticationOpts }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.
|
|
24
|
+
* Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured
|
|
25
|
+
* as `Failure` with the original message.
|
|
26
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function startRegistration(options: StartRegistrationOpts): Promise<Result<RegistrationResponseJSON>>;
|
|
30
|
+
|
|
31
|
+
export { StartRegistrationOpts }
|
|
32
|
+
|
|
33
|
+
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,20 @@
|
|
|
1
|
+
import type { StartRegistrationOpts, RegistrationResponseJSON, StartAuthenticationOpts, AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
2
|
+
import { type Result } from '@fgv/ts-utils';
|
|
3
|
+
export type { StartRegistrationOpts, RegistrationResponseJSON, StartAuthenticationOpts, AuthenticationResponseJSON };
|
|
4
|
+
/**
|
|
5
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.
|
|
6
|
+
* Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured
|
|
7
|
+
* as `Failure` with the original message.
|
|
8
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function startRegistration(options: StartRegistrationOpts): Promise<Result<RegistrationResponseJSON>>;
|
|
12
|
+
/**
|
|
13
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.
|
|
14
|
+
* Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured
|
|
15
|
+
* as `Failure` with the original message.
|
|
16
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function startAuthentication(options: StartAuthenticationOpts): Promise<Result<AuthenticationResponseJSON>>;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAsB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAEhE,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAE3C;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAE7C"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startRegistration = startRegistration;
|
|
4
|
+
exports.startAuthentication = startAuthentication;
|
|
5
|
+
const browser_1 = require("@simplewebauthn/browser");
|
|
6
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
7
|
+
/**
|
|
8
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.
|
|
9
|
+
* Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured
|
|
10
|
+
* as `Failure` with the original message.
|
|
11
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
async function startRegistration(options) {
|
|
15
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, browser_1.startRegistration)(options));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.
|
|
19
|
+
* Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured
|
|
20
|
+
* as `Failure` with the original message.
|
|
21
|
+
* @see https://simplewebauthn.dev/docs/packages/browser
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
async function startAuthentication(options) {
|
|
25
|
+
return (0, ts_utils_1.captureAsyncResult)(() => (0, browser_1.startAuthentication)(options));
|
|
26
|
+
}
|
|
27
|
+
//# 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":";;AA0BA,8CAIC;AASD,kDAIC;AA3CD,qDAGiC;AAOjC,4CAAgE;AAShE;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,OAA8B;IAE9B,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CACvC,OAAgC;IAEhC,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,CAAC,IAAA,6BAAoB,EAAC,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import {\n startRegistration as _startRegistration,\n startAuthentication as _startAuthentication\n} from '@simplewebauthn/browser';\nimport type {\n StartRegistrationOpts,\n RegistrationResponseJSON,\n StartAuthenticationOpts,\n AuthenticationResponseJSON\n} from '@simplewebauthn/browser';\nimport { captureAsyncResult, type Result } from '@fgv/ts-utils';\n\nexport type {\n StartRegistrationOpts,\n RegistrationResponseJSON,\n StartAuthenticationOpts,\n AuthenticationResponseJSON\n};\n\n/**\n * Result-integration wrapper around `@simplewebauthn/browser`'s `startRegistration`.\n * Returns `Promise<Result<RegistrationResponseJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/browser\n * @public\n */\nexport async function startRegistration(\n options: StartRegistrationOpts\n): Promise<Result<RegistrationResponseJSON>> {\n return captureAsyncResult(() => _startRegistration(options));\n}\n\n/**\n * Result-integration wrapper around `@simplewebauthn/browser`'s `startAuthentication`.\n * Returns `Promise<Result<AuthenticationResponseJSON>>`; upstream errors are captured\n * as `Failure` with the original message.\n * @see https://simplewebauthn.dev/docs/packages/browser\n * @public\n */\nexport async function startAuthentication(\n options: StartAuthenticationOpts\n): Promise<Result<AuthenticationResponseJSON>> {\n return captureAsyncResult(() => _startAuthentication(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"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
jest.mock('@simplewebauthn/browser');
|
|
37
|
+
require("@fgv/ts-utils-jest");
|
|
38
|
+
const upstream = __importStar(require("@simplewebauthn/browser"));
|
|
39
|
+
const index_1 = require("../../index");
|
|
40
|
+
describe('startRegistration', () => {
|
|
41
|
+
const mockOpts = {
|
|
42
|
+
optionsJSON: {
|
|
43
|
+
challenge: 'abc123',
|
|
44
|
+
rp: { name: 'Test RP', id: 'test.example.com' },
|
|
45
|
+
user: { id: 'user-id', name: 'user@test.com', displayName: 'Test User' },
|
|
46
|
+
pubKeyCredParams: [{ alg: -7, type: 'public-key' }],
|
|
47
|
+
timeout: 60000,
|
|
48
|
+
attestation: 'none'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
jest.resetAllMocks();
|
|
53
|
+
});
|
|
54
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
55
|
+
const mockResult = { id: 'cred-id', type: 'public-key' };
|
|
56
|
+
jest.mocked(upstream.startRegistration).mockResolvedValueOnce(mockResult);
|
|
57
|
+
expect(await (0, index_1.startRegistration)(mockOpts)).toSucceedWith(mockResult);
|
|
58
|
+
});
|
|
59
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
60
|
+
jest
|
|
61
|
+
.mocked(upstream.startRegistration)
|
|
62
|
+
.mockRejectedValueOnce(new Error('Registration ceremony was sent an abort signal'));
|
|
63
|
+
expect(await (0, index_1.startRegistration)(mockOpts)).toFailWith(/registration ceremony was sent an abort signal/i);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('startAuthentication', () => {
|
|
67
|
+
const mockOpts = {
|
|
68
|
+
optionsJSON: {
|
|
69
|
+
challenge: 'xyz789',
|
|
70
|
+
rpId: 'test.example.com',
|
|
71
|
+
timeout: 60000,
|
|
72
|
+
userVerification: 'preferred'
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
jest.resetAllMocks();
|
|
77
|
+
});
|
|
78
|
+
test('returns Success wrapping upstream result on success', async () => {
|
|
79
|
+
const mockResult = { id: 'cred-id', type: 'public-key' };
|
|
80
|
+
jest.mocked(upstream.startAuthentication).mockResolvedValueOnce(mockResult);
|
|
81
|
+
expect(await (0, index_1.startAuthentication)(mockOpts)).toSucceedWith(mockResult);
|
|
82
|
+
});
|
|
83
|
+
test('returns Failure capturing upstream error message on throw', async () => {
|
|
84
|
+
jest
|
|
85
|
+
.mocked(upstream.startAuthentication)
|
|
86
|
+
.mockRejectedValueOnce(new Error('Authentication ceremony was sent an abort signal'));
|
|
87
|
+
expect(await (0, index_1.startAuthentication)(mockOpts)).toFailWith(/authentication ceremony was sent an abort signal/i);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
//# 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,yBAAyB,CAAC,CAAC;AAErC,8BAA4B;AAC5B,kEAAoD;AACpD,uCAOqB;AAErB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,QAAQ,GAA0B;QACtC,WAAW,EAAE;YACX,SAAS,EAAE,QAAQ;YACnB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE;YACxE,gBAAgB,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;YACnD,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,MAAM;SACpB;KACF,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,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAA8B,CAAC;QACrF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,IAAI;aACD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC;aAClC,qBAAqB,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;QACtF,MAAM,CAAC,MAAM,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,iDAAiD,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,QAAQ,GAA4B;QACxC,WAAW,EAAE;YACX,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,KAAK;YACd,gBAAgB,EAAE,WAAW;SAC9B;KACF,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,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAgC,CAAC;QACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC5E,MAAM,CAAC,MAAM,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,IAAI;aACD,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;aACpC,qBAAqB,CAAC,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC,CAAC;QACxF,MAAM,CAAC,MAAM,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CACpD,mDAAmD,CACpD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@simplewebauthn/browser');\n\nimport '@fgv/ts-utils-jest';\nimport * as upstream from '@simplewebauthn/browser';\nimport {\n startAuthentication,\n startRegistration,\n type AuthenticationResponseJSON,\n type RegistrationResponseJSON,\n type StartAuthenticationOpts,\n type StartRegistrationOpts\n} from '../../index';\n\ndescribe('startRegistration', () => {\n const mockOpts: StartRegistrationOpts = {\n optionsJSON: {\n challenge: 'abc123',\n rp: { name: 'Test RP', id: 'test.example.com' },\n user: { id: 'user-id', name: 'user@test.com', displayName: 'Test User' },\n pubKeyCredParams: [{ alg: -7, type: 'public-key' }],\n timeout: 60000,\n attestation: 'none'\n }\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { id: 'cred-id', type: 'public-key' } as RegistrationResponseJSON;\n jest.mocked(upstream.startRegistration).mockResolvedValueOnce(mockResult);\n expect(await startRegistration(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.startRegistration)\n .mockRejectedValueOnce(new Error('Registration ceremony was sent an abort signal'));\n expect(await startRegistration(mockOpts)).toFailWith(/registration ceremony was sent an abort signal/i);\n });\n});\n\ndescribe('startAuthentication', () => {\n const mockOpts: StartAuthenticationOpts = {\n optionsJSON: {\n challenge: 'xyz789',\n rpId: 'test.example.com',\n timeout: 60000,\n userVerification: 'preferred'\n }\n };\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n test('returns Success wrapping upstream result on success', async () => {\n const mockResult = { id: 'cred-id', type: 'public-key' } as AuthenticationResponseJSON;\n jest.mocked(upstream.startAuthentication).mockResolvedValueOnce(mockResult);\n expect(await startAuthentication(mockOpts)).toSucceedWith(mockResult);\n });\n\n test('returns Failure capturing upstream error message on throw', async () => {\n jest\n .mocked(upstream.startAuthentication)\n .mockRejectedValueOnce(new Error('Authentication ceremony was sent an abort signal'));\n expect(await startAuthentication(mockOpts)).toFailWith(\n /authentication ceremony was sent an abort signal/i\n );\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-web-extras-webauthn",
|
|
3
|
-
"version": "5.1.0-
|
|
3
|
+
"version": "5.1.0-28",
|
|
4
4
|
"description": "Result-integration boundary over @simplewebauthn/browser",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "dist/ts-web-extras-webauthn.d.ts",
|
|
@@ -17,17 +17,6 @@
|
|
|
17
17
|
"types": "./dist/ts-web-extras-webauthn.d.ts"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "NODE_OPTIONS=--disable-warning=DEP0040 heft test --clean",
|
|
22
|
-
"clean": "heft clean",
|
|
23
|
-
"test": "NODE_OPTIONS=--disable-warning=DEP0040 heft test --clean",
|
|
24
|
-
"test-handles": "NODE_OPTIONS=--disable-warning=DEP0040 jest --runInBand --detectOpenHandles",
|
|
25
|
-
"clean-jest": "jest --clear-cache",
|
|
26
|
-
"update-snapshot": "jest --updateSnapshot",
|
|
27
|
-
"coverage": "NODE_OPTIONS=--disable-warning=DEP0040 jest --coverage",
|
|
28
|
-
"lint": "eslint src --ext .ts",
|
|
29
|
-
"fixlint": "eslint src --ext .ts --fix"
|
|
30
|
-
},
|
|
31
20
|
"keywords": [
|
|
32
21
|
"browser",
|
|
33
22
|
"typescript",
|
|
@@ -50,9 +39,6 @@
|
|
|
50
39
|
"@simplewebauthn/browser": "^13.0.0"
|
|
51
40
|
},
|
|
52
41
|
"devDependencies": {
|
|
53
|
-
"@fgv/heft-dual-rig": "workspace:*",
|
|
54
|
-
"@fgv/ts-utils": "workspace:*",
|
|
55
|
-
"@fgv/ts-utils-jest": "workspace:*",
|
|
56
42
|
"@microsoft/api-extractor": "^7.55.2",
|
|
57
43
|
"@rushstack/eslint-config": "4.6.4",
|
|
58
44
|
"@rushstack/heft": "1.2.7",
|
|
@@ -74,9 +60,23 @@
|
|
|
74
60
|
"rimraf": "^6.1.2",
|
|
75
61
|
"ts-jest": "^29.4.6",
|
|
76
62
|
"ts-node": "^10.9.2",
|
|
77
|
-
"typescript": "5.9.3"
|
|
63
|
+
"typescript": "5.9.3",
|
|
64
|
+
"@fgv/heft-dual-rig": "5.1.0-28",
|
|
65
|
+
"@fgv/ts-utils-jest": "5.1.0-28",
|
|
66
|
+
"@fgv/ts-utils": "5.1.0-28"
|
|
78
67
|
},
|
|
79
68
|
"peerDependencies": {
|
|
80
|
-
"@fgv/ts-utils": "
|
|
69
|
+
"@fgv/ts-utils": "5.1.0-28"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "NODE_OPTIONS=--disable-warning=DEP0040 heft test --clean",
|
|
73
|
+
"clean": "heft clean",
|
|
74
|
+
"test": "NODE_OPTIONS=--disable-warning=DEP0040 heft test --clean",
|
|
75
|
+
"test-handles": "NODE_OPTIONS=--disable-warning=DEP0040 jest --runInBand --detectOpenHandles",
|
|
76
|
+
"clean-jest": "jest --clear-cache",
|
|
77
|
+
"update-snapshot": "jest --updateSnapshot",
|
|
78
|
+
"coverage": "NODE_OPTIONS=--disable-warning=DEP0040 jest --coverage",
|
|
79
|
+
"lint": "eslint src --ext .ts",
|
|
80
|
+
"fixlint": "eslint src --ext .ts --fix"
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Invoking: NODE_OPTIONS=--disable-warning=DEP0040 heft test --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.033s) ----
|
|
9
|
+
---- test started ----
|
|
10
|
+
[test:jest] Using Jest version 29.5.0
|
|
11
|
+
[test:jest]
|
|
12
|
+
[test:jest] Run start. 1 test suite
|
|
13
|
+
[test:jest] START lib/test/unit/webauthn.test.js
|
|
14
|
+
[test:jest] PASS lib/test/unit/webauthn.test.js (duration: 2.413s, 4 passed, 0 failed)
|
|
15
|
+
[test:jest]
|
|
16
|
+
[test:jest] Tests finished:
|
|
17
|
+
[test:jest] Successes: 4
|
|
18
|
+
[test:jest] Failures: 0
|
|
19
|
+
[test:jest] Total: 4
|
|
20
|
+
----------|---------|----------|---------|---------|-------------------
|
|
21
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
22
|
+
----------|---------|----------|---------|---------|-------------------
|
|
23
|
+
All files | 100 | 100 | 100 | 100 |
|
|
24
|
+
index.ts | 100 | 100 | 100 | 100 |
|
|
25
|
+
----------|---------|----------|---------|---------|-------------------
|
|
26
|
+
---- test finished (4.069s) ----
|
|
27
|
+
-------------------- Finished (22.107s) --------------------
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cacheVersion": "9.39.4_v22.22.0",
|
|
3
|
+
"fileVersions": [
|
|
4
|
+
[
|
|
5
|
+
"index.ts",
|
|
6
|
+
"fe0515e3e0cb38a8bdf5ad678877ad570ed76725d6d1665bae4508601a0f5f6c_hJqIEPPDr4eXi0w/jC6xOWKwM8o="
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
"test/unit/webauthn.test.ts",
|
|
10
|
+
"c469d4f892bfeaf6140be0142d2889787289b51100c88873849fbde0613539b0_l5l2Fu3nf+8zQysN4dhSd51ZrOg="
|
|
11
|
+
]
|
|
12
|
+
],
|
|
13
|
+
"filesHash": "dj4lIuFKSJUNljXVJiluRQ"
|
|
14
|
+
}
|