diff options
-rw-r--r-- | package.json | 22 | ||||
-rw-r--r-- | packages/browser/src/methods/startAuthentication.test.ts | 36 | ||||
-rw-r--r-- | packages/browser/src/methods/startRegistration.test.ts | 32 | ||||
-rw-r--r-- | packages/server/package.json | 26 | ||||
-rw-r--r-- | tsconfigdoc.json | 3 | ||||
-rw-r--r-- | typedoc-plugin-external-module-name/README.md | 21 | ||||
-rw-r--r-- | typedoc-plugin-external-module-name/index.js | 22 |
7 files changed, 44 insertions, 118 deletions
diff --git a/package.json b/package.json index 7d1ec18..f407192 100644 --- a/package.json +++ b/package.json @@ -15,24 +15,24 @@ }, "devDependencies": { "@types/express": "^4.17.9", - "@types/jest": "^25.2.3", + "@types/jest": "^27.0.1", "@types/node-fetch": "^2.5.7", "@typescript-eslint/eslint-plugin": "^4.17.0", "@typescript-eslint/parser": "^4.17.0", "eslint": "^7.21.0", - "husky": "^4.3.0", - "jest": "^26.6.3", - "jest-environment-jsdom": "^26.3.0", - "lerna": "^3.22.1", - "lint-staged": "^10.3.0", + "husky": "^7.0.2", + "jest": "^27.0.6", + "jest-environment-jsdom": "^27.0.6", + "lerna": "^4.0.0", + "lint-staged": "^11.1.2", "prettier": "^2.2.1", "rimraf": "^3.0.2", "semver": "^7.3.2", - "ts-jest": "^26.4.4", - "ts-morph": "^9.0.0", - "ts-node": "^8.10.2", - "typedoc": "^0.21.0-beta.4", - "typescript": "^4.0.5" + "ts-jest": "^27.0.5", + "ts-morph": "^11.0.3", + "ts-node": "^10.2.1", + "typedoc": "^0.21.6", + "typescript": "^4.3.5" }, "husky": { "hooks": { diff --git a/packages/browser/src/methods/startAuthentication.test.ts b/packages/browser/src/methods/startAuthentication.test.ts index 5e74789..2e455d6 100644 --- a/packages/browser/src/methods/startAuthentication.test.ts +++ b/packages/browser/src/methods/startAuthentication.test.ts @@ -60,7 +60,7 @@ afterEach(() => { mockSupportsWebauthn.mockReset(); }); -test('should convert options before passing to navigator.credentials.get(...)', async done => { +test('should convert options before passing to navigator.credentials.get(...)', async () => { await startAuthentication(goodOpts1); const argsPublicKey = mockNavigatorGet.mock.calls[0][0].publicKey; @@ -70,8 +70,6 @@ test('should convert options before passing to navigator.credentials.get(...)', // Make sure the credential ID is an ArrayBuffer with a length of 64 expect(credId instanceof ArrayBuffer).toEqual(true); expect(credId.byteLength).toEqual(64); - - done(); }); test('should support optional allowCredential', async () => { @@ -92,7 +90,7 @@ test('should convert allow allowCredential to undefined when empty', async () => expect(mockNavigatorGet.mock.calls[0][0].allowCredentials).toEqual(undefined); }); -test('should return base64url-encoded response values', async done => { +test('should return base64url-encoded response values', async () => { mockNavigatorGet.mockImplementation((): Promise<AuthenticationCredential> => { return new Promise(resolve => { resolve({ @@ -117,21 +115,17 @@ test('should return base64url-encoded response values', async done => { expect(response.response.clientDataJSON).toEqual('bW9ja0NsaWVudERhdGFKU09O'); expect(response.response.signature).toEqual('bW9ja1NpZ25hdHVyZQ'); expect(response.response.userHandle).toEqual('mockUserHandle'); - - done(); }); -test("should throw error if WebAuthn isn't supported", async done => { +test("should throw error if WebAuthn isn't supported", async () => { mockSupportsWebauthn.mockReturnValue(false); await expect(startAuthentication(goodOpts1)).rejects.toThrow( 'WebAuthn is not supported in this browser', ); - - done(); }); -test('should throw error if assertion is cancelled for some reason', async done => { +test('should throw error if assertion is cancelled for some reason', async () => { mockNavigatorGet.mockImplementation((): Promise<null> => { return new Promise(resolve => { resolve(null); @@ -139,11 +133,9 @@ test('should throw error if assertion is cancelled for some reason', async done }); await expect(startAuthentication(goodOpts1)).rejects.toThrow('Authentication was not completed'); - - done(); }); -test('should handle UTF-8 challenges', async done => { +test('should handle UTF-8 challenges', async () => { await startAuthentication(goodOpts2UTF8); const argsPublicKey = mockNavigatorGet.mock.calls[0][0].publicKey; @@ -153,11 +145,9 @@ test('should handle UTF-8 challenges', async done => { 227, 130, 132, 227, 130, 140, 227, 130, 132, 227, 130, 140, 227, 129, 160, 227, 129, 156, ]), ); - - done(); }); -test('should send extensions to authenticator if present in options', async done => { +test('should send extensions to authenticator if present in options', async () => { const extensions: AuthenticationExtensionsClientInputs = { credProps: true, appid: 'appidHere', @@ -173,21 +163,17 @@ test('should send extensions to authenticator if present in options', async done const argsExtensions = mockNavigatorGet.mock.calls[0][0].publicKey.extensions; expect(argsExtensions).toEqual(extensions); - - done(); }); -test('should not set any extensions if not present in options', async done => { +test('should not set any extensions if not present in options', async () => { await startAuthentication(goodOpts1); const argsExtensions = mockNavigatorGet.mock.calls[0][0].publicKey.extensions; expect(argsExtensions).toEqual(undefined); - - done(); }); -test('should include extension results', async done => { +test('should include extension results', async () => { const extResults: AuthenticationExtensionsClientOutputs = { appid: true, credProps: { @@ -206,14 +192,10 @@ test('should include extension results', async done => { const response = await startAuthentication(goodOpts1); expect(response.clientExtensionResults).toEqual(extResults); - - done(); }); -test('should include extension results when no extensions specified', async done => { +test('should include extension results when no extensions specified', async () => { const response = await startAuthentication(goodOpts1); expect(response.clientExtensionResults).toEqual({}); - - done(); }); diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts index e11718e..76a01fb 100644 --- a/packages/browser/src/methods/startRegistration.test.ts +++ b/packages/browser/src/methods/startRegistration.test.ts @@ -63,7 +63,7 @@ afterEach(() => { mockSupportsWebauthn.mockReset(); }); -test('should convert options before passing to navigator.credentials.create(...)', async done => { +test('should convert options before passing to navigator.credentials.create(...)', async () => { await startRegistration(goodOpts1); const argsPublicKey = mockNavigatorCreate.mock.calls[0][0].publicKey; @@ -78,11 +78,9 @@ test('should convert options before passing to navigator.credentials.create(...) expect(credId.byteLength).toEqual(64); expect(argsPublicKey.excludeCredentials[0].type).toEqual('public-key'); expect(argsPublicKey.excludeCredentials[0].transports).toEqual(['internal']); - - done(); }); -test('should return base64url-encoded response values', async done => { +test('should return base64url-encoded response values', async () => { mockNavigatorCreate.mockImplementation((): Promise<RegistrationCredential> => { return new Promise(resolve => { resolve({ @@ -103,21 +101,17 @@ test('should return base64url-encoded response values', async done => { expect(response.rawId).toEqual('Zm9vYmFy'); expect(response.response.attestationObject).toEqual('bW9ja0F0dGU'); expect(response.response.clientDataJSON).toEqual('bW9ja0NsaWU'); - - done(); }); -test("should throw error if WebAuthn isn't supported", async done => { +test("should throw error if WebAuthn isn't supported", async () => { mockSupportsWebauthn.mockReturnValue(false); await expect(startRegistration(goodOpts1)).rejects.toThrow( 'WebAuthn is not supported in this browser', ); - - done(); }); -test('should throw error if attestation is cancelled for some reason', async done => { +test('should throw error if attestation is cancelled for some reason', async () => { mockNavigatorCreate.mockImplementation((): Promise<null> => { return new Promise(resolve => { resolve(null); @@ -125,11 +119,9 @@ test('should throw error if attestation is cancelled for some reason', async don }); await expect(startRegistration(goodOpts1)).rejects.toThrow('Registration was not completed'); - - done(); }); -test('should send extensions to authenticator if present in options', async done => { +test('should send extensions to authenticator if present in options', async () => { const extensions: AuthenticationExtensionsClientInputs = { credProps: true, appid: 'appidHere', @@ -145,21 +137,17 @@ test('should send extensions to authenticator if present in options', async done const argsExtensions = mockNavigatorCreate.mock.calls[0][0].publicKey.extensions; expect(argsExtensions).toEqual(extensions); - - done(); }); -test('should not set any extensions if not present in options', async done => { +test('should not set any extensions if not present in options', async () => { await startRegistration(goodOpts1); const argsExtensions = mockNavigatorCreate.mock.calls[0][0].publicKey.extensions; expect(argsExtensions).toEqual(undefined); - - done(); }); -test('should include extension results', async done => { +test('should include extension results', async () => { const extResults: AuthenticationExtensionsClientOutputs = { appid: true, credProps: { @@ -178,14 +166,10 @@ test('should include extension results', async done => { const response = await startRegistration(goodOpts1); expect(response.clientExtensionResults).toEqual(extResults); - - done(); }); -test('should include extension results when no extensions specified', async done => { +test('should include extension results when no extensions specified', async () => { const response = await startRegistration(goodOpts1); expect(response.clientExtensionResults).toEqual({}); - - done(); }); diff --git a/packages/server/package.json b/packages/server/package.json index 7b193ad..1b00b8c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -10,8 +10,12 @@ }, "typesVersions": { "*": { - "./dist/index.d.ts": [ "./dist/index.d.ts" ], - "helpers": [ "./dist/helpers/index.d.ts" ] + "./dist/index.d.ts": [ + "./dist/index.d.ts" + ], + "helpers": [ + "./dist/helpers/index.d.ts" + ] } }, "author": "Matthew Miller <matthew@millerti.me>", @@ -42,14 +46,14 @@ "node" ], "dependencies": { - "@peculiar/asn1-android": "^2.0.26", - "@peculiar/asn1-schema": "^2.0.26", - "@peculiar/asn1-x509": "^2.0.26", + "@peculiar/asn1-android": "^2.0.38", + "@peculiar/asn1-schema": "^2.0.38", + "@peculiar/asn1-x509": "^2.0.38", "@simplewebauthn/typescript-types": "file:../typescript-types", "base64url": "^3.0.1", "cbor": "^5.1.0", "elliptic": "^6.5.3", - "jsrsasign": "^10.2.0", + "jsrsasign": "^10.4.0", "jwk-to-pem": "^2.0.4", "node-fetch": "^2.6.0", "node-rsa": "^1.1.1" @@ -57,10 +61,10 @@ "gitHead": "33ccf8c6c9add811c87d3089e24156c2342b3498", "devDependencies": { "@types/cbor": "^5.0.1", - "@types/elliptic": "^6.4.12", - "@types/jsrsasign": "^8.0.11", - "@types/jwk-to-pem": "^2.0.0", - "@types/node-fetch": "^2.5.7", - "@types/node-rsa": "^1.0.0" + "@types/elliptic": "^6.4.13", + "@types/jsrsasign": "^8.0.13", + "@types/jwk-to-pem": "^2.0.1", + "@types/node-fetch": "^2.5.12", + "@types/node-rsa": "^1.1.1" } } diff --git a/tsconfigdoc.json b/tsconfigdoc.json index 17338e2..0fc1bd0 100644 --- a/tsconfigdoc.json +++ b/tsconfigdoc.json @@ -20,7 +20,6 @@ "readme": "./DOCS.md", "name": "@SimpleWebAuthn", "excludeExternals": true, - "excludePrivate": true, - "plugin": ["./typedoc-plugin-external-module-name"] + "excludePrivate": true } } diff --git a/typedoc-plugin-external-module-name/README.md b/typedoc-plugin-external-module-name/README.md deleted file mode 100644 index 32d3f5f..0000000 --- a/typedoc-plugin-external-module-name/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# ATTENTION - -This folder contains a slightly-modified version of `typedoc-plugin-external-module-name@3.1.0` - -This folder exists because of a perfect storm of issues with TypeDoc package versioning: - -I'm using `typedoc@next` because it's the only version of TypeDoc that supports "--mode library" (see https://github.com/TypeStrong/typedoc/pull/1184), which is capable of generating awesome documentation despite this being a more complex monorepo project. - -The **typedoc-plugin-external-module-name** plugin (see https://github.com/christopherthielen/typedoc-plugin-external-module-name) was incorporated because it made it easy to rename package names in the docs to follow an easier-to-read naming convention versus what TypeDoc was generating. - -The original plugin as available on NPM is written with branching logic in `typedocVersionCompatibility.js > removeTags()` that checks for TypeDoc's version to be able to support removing tags from comments in a backwards-compatible manner. - -`typedoc@next` is version `0.17.0-3`, which semver coerces to "0.17.0". This causes `removeTags()` to throw an error saying: - -``` -TypeError: comment.removeTags is not a function -``` - -**The reality is that this version of TypeDoc is actually still a 0.16.x version of the library**, so this plugin fails because `removeTags()` isn't available on `comment`'s available will 0.17.0. - -To get docs hosting working, I've decided to temporarily host a modified version of this plugin in this repo until TypeDoc gets proper support for a "library" rendering mode. [It's pretty high up the priority list for whenever v0.18.0 drops](https://github.com/TypeStrong/typedoc/issues/1266) so hopefully this won't have to stick around for long... diff --git a/typedoc-plugin-external-module-name/index.js b/typedoc-plugin-external-module-name/index.js deleted file mode 100644 index d59e36c..0000000 --- a/typedoc-plugin-external-module-name/index.js +++ /dev/null @@ -1,22 +0,0 @@ -//@ts-check - -/* eslint-disable @typescript-eslint/no-var-requires */ -const { ReflectionKind } = require('typedoc'); -const { Converter } = require('typedoc/dist/lib/converter'); - -/** @param {import("typedoc/dist/lib/utils/plugins").PluginHost} host */ -exports.load = function (host) { - host.application.converter.on(Converter.EVENT_RESOLVE_BEGIN, context => { - /** @type {import("typedoc").ProjectReflection} */ - const project = context.project; - - for (const mod of (project.children || []).filter( - child => child.kind === ReflectionKind.Module, - )) { - const tag = mod.comment ? mod.comment.getTag('module') : void 0; - if (!tag) continue; - mod.name = tag.text; - mod.comment.removeTags('module'); - } - }); -}; |