@simplewebauthn/server 8.0.0-alpha.0 → 8.0.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/README.md CHANGED
@@ -1,24 +1,33 @@
1
- <!-- omit in toc -->
2
-
3
- # @simplewebauthn/server
1
+ # @simplewebauthn/server <!-- omit in toc -->
4
2
 
5
3
  ![WebAuthn](https://img.shields.io/badge/WebAuthn-Simplified-blueviolet?style=for-the-badge&logo=WebAuthn)
6
4
  [![npm (scoped)](https://img.shields.io/npm/v/@simplewebauthn/server?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@simplewebauthn/server)
7
- ![node-lts (scoped)](https://img.shields.io/node/v/@simplewebauthn/server?style=for-the-badge&logo=Node.js)
8
- ![typescript minimum version 4.4](https://img.shields.io/badge/TypeScript-%3E%3D_4.4-3178C6?style=for-the-badge&logo=TypeScript)
9
5
 
10
6
  - [Installation](#installation)
7
+ - [Node LTS 16.x or higher](#node-lts-16x-or-higher)
8
+ - [Deno v1.33.x or higher](#deno-v133x-or-higher)
11
9
  - [Usage](#usage)
12
10
  - [Supported Attestation Formats](#supported-attestation-formats)
13
11
 
14
12
  ## Installation
15
13
 
16
- This package is available on **npm**:
14
+ ### Node LTS 16.x or higher
15
+
16
+ This package is available on **npm** and supports **both CommonJS and
17
+ [ECMAScript modules (ESM)](https://nodejs.org/api/esm.html#enabling)** projects:
17
18
 
18
19
  ```sh
19
20
  npm install @simplewebauthn/server
20
21
  ```
21
22
 
23
+ ### Deno v1.33.x or higher
24
+
25
+ It is also available for import into Deno projects from **deno.land/x**:
26
+
27
+ ```ts
28
+ import {...} from 'https://deno.land/x/simplewebauthn/deno/server.ts';
29
+ ```
30
+
22
31
  ## Usage
23
32
 
24
33
  You can find in-depth documentation on this package here:
package/esm/deps.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationResponseJSON, AuthenticatorDevice, AuthenticatorSelectionCriteria, Base64URLString, COSEAlgorithmIdentifier, CredentialDeviceType, Crypto, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorFuture, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON, UserVerificationRequirement, } from '@simplewebauthn/typescript-types';
2
2
  export * as cborx from 'cbor-x';
3
+ export { default as base64 } from '@hexagon/base64';
3
4
  export { fetch as crossFetch } from 'cross-fetch';
4
5
  export { default as debug } from 'debug';
5
6
  export type { Debugger } from '@types/debug';
package/esm/deps.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // cbor (a.k.a. cbor-x in Node land)
2
2
  export * as cborx from 'cbor-x';
3
+ // b64 (a.k.a. @hexagon/base64 in Node land)
4
+ export { default as base64 } from '@hexagon/base64';
3
5
  // cross-fetch
4
6
  export { fetch as crossFetch } from 'cross-fetch';
5
7
  // debug
@@ -1,4 +1,4 @@
1
- import base64 from '@hexagon/base64';
1
+ import { base64 } from '../../deps.js';
2
2
  /**
3
3
  * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
4
4
  * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
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.0-alpha.0",
5
+ "version": "8.0.0",
6
6
  "description": "SimpleWebAuthn for Servers",
7
7
  "license": "MIT",
8
8
  "author": "Matthew Miller <matthew@millerti.me>",
@@ -15,6 +15,9 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
+ "engines": {
19
+ "node": ">=16.0.0"
20
+ },
18
21
  "bugs": {
19
22
  "url": "https://github.com/MasterKale/SimpleWebAuthn/issues"
20
23
  },
@@ -52,7 +55,7 @@
52
55
  "@peculiar/asn1-rsa": "^2.3.6",
53
56
  "@peculiar/asn1-schema": "^2.3.6",
54
57
  "@peculiar/asn1-x509": "^2.3.6",
55
- "@simplewebauthn/typescript-types": "^8.0.0-alpha.0",
58
+ "@simplewebauthn/typescript-types": "^8.0.0",
56
59
  "@types/debug": "^4.1.8",
57
60
  "cbor-x": "^1.5.2",
58
61
  "cross-fetch": "^4.0.0",
package/script/deps.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationResponseJSON, AuthenticatorDevice, AuthenticatorSelectionCriteria, Base64URLString, COSEAlgorithmIdentifier, CredentialDeviceType, Crypto, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorFuture, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON, UserVerificationRequirement, } from '@simplewebauthn/typescript-types';
2
2
  export * as cborx from 'cbor-x';
3
+ export { default as base64 } from '@hexagon/base64';
3
4
  export { fetch as crossFetch } from 'cross-fetch';
4
5
  export { default as debug } from 'debug';
5
6
  export type { Debugger } from '@types/debug';
package/script/deps.js CHANGED
@@ -26,9 +26,12 @@ 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.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.debug = 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
+ // b64 (a.k.a. @hexagon/base64 in Node land)
33
+ var base64_1 = require("@hexagon/base64");
34
+ Object.defineProperty(exports, "base64", { enumerable: true, get: function () { return __importDefault(base64_1).default; } });
32
35
  // cross-fetch
33
36
  var cross_fetch_1 = require("cross-fetch");
34
37
  Object.defineProperty(exports, "crossFetch", { enumerable: true, get: function () { return cross_fetch_1.fetch; } });
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.isBase64url = exports.isBase64 = exports.toString = exports.fromString = exports.toBase64 = exports.fromBuffer = exports.toBuffer = void 0;
7
- const base64_1 = __importDefault(require("@hexagon/base64"));
4
+ const deps_js_1 = require("../../deps.js");
8
5
  /**
9
6
  * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
10
7
  * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
@@ -14,7 +11,7 @@ const base64_1 = __importDefault(require("@hexagon/base64"));
14
11
  * @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
15
12
  */
16
13
  function toBuffer(base64urlString, from = 'base64url') {
17
- const _buffer = base64_1.default.toArrayBuffer(base64urlString, from === 'base64url');
14
+ const _buffer = deps_js_1.base64.toArrayBuffer(base64urlString, from === 'base64url');
18
15
  return new Uint8Array(_buffer);
19
16
  }
20
17
  exports.toBuffer = toBuffer;
@@ -26,15 +23,15 @@ exports.toBuffer = toBuffer;
26
23
  * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
27
24
  */
28
25
  function fromBuffer(buffer, to = 'base64url') {
29
- return base64_1.default.fromArrayBuffer(buffer, to === 'base64url');
26
+ return deps_js_1.base64.fromArrayBuffer(buffer, to === 'base64url');
30
27
  }
31
28
  exports.fromBuffer = fromBuffer;
32
29
  /**
33
30
  * Convert a base64url string into base64
34
31
  */
35
32
  function toBase64(base64urlString) {
36
- const fromBase64Url = base64_1.default.toArrayBuffer(base64urlString, true);
37
- const toBase64 = base64_1.default.fromArrayBuffer(fromBase64Url);
33
+ const fromBase64Url = deps_js_1.base64.toArrayBuffer(base64urlString, true);
34
+ const toBase64 = deps_js_1.base64.fromArrayBuffer(fromBase64Url);
38
35
  return toBase64;
39
36
  }
40
37
  exports.toBase64 = toBase64;
@@ -42,21 +39,21 @@ exports.toBase64 = toBase64;
42
39
  * Encode a string to base64url
43
40
  */
44
41
  function fromString(ascii) {
45
- return base64_1.default.fromString(ascii, true);
42
+ return deps_js_1.base64.fromString(ascii, true);
46
43
  }
47
44
  exports.fromString = fromString;
48
45
  /**
49
46
  * Decode a base64url string into its original string
50
47
  */
51
48
  function toString(base64urlString) {
52
- return base64_1.default.toString(base64urlString, true);
49
+ return deps_js_1.base64.toString(base64urlString, true);
53
50
  }
54
51
  exports.toString = toString;
55
52
  /**
56
53
  * Confirm that the string is encoded into base64
57
54
  */
58
55
  function isBase64(input) {
59
- return base64_1.default.validate(input, false);
56
+ return deps_js_1.base64.validate(input, false);
60
57
  }
61
58
  exports.isBase64 = isBase64;
62
59
  /**
@@ -65,6 +62,6 @@ exports.isBase64 = isBase64;
65
62
  function isBase64url(input) {
66
63
  // Trim padding characters from the string if present
67
64
  input = input.replace(/=/g, '');
68
- return base64_1.default.validate(input, true);
65
+ return deps_js_1.base64.validate(input, true);
69
66
  }
70
67
  exports.isBase64url = isBase64url;