@simplewebauthn/server 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/authentication/verifyAuthenticationResponse.d.ts +1 -1
- package/esm/authentication/verifyAuthenticationResponse.js +1 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +1 -1
- package/esm/registration/verifyRegistrationResponse.d.ts +1 -1
- package/esm/registration/verifyRegistrationResponse.js +1 -1
- package/package.json +9 -1
- package/script/authentication/verifyAuthenticationResponse.d.ts +1 -1
- package/script/authentication/verifyAuthenticationResponse.js +1 -1
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +24 -1
- package/script/registration/verifyRegistrationResponse.d.ts +1 -1
- package/script/registration/verifyRegistrationResponse.js +1 -1
|
@@ -2,7 +2,7 @@ import type { AuthenticationResponseJSON, AuthenticatorDevice, CredentialDeviceT
|
|
|
2
2
|
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
3
3
|
export type VerifyAuthenticationResponseOpts = {
|
|
4
4
|
response: AuthenticationResponseJSON;
|
|
5
|
-
expectedChallenge: string | ((challenge: string) => boolean);
|
|
5
|
+
expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>);
|
|
6
6
|
expectedOrigin: string | string[];
|
|
7
7
|
expectedRPID: string | string[];
|
|
8
8
|
authenticator: AuthenticatorDevice;
|
|
@@ -53,7 +53,7 @@ export async function verifyAuthenticationResponse(options) {
|
|
|
53
53
|
}
|
|
54
54
|
// Ensure the device provided the challenge we gave it
|
|
55
55
|
if (typeof expectedChallenge === 'function') {
|
|
56
|
-
if (!expectedChallenge(challenge)) {
|
|
56
|
+
if (!(await expectedChallenge(challenge))) {
|
|
57
57
|
throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -13,7 +13,7 @@ export async function getWebCrypto() {
|
|
|
13
13
|
*/
|
|
14
14
|
// @ts-ignore: We'll handle any errors...
|
|
15
15
|
// dnt-shim-ignore
|
|
16
|
-
const _crypto = await
|
|
16
|
+
const _crypto = await import('crypto');
|
|
17
17
|
webCrypto = _crypto.webcrypto;
|
|
18
18
|
}
|
|
19
19
|
catch (_err) {
|
|
@@ -3,7 +3,7 @@ import { AttestationFormat, AttestationStatement } from '../helpers/decodeAttest
|
|
|
3
3
|
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
4
4
|
export type VerifyRegistrationResponseOpts = {
|
|
5
5
|
response: RegistrationResponseJSON;
|
|
6
|
-
expectedChallenge: string | ((challenge: string) => boolean);
|
|
6
|
+
expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>);
|
|
7
7
|
expectedOrigin: string | string[];
|
|
8
8
|
expectedRPID?: string | string[];
|
|
9
9
|
requireUserVerification?: boolean;
|
|
@@ -54,7 +54,7 @@ export async function verifyRegistrationResponse(options) {
|
|
|
54
54
|
}
|
|
55
55
|
// Ensure the device provided the challenge we gave it
|
|
56
56
|
if (typeof expectedChallenge === 'function') {
|
|
57
|
-
if (!expectedChallenge(challenge)) {
|
|
57
|
+
if (!(await expectedChallenge(challenge))) {
|
|
58
58
|
throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
|
|
59
59
|
}
|
|
60
60
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"module": "./esm/index.js",
|
|
3
3
|
"main": "./script/index.js",
|
|
4
4
|
"name": "@simplewebauthn/server",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.1.0",
|
|
6
6
|
"description": "SimpleWebAuthn for Servers",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "Matthew Miller <matthew@millerti.me>",
|
|
@@ -60,5 +60,13 @@
|
|
|
60
60
|
"cbor-x": "^1.5.2",
|
|
61
61
|
"cross-fetch": "^4.0.0",
|
|
62
62
|
"debug": "^4.3.4"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^18.11.9",
|
|
66
|
+
"picocolors": "^1.0.0",
|
|
67
|
+
"@deno/shim-deno-test": "~0.4.0"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"test": "node test_runner.js"
|
|
63
71
|
}
|
|
64
72
|
}
|
|
@@ -2,7 +2,7 @@ import type { AuthenticationResponseJSON, AuthenticatorDevice, CredentialDeviceT
|
|
|
2
2
|
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
3
3
|
export type VerifyAuthenticationResponseOpts = {
|
|
4
4
|
response: AuthenticationResponseJSON;
|
|
5
|
-
expectedChallenge: string | ((challenge: string) => boolean);
|
|
5
|
+
expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>);
|
|
6
6
|
expectedOrigin: string | string[];
|
|
7
7
|
expectedRPID: string | string[];
|
|
8
8
|
authenticator: AuthenticatorDevice;
|
|
@@ -56,7 +56,7 @@ async function verifyAuthenticationResponse(options) {
|
|
|
56
56
|
}
|
|
57
57
|
// Ensure the device provided the challenge we gave it
|
|
58
58
|
if (typeof expectedChallenge === 'function') {
|
|
59
|
-
if (!expectedChallenge(challenge)) {
|
|
59
|
+
if (!(await expectedChallenge(challenge))) {
|
|
60
60
|
throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.getWebCrypto = void 0;
|
|
4
27
|
let webCrypto = undefined;
|
|
@@ -16,7 +39,7 @@ async function getWebCrypto() {
|
|
|
16
39
|
*/
|
|
17
40
|
// @ts-ignore: We'll handle any errors...
|
|
18
41
|
// dnt-shim-ignore
|
|
19
|
-
const _crypto = await require('
|
|
42
|
+
const _crypto = await Promise.resolve().then(() => __importStar(require('crypto')));
|
|
20
43
|
webCrypto = _crypto.webcrypto;
|
|
21
44
|
}
|
|
22
45
|
catch (_err) {
|
|
@@ -3,7 +3,7 @@ import { AttestationFormat, AttestationStatement } from '../helpers/decodeAttest
|
|
|
3
3
|
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
4
4
|
export type VerifyRegistrationResponseOpts = {
|
|
5
5
|
response: RegistrationResponseJSON;
|
|
6
|
-
expectedChallenge: string | ((challenge: string) => boolean);
|
|
6
|
+
expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>);
|
|
7
7
|
expectedOrigin: string | string[];
|
|
8
8
|
expectedRPID?: string | string[];
|
|
9
9
|
requireUserVerification?: boolean;
|
|
@@ -57,7 +57,7 @@ async function verifyRegistrationResponse(options) {
|
|
|
57
57
|
}
|
|
58
58
|
// Ensure the device provided the challenge we gave it
|
|
59
59
|
if (typeof expectedChallenge === 'function') {
|
|
60
|
-
if (!expectedChallenge(challenge)) {
|
|
60
|
+
if (!(await expectedChallenge(challenge))) {
|
|
61
61
|
throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
|
|
62
62
|
}
|
|
63
63
|
}
|