@simplewebauthn/server 8.0.0-alpha.0 → 8.0.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.
- package/README.md +15 -6
- package/esm/deps.d.ts +1 -0
- package/esm/deps.js +2 -0
- package/esm/helpers/iso/isoBase64URL.js +1 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +1 -1
- package/package.json +13 -2
- package/script/deps.d.ts +1 -0
- package/script/deps.js +4 -1
- package/script/helpers/iso/isoBase64URL.js +9 -12
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +24 -1
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
|

|
|
6
4
|
[](https://www.npmjs.com/package/@simplewebauthn/server)
|
|
7
|
-

|
|
8
|
-

|
|
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
|
-
|
|
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
|
@@ -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) {
|
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.
|
|
5
|
+
"version": "8.0.1",
|
|
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,10 +55,18 @@
|
|
|
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
|
|
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",
|
|
59
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"
|
|
60
71
|
}
|
|
61
72
|
}
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
37
|
-
const toBase64 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
65
|
+
return deps_js_1.base64.validate(input, true);
|
|
69
66
|
}
|
|
70
67
|
exports.isBase64url = isBase64url;
|
|
@@ -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) {
|