@simplewebauthn/server 8.0.1 → 8.1.1

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.
@@ -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
  }
package/esm/deps.d.ts CHANGED
@@ -2,8 +2,6 @@ export type { AttestationConveyancePreference, AuthenticationExtensionsClientInp
2
2
  export * as cborx from 'cbor-x';
3
3
  export { default as base64 } from '@hexagon/base64';
4
4
  export { fetch as crossFetch } from 'cross-fetch';
5
- export { default as debug } from 'debug';
6
- export type { Debugger } from '@types/debug';
7
5
  export { AsnParser, AsnSerializer } from '@peculiar/asn1-schema';
8
6
  export { AuthorityKeyIdentifier, BasicConstraints, Certificate, CertificateList, CRLDistributionPoints, ExtendedKeyUsage, id_ce_authorityKeyIdentifier, id_ce_basicConstraints, id_ce_cRLDistributionPoints, id_ce_extKeyUsage, id_ce_subjectAltName, id_ce_subjectKeyIdentifier, Name, SubjectAlternativeName, SubjectKeyIdentifier, } from '@peculiar/asn1-x509';
9
7
  export { ECDSASigValue, ECParameters, id_ecPublicKey, id_secp256r1, id_secp384r1, } from '@peculiar/asn1-ecc';
package/esm/deps.js CHANGED
@@ -4,8 +4,6 @@ export * as cborx from 'cbor-x';
4
4
  export { default as base64 } from '@hexagon/base64';
5
5
  // cross-fetch
6
6
  export { fetch as crossFetch } from 'cross-fetch';
7
- // debug
8
- export { default as debug } from 'debug';
9
7
  // @peculiar libraries
10
8
  export { AsnParser, AsnSerializer } from '@peculiar/asn1-schema';
11
9
  export { AuthorityKeyIdentifier, BasicConstraints, Certificate, CertificateList, CRLDistributionPoints, ExtendedKeyUsage, id_ce_authorityKeyIdentifier, id_ce_basicConstraints, id_ce_cRLDistributionPoints, id_ce_extKeyUsage, id_ce_subjectAltName, id_ce_subjectKeyIdentifier, Name, SubjectAlternativeName, SubjectKeyIdentifier, } from '@peculiar/asn1-x509';
@@ -1,4 +1,3 @@
1
- import { Debugger } from '../deps.js';
2
1
  /**
3
2
  * Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
4
3
  * consistent naming.
@@ -13,4 +12,4 @@ import { Debugger } from '../deps.js';
13
12
  * log('hello'); // simplewebauthn:mds hello +0ms
14
13
  * ```
15
14
  */
16
- export declare function getLogger(name: string): Debugger;
15
+ export declare function getLogger(_name: string): (message: string, ..._rest: unknown[]) => void;
@@ -1,5 +1,5 @@
1
- import { debug } from '../deps.js';
2
- const defaultLogger = debug('SimpleWebAuthn');
1
+ // import { debug, Debugger } from '../deps.ts';
2
+ // const defaultLogger = debug('SimpleWebAuthn');
3
3
  /**
4
4
  * Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
5
5
  * consistent naming.
@@ -14,6 +14,7 @@ const defaultLogger = debug('SimpleWebAuthn');
14
14
  * log('hello'); // simplewebauthn:mds hello +0ms
15
15
  * ```
16
16
  */
17
- export function getLogger(name) {
18
- return defaultLogger.extend(name);
17
+ export function getLogger(_name) {
18
+ // This is a noop for now while I search for a better debug logger technique
19
+ return (_message, ..._rest) => { };
19
20
  }
@@ -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.0.1",
5
+ "version": "8.1.1",
6
6
  "description": "SimpleWebAuthn for Servers",
7
7
  "license": "MIT",
8
8
  "author": "Matthew Miller <matthew@millerti.me>",
@@ -56,10 +56,8 @@
56
56
  "@peculiar/asn1-schema": "^2.3.6",
57
57
  "@peculiar/asn1-x509": "^2.3.6",
58
58
  "@simplewebauthn/typescript-types": "^8.0.0",
59
- "@types/debug": "^4.1.8",
60
59
  "cbor-x": "^1.5.2",
61
- "cross-fetch": "^4.0.0",
62
- "debug": "^4.3.4"
60
+ "cross-fetch": "^4.0.0"
63
61
  },
64
62
  "devDependencies": {
65
63
  "@types/node": "^18.11.9",
@@ -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
  }
package/script/deps.d.ts CHANGED
@@ -2,8 +2,6 @@ export type { AttestationConveyancePreference, AuthenticationExtensionsClientInp
2
2
  export * as cborx from 'cbor-x';
3
3
  export { default as base64 } from '@hexagon/base64';
4
4
  export { fetch as crossFetch } from 'cross-fetch';
5
- export { default as debug } from 'debug';
6
- export type { Debugger } from '@types/debug';
7
5
  export { AsnParser, AsnSerializer } from '@peculiar/asn1-schema';
8
6
  export { AuthorityKeyIdentifier, BasicConstraints, Certificate, CertificateList, CRLDistributionPoints, ExtendedKeyUsage, id_ce_authorityKeyIdentifier, id_ce_basicConstraints, id_ce_cRLDistributionPoints, id_ce_extKeyUsage, id_ce_subjectAltName, id_ce_subjectKeyIdentifier, Name, SubjectAlternativeName, SubjectKeyIdentifier, } from '@peculiar/asn1-x509';
9
7
  export { ECDSASigValue, ECParameters, id_ecPublicKey, id_secp256r1, id_secp384r1, } from '@peculiar/asn1-ecc';
package/script/deps.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.KeyDescription = exports.id_ce_keyDescription = exports.RSAPublicKey = exports.id_secp384r1 = exports.id_secp256r1 = exports.id_ecPublicKey = exports.ECParameters = exports.ECDSASigValue = exports.SubjectKeyIdentifier = exports.SubjectAlternativeName = exports.Name = exports.id_ce_subjectKeyIdentifier = exports.id_ce_subjectAltName = exports.id_ce_extKeyUsage = exports.id_ce_cRLDistributionPoints = exports.id_ce_basicConstraints = exports.id_ce_authorityKeyIdentifier = exports.ExtendedKeyUsage = exports.CRLDistributionPoints = exports.CertificateList = exports.Certificate = exports.BasicConstraints = exports.AuthorityKeyIdentifier = exports.AsnSerializer = exports.AsnParser = exports.debug = exports.crossFetch = exports.base64 = exports.cborx = void 0;
29
+ exports.KeyDescription = exports.id_ce_keyDescription = exports.RSAPublicKey = exports.id_secp384r1 = exports.id_secp256r1 = exports.id_ecPublicKey = exports.ECParameters = exports.ECDSASigValue = exports.SubjectKeyIdentifier = exports.SubjectAlternativeName = exports.Name = exports.id_ce_subjectKeyIdentifier = exports.id_ce_subjectAltName = exports.id_ce_extKeyUsage = exports.id_ce_cRLDistributionPoints = exports.id_ce_basicConstraints = exports.id_ce_authorityKeyIdentifier = exports.ExtendedKeyUsage = exports.CRLDistributionPoints = exports.CertificateList = exports.Certificate = exports.BasicConstraints = exports.AuthorityKeyIdentifier = exports.AsnSerializer = exports.AsnParser = exports.crossFetch = exports.base64 = exports.cborx = void 0;
30
30
  // cbor (a.k.a. cbor-x in Node land)
31
31
  exports.cborx = __importStar(require("cbor-x"));
32
32
  // b64 (a.k.a. @hexagon/base64 in Node land)
@@ -35,9 +35,6 @@ Object.defineProperty(exports, "base64", { enumerable: true, get: function () {
35
35
  // cross-fetch
36
36
  var cross_fetch_1 = require("cross-fetch");
37
37
  Object.defineProperty(exports, "crossFetch", { enumerable: true, get: function () { return cross_fetch_1.fetch; } });
38
- // debug
39
- var debug_1 = require("debug");
40
- Object.defineProperty(exports, "debug", { enumerable: true, get: function () { return __importDefault(debug_1).default; } });
41
38
  // @peculiar libraries
42
39
  var asn1_schema_1 = require("@peculiar/asn1-schema");
43
40
  Object.defineProperty(exports, "AsnParser", { enumerable: true, get: function () { return asn1_schema_1.AsnParser; } });
@@ -1,5 +1,3 @@
1
- /// <reference types="debug" />
2
- import { Debugger } from '../deps.js';
3
1
  /**
4
2
  * Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
5
3
  * consistent naming.
@@ -14,4 +12,4 @@ import { Debugger } from '../deps.js';
14
12
  * log('hello'); // simplewebauthn:mds hello +0ms
15
13
  * ```
16
14
  */
17
- export declare function getLogger(name: string): Debugger;
15
+ export declare function getLogger(_name: string): (message: string, ..._rest: unknown[]) => void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
+ // import { debug, Debugger } from '../deps.ts';
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.getLogger = void 0;
4
- const deps_js_1 = require("../deps.js");
5
- const defaultLogger = (0, deps_js_1.debug)('SimpleWebAuthn');
5
+ // const defaultLogger = debug('SimpleWebAuthn');
6
6
  /**
7
7
  * Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
8
8
  * consistent naming.
@@ -17,7 +17,8 @@ const defaultLogger = (0, deps_js_1.debug)('SimpleWebAuthn');
17
17
  * log('hello'); // simplewebauthn:mds hello +0ms
18
18
  * ```
19
19
  */
20
- function getLogger(name) {
21
- return defaultLogger.extend(name);
20
+ function getLogger(_name) {
21
+ // This is a noop for now while I search for a better debug logger technique
22
+ return (_message, ..._rest) => { };
22
23
  }
23
24
  exports.getLogger = getLogger;
@@ -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
  }