summaryrefslogtreecommitdiffhomepage
path: root/packages/typescript-types
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2024-01-20 21:10:44 -0800
committerMatthew Miller <matthew@millerti.me>2024-01-20 21:10:52 -0800
commitdc65ac8374da2dbb9ca78a3738a7c022c4ad8e1f (patch)
tree2dee906ee653b9341ffbc3e409e762cb9832afe2 /packages/typescript-types
parentbd8ad1703aca6a3e76a6278df4e40fafeb8fcd76 (diff)
Move typescript-types/ to types/
Diffstat (limited to 'packages/typescript-types')
-rw-r--r--packages/typescript-types/.npmignore7
-rw-r--r--packages/typescript-types/LICENSE.md18
-rw-r--r--packages/typescript-types/README.md28
-rw-r--r--packages/typescript-types/build_npm.ts50
-rw-r--r--packages/typescript-types/deno.jsonc5
-rw-r--r--packages/typescript-types/deno.lock92
-rw-r--r--packages/typescript-types/extract-dom-types.ts104
-rw-r--r--packages/typescript-types/package.json17
-rw-r--r--packages/typescript-types/src/dom.ts357
-rw-r--r--packages/typescript-types/src/index.ts257
10 files changed, 0 insertions, 935 deletions
diff --git a/packages/typescript-types/.npmignore b/packages/typescript-types/.npmignore
deleted file mode 100644
index d2360e9..0000000
--- a/packages/typescript-types/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-src
-node_modules
-coverage
-.gitignore
-tsconfig.json
-*.config.js
-__mocks__
diff --git a/packages/typescript-types/LICENSE.md b/packages/typescript-types/LICENSE.md
deleted file mode 100644
index adb1965..0000000
--- a/packages/typescript-types/LICENSE.md
+++ /dev/null
@@ -1,18 +0,0 @@
-MIT License
-
-Copyright (c) 2020 Matthew Miller
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
-associated documentation files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
-OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/typescript-types/README.md b/packages/typescript-types/README.md
deleted file mode 100644
index 2220d02..0000000
--- a/packages/typescript-types/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# @simplewebauthn/typescript-types <!-- omit in toc -->
-
-![WebAuthn](https://img.shields.io/badge/WebAuthn-Simplified-blueviolet?style=for-the-badge&logo=WebAuthn)
-[![npm (scoped)](https://img.shields.io/npm/v/@simplewebauthn/typescript-types?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@simplewebauthn/typescript-types)
-
-TypeScript typings for **@simplewebauthn/server** and **@simplewebauthn/browser**
-
-- [Installation](#installation)
- - [Node LTS 16.x or higher](#node-lts-16x-or-higher)
- - [Deno v1.33.x or higher](#deno-v133x-or-higher)
-
-## Installation
-
-### Node LTS 16.x or higher
-
-This package is available on **npm**:
-
-```sh
-npm install @simplewebauthn/typescript-types
-```
-
-### Deno v1.33.x or higher
-
-It is also available for import into Deno projects from **deno.land/x**:
-
-```ts
-import {...} from 'https://deno.land/x/simplewebauthn/deno/typescript-types.ts';
-```
diff --git a/packages/typescript-types/build_npm.ts b/packages/typescript-types/build_npm.ts
deleted file mode 100644
index 23a970c..0000000
--- a/packages/typescript-types/build_npm.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { build, emptyDir } from 'https://deno.land/x/dnt@0.38.0/mod.ts';
-
-const outDir = './npm';
-const lernaPackageJSON: { version: string } = JSON.parse(
- await Deno.readTextFile('./package.json'),
-);
-
-await emptyDir(outDir);
-
-await build({
- entryPoints: [
- { name: '.', path: './src/index.ts' },
- ],
- outDir,
- shims: {},
- // Keeping declarations in a single types/ directory to mimic the original file structure
- declaration: 'separate',
- test: false,
- // package.json values
- package: {
- name: '@simplewebauthn/typescript-types',
- version: lernaPackageJSON.version,
- description: 'TypeScript types used by the @simplewebauthn series of libraries',
- license: 'MIT',
- author: 'Matthew Miller <matthew@millerti.me>',
- repository: {
- type: 'git',
- url: 'git+https://github.com/MasterKale/SimpleWebAuthn.git',
- directory: 'packages/typescript-types',
- },
- homepage:
- 'https://github.com/MasterKale/SimpleWebAuthn/tree/master/packages/typescript-types#readme',
- publishConfig: {
- access: 'public',
- },
- bugs: {
- url: 'https://github.com/MasterKale/SimpleWebAuthn/issues',
- },
- keywords: [
- 'typescript',
- 'webauthn',
- 'passkeys',
- 'fido',
- 'types',
- ],
- },
-});
-
-Deno.copyFileSync('LICENSE.md', `${outDir}/LICENSE.md`);
-Deno.copyFileSync('README.md', `${outDir}/README.md`);
diff --git a/packages/typescript-types/deno.jsonc b/packages/typescript-types/deno.jsonc
deleted file mode 100644
index df74b36..0000000
--- a/packages/typescript-types/deno.jsonc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "tasks": {
- "build": "deno run -A build_npm.ts"
- }
-}
diff --git a/packages/typescript-types/deno.lock b/packages/typescript-types/deno.lock
deleted file mode 100644
index 2a20d27..0000000
--- a/packages/typescript-types/deno.lock
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "version": "2",
- "remote": {
- "https://deno.land/std@0.140.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74",
- "https://deno.land/std@0.140.0/_util/os.ts": "3b4c6e27febd119d36a416d7a97bd3b0251b77c88942c8f16ee5953ea13e2e49",
- "https://deno.land/std@0.140.0/bytes/bytes_list.ts": "67eb118e0b7891d2f389dad4add35856f4ad5faab46318ff99653456c23b025d",
- "https://deno.land/std@0.140.0/bytes/equals.ts": "fc16dff2090cced02497f16483de123dfa91e591029f985029193dfaa9d894c9",
- "https://deno.land/std@0.140.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf",
- "https://deno.land/std@0.140.0/fmt/colors.ts": "30455035d6d728394781c10755351742dd731e3db6771b1843f9b9e490104d37",
- "https://deno.land/std@0.140.0/fs/_util.ts": "0fb24eb4bfebc2c194fb1afdb42b9c3dda12e368f43e8f2321f84fc77d42cb0f",
- "https://deno.land/std@0.140.0/fs/ensure_dir.ts": "9dc109c27df4098b9fc12d949612ae5c9c7169507660dcf9ad90631833209d9d",
- "https://deno.land/std@0.140.0/hash/sha256.ts": "803846c7a5a8a5a97f31defeb37d72f519086c880837129934f5d6f72102a8e8",
- "https://deno.land/std@0.140.0/io/buffer.ts": "bd0c4bf53db4b4be916ca5963e454bddfd3fcd45039041ea161dbf826817822b",
- "https://deno.land/std@0.140.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3",
- "https://deno.land/std@0.140.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09",
- "https://deno.land/std@0.140.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b",
- "https://deno.land/std@0.140.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633",
- "https://deno.land/std@0.140.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee",
- "https://deno.land/std@0.140.0/path/mod.ts": "d3e68d0abb393fb0bf94a6d07c46ec31dc755b544b13144dee931d8d5f06a52d",
- "https://deno.land/std@0.140.0/path/posix.ts": "293cdaec3ecccec0a9cc2b534302dfe308adb6f10861fa183275d6695faace44",
- "https://deno.land/std@0.140.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9",
- "https://deno.land/std@0.140.0/path/win32.ts": "31811536855e19ba37a999cd8d1b62078235548d67902ece4aa6b814596dd757",
- "https://deno.land/std@0.140.0/streams/conversion.ts": "712585bfa0172a97fb68dd46e784ae8ad59d11b88079d6a4ab098ff42e697d21",
- "https://deno.land/std@0.181.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462",
- "https://deno.land/std@0.181.0/_util/os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3",
- "https://deno.land/std@0.181.0/fs/_util.ts": "65381f341af1ff7f40198cee15c20f59951ac26e51ddc651c5293e24f9ce6f32",
- "https://deno.land/std@0.181.0/fs/ensure_dir.ts": "dc64c4c75c64721d4e3fb681f1382f803ff3d2868f08563ff923fdd20d071c40",
- "https://deno.land/std@0.181.0/fs/expand_glob.ts": "e4f56259a0a70fe23f05215b00de3ac5e6ba46646ab2a06ebbe9b010f81c972a",
- "https://deno.land/std@0.181.0/fs/walk.ts": "ea95ffa6500c1eda6b365be488c056edc7c883a1db41ef46ec3bf057b1c0fe32",
- "https://deno.land/std@0.181.0/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0",
- "https://deno.land/std@0.181.0/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b",
- "https://deno.land/std@0.181.0/path/_util.ts": "d7abb1e0dea065f427b89156e28cdeb32b045870acdf865833ba808a73b576d0",
- "https://deno.land/std@0.181.0/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000",
- "https://deno.land/std@0.181.0/path/glob.ts": "d479e0a695621c94d3fd7fe7abd4f9499caf32a8de13f25073451c6ef420a4e1",
- "https://deno.land/std@0.181.0/path/mod.ts": "bf718f19a4fdd545aee1b06409ca0805bd1b68ecf876605ce632e932fe54510c",
- "https://deno.land/std@0.181.0/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d",
- "https://deno.land/std@0.181.0/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1",
- "https://deno.land/std@0.181.0/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba",
- "https://deno.land/std@0.182.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462",
- "https://deno.land/std@0.182.0/_util/os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3",
- "https://deno.land/std@0.182.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e",
- "https://deno.land/std@0.182.0/fs/_util.ts": "65381f341af1ff7f40198cee15c20f59951ac26e51ddc651c5293e24f9ce6f32",
- "https://deno.land/std@0.182.0/fs/empty_dir.ts": "c3d2da4c7352fab1cf144a1ecfef58090769e8af633678e0f3fabaef98594688",
- "https://deno.land/std@0.182.0/fs/expand_glob.ts": "e4f56259a0a70fe23f05215b00de3ac5e6ba46646ab2a06ebbe9b010f81c972a",
- "https://deno.land/std@0.182.0/fs/walk.ts": "920be35a7376db6c0b5b1caf1486fb962925e38c9825f90367f8f26b5e5d0897",
- "https://deno.land/std@0.182.0/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0",
- "https://deno.land/std@0.182.0/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b",
- "https://deno.land/std@0.182.0/path/_util.ts": "d7abb1e0dea065f427b89156e28cdeb32b045870acdf865833ba808a73b576d0",
- "https://deno.land/std@0.182.0/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000",
- "https://deno.land/std@0.182.0/path/glob.ts": "d479e0a695621c94d3fd7fe7abd4f9499caf32a8de13f25073451c6ef420a4e1",
- "https://deno.land/std@0.182.0/path/mod.ts": "bf718f19a4fdd545aee1b06409ca0805bd1b68ecf876605ce632e932fe54510c",
- "https://deno.land/std@0.182.0/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d",
- "https://deno.land/std@0.182.0/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1",
- "https://deno.land/std@0.182.0/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba",
- "https://deno.land/x/code_block_writer@12.0.0/mod.ts": "2c3448060e47c9d08604c8f40dee34343f553f33edcdfebbf648442be33205e5",
- "https://deno.land/x/code_block_writer@12.0.0/utils/string_utils.ts": "60cb4ec8bd335bf241ef785ccec51e809d576ff8e8d29da43d2273b69ce2a6ff",
- "https://deno.land/x/deno_cache@0.4.1/auth_tokens.ts": "5fee7e9155e78cedf3f6ff3efacffdb76ac1a76c86978658d9066d4fb0f7326e",
- "https://deno.land/x/deno_cache@0.4.1/cache.ts": "51f72f4299411193d780faac8c09d4e8cbee951f541121ef75fcc0e94e64c195",
- "https://deno.land/x/deno_cache@0.4.1/deno_dir.ts": "f2a9044ce8c7fe1109004cda6be96bf98b08f478ce77e7a07f866eff1bdd933f",
- "https://deno.land/x/deno_cache@0.4.1/deps.ts": "8974097d6c17e65d9a82d39377ae8af7d94d74c25c0cbb5855d2920e063f2343",
- "https://deno.land/x/deno_cache@0.4.1/dirs.ts": "d2fa473ef490a74f2dcb5abb4b9ab92a48d2b5b6320875df2dee64851fa64aa9",
- "https://deno.land/x/deno_cache@0.4.1/disk_cache.ts": "1f3f5232cba4c56412d93bdb324c624e95d5dd179d0578d2121e3ccdf55539f9",
- "https://deno.land/x/deno_cache@0.4.1/file_fetcher.ts": "07a6c5f8fd94bf50a116278cc6012b4921c70d2251d98ce1c9f3c352135c39f7",
- "https://deno.land/x/deno_cache@0.4.1/http_cache.ts": "f632e0d6ec4a5d61ae3987737a72caf5fcdb93670d21032ddb78df41131360cd",
- "https://deno.land/x/deno_cache@0.4.1/mod.ts": "ef1cda9235a93b89cb175fe648372fc0f785add2a43aa29126567a05e3e36195",
- "https://deno.land/x/deno_cache@0.4.1/util.ts": "8cb686526f4be5205b92c819ca2ce82220aa0a8dd3613ef0913f6dc269dbbcfe",
- "https://deno.land/x/dir@1.5.1/data_local_dir/mod.ts": "91eb1c4bfadfbeda30171007bac6d85aadacd43224a5ed721bbe56bc64e9eb66",
- "https://deno.land/x/dnt@0.38.0/lib/compiler.ts": "209ad2e1b294f93f87ec02ade9a0821f942d2e524104552d0aa8ff87021050a5",
- "https://deno.land/x/dnt@0.38.0/lib/compiler_transforms.ts": "f21aba052f5dcf0b0595c734450842855c7f572e96165d3d34f8fed2fc1f7ba1",
- "https://deno.land/x/dnt@0.38.0/lib/mod.deps.ts": "30367fc68bcd2acf3b7020cf5cdd26f817f7ac9ac35c4bfb6c4551475f91bc3e",
- "https://deno.land/x/dnt@0.38.0/lib/npm_ignore.ts": "57fbb7e7b935417d225eec586c6aa240288905eb095847d3f6a88e290209df4e",
- "https://deno.land/x/dnt@0.38.0/lib/package_json.ts": "61f35b06e374ed39ca776d29d67df4be7ee809d0bca29a8239687556c6d027c2",
- "https://deno.land/x/dnt@0.38.0/lib/pkg/dnt_wasm.generated.js": "82aeecfb055af0b2700e1e9b886e4a44fe3bf9cd11a9c4195cb169f53a134b15",
- "https://deno.land/x/dnt@0.38.0/lib/pkg/snippets/dnt-wasm-a15ef721fa5290c5/helpers.js": "a6b95adc943a68d513fe8ed9ec7d260ac466b7a4bced4e942f733e494bb9f1be",
- "https://deno.land/x/dnt@0.38.0/lib/shims.ts": "df1bd4d9a196dca4b2d512b1564fff64ac6c945189a273d706391f87f210d7e6",
- "https://deno.land/x/dnt@0.38.0/lib/test_runner/get_test_runner_code.ts": "4dc7a73a13b027341c0688df2b29a4ef102f287c126f134c33f69f0339b46968",
- "https://deno.land/x/dnt@0.38.0/lib/test_runner/test_runner.ts": "4d0da0500ec427d5f390d9a8d42fb882fbeccc92c92d66b6f2e758606dbd40e6",
- "https://deno.land/x/dnt@0.38.0/lib/transform.deps.ts": "e42f2bdef46d098453bdba19261a67cf90b583f5d868f7fe83113c1380d9b85c",
- "https://deno.land/x/dnt@0.38.0/lib/types.ts": "b8e228b2fac44c2ae902fbb73b1689f6ab889915bd66486c8a85c0c24255f5fb",
- "https://deno.land/x/dnt@0.38.0/lib/utils.ts": "878b7ac7003a10c16e6061aa49dbef9b42bd43174853ebffc9b67ea47eeb11d8",
- "https://deno.land/x/dnt@0.38.0/mod.ts": "b13349fe77847cf58e26b40bcd58797a8cec5d71b31a1ca567071329c8489de1",
- "https://deno.land/x/dnt@0.38.0/transform.ts": "f68743a14cf9bf53bfc9c81073871d69d447a7f9e3453e0447ca2fb78926bb1d",
- "https://deno.land/x/ts_morph@18.0.0/bootstrap/mod.ts": "b53aad517f106c4079971fcd4a81ab79fadc40b50061a3ab2b741a09119d51e9",
- "https://deno.land/x/ts_morph@18.0.0/bootstrap/ts_morph_bootstrap.js": "6645ac03c5e6687dfa8c78109dc5df0250b811ecb3aea2d97c504c35e8401c06",
- "https://deno.land/x/ts_morph@18.0.0/common/DenoRuntime.ts": "6a7180f0c6e90dcf23ccffc86aa8271c20b1c4f34c570588d08a45880b7e172d",
- "https://deno.land/x/ts_morph@18.0.0/common/mod.ts": "01985d2ee7da8d1caee318a9d07664774fbee4e31602bc2bb6bb62c3489555ed",
- "https://deno.land/x/ts_morph@18.0.0/common/ts_morph_common.js": "845671ca951073400ce142f8acefa2d39ea9a51e29ca80928642f3f8cf2b7700",
- "https://deno.land/x/ts_morph@18.0.0/common/typescript.js": "d5c598b6a2db2202d0428fca5fd79fc9a301a71880831a805d778797d2413c59",
- "https://deno.land/x/wasmbuild@0.14.1/cache.ts": "89eea5f3ce6035a1164b3e655c95f21300498920575ade23161421f5b01967f4",
- "https://deno.land/x/wasmbuild@0.14.1/loader.ts": "d98d195a715f823151cbc8baa3f32127337628379a02d9eb2a3c5902dbccfc02"
- }
-}
diff --git a/packages/typescript-types/extract-dom-types.ts b/packages/typescript-types/extract-dom-types.ts
deleted file mode 100644
index 2422fe5..0000000
--- a/packages/typescript-types/extract-dom-types.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * The VS Code Deno extension will yell about the imports of 'ts-morph' and 'typescript', but
- * we're still using npm to run this file so that it uses Lerna's Typescript as defined in the
- * package.json in the root of the monorepo. This is why `npm run build` here will run this file
- * before finally building the package using dnt.
- */
-// n.b. ts-morph is a sibling devDependency of typescript, so that the module
-// loader will resolve our project's typescript package, not the transient
-// dependency of ts-morph. We only want to reference our typescript dependency
-// for its version and its lib.dom.d.ts file. If any typescript functionality
-// is needed, use import { ts } from "ts-morph";
-import {
- InterfaceDeclaration,
- Node,
- Project,
- Structure,
- SyntaxKind,
- TypeAliasDeclaration,
-} from 'ts-morph';
-import { version } from 'typescript';
-
-// List of types we directly reference from the dom lib. Only interface and type
-// alias identifiers are valid, since other syntax types (class, function, var)
-// are implementations, which will not be available outside of the browser.
-const types = [
- 'AuthenticatorAssertionResponse',
- 'AttestationConveyancePreference',
- 'AuthenticatorAttestationResponse',
- 'AuthenticatorTransport',
- 'AuthenticationExtensionsClientInputs',
- 'AuthenticationExtensionsClientOutputs',
- 'AuthenticatorSelectionCriteria',
- 'COSEAlgorithmIdentifier',
- 'Crypto',
- 'PublicKeyCredential',
- 'PublicKeyCredentialCreationOptions',
- 'PublicKeyCredentialDescriptor',
- 'PublicKeyCredentialParameters',
- 'PublicKeyCredentialRequestOptions',
- 'PublicKeyCredentialUserEntity',
- 'UserVerificationRequirement',
-];
-
-const project = new Project({ skipAddingFilesFromTsConfig: true });
-const domSourcePath = 'typescript/lib/lib.dom.d.ts';
-const domSourceFile = project.addSourceFileAtPath(
- require.resolve(domSourcePath),
-);
-const resolvedNodes = new Set<InterfaceDeclaration | TypeAliasDeclaration>();
-const unresolvedNodes = new Set<InterfaceDeclaration | TypeAliasDeclaration>(
- types.map((type) => {
- const node = domSourceFile.getInterface(type) ??
- domSourceFile.getTypeAlias(type);
- if (!node) {
- throw new Error(`${type} does not refer to an interface or type alias`);
- }
- return node;
- }),
-);
-
-while (unresolvedNodes.size > 0) {
- for (const node of unresolvedNodes.values()) {
- unresolvedNodes.delete(node);
- resolvedNodes.add(node);
-
- // Declarations in lib files are never exported because they are globally
- // available. Since we are extracting the types to a module, we export them.
- node.setIsExported(true);
-
- // Find all descendant identifiers which reference an interface or type
- // alias, and add them to the unresolved list.
- for (const id of node.getDescendantsOfKind(SyntaxKind.Identifier)) {
- for (const dn of id.getDefinitionNodes()) {
- if (
- Node.isInterfaceDeclaration(dn) || Node.isTypeAliasDeclaration(dn)
- ) {
- if (!resolvedNodes.has(dn)) {
- unresolvedNodes.add(dn);
- }
- }
- }
- }
- }
-}
-
-const outputSourceFile = project.createSourceFile(`src/dom.ts`, undefined, {
- overwrite: true,
-});
-outputSourceFile.addStatements([
- `/**`,
- ` * Generated from typescript@${version} ${domSourcePath}`,
- ` * To regenerate, run the following command from the project root:`,
- ` * npx lerna --scope=@simplewebauthn/typescript-types exec -- npm run extract-dom-types`,
- ` */`,
- `// BEGIN CODEGEN`,
-]);
-const resolvedStructures = Array.from(resolvedNodes).map((node) => node.getStructure());
-outputSourceFile.addInterfaces(
- resolvedStructures.filter(Structure.isInterface),
-);
-outputSourceFile.addTypeAliases(
- resolvedStructures.filter(Structure.isTypeAlias),
-);
-outputSourceFile.saveSync();
diff --git a/packages/typescript-types/package.json b/packages/typescript-types/package.json
deleted file mode 100644
index 0d2a28d..0000000
--- a/packages/typescript-types/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "@simplewebauthn/typescript-types",
- "version": "8.3.4",
- "description": "Lerna/npm wrapper around Deno for @simplewebauthn/typescript-types",
- "scripts": {
- "build": "deno task build",
- "extract-dom-types": "ts-node extract-dom-types.ts"
- },
- "lerna": {
- "command": {
- "publish": {
- "directory": "./npm"
- }
- }
- },
- "gitHead": "33ccf8c6c9add811c87d3089e24156c2342b3498"
-}
diff --git a/packages/typescript-types/src/dom.ts b/packages/typescript-types/src/dom.ts
deleted file mode 100644
index 6e6111c..0000000
--- a/packages/typescript-types/src/dom.ts
+++ /dev/null
@@ -1,357 +0,0 @@
-/**
- * Generated from typescript@5.1.6 typescript/lib/lib.dom.d.ts
- * To regenerate, run the following command from the project root:
- * npx lerna --scope=@simplewebauthn/typescript-types exec -- npm run extract-dom-types
- */
-// BEGIN CODEGEN
-/**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse)
- */
-export interface AuthenticatorAssertionResponse extends AuthenticatorResponse {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/authenticatorData) */
- readonly authenticatorData: ArrayBuffer;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/signature) */
- readonly signature: ArrayBuffer;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/userHandle) */
- readonly userHandle: ArrayBuffer | null;
-}
-
-/**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse)
- */
-export interface AuthenticatorAttestationResponse extends AuthenticatorResponse {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/attestationObject) */
- readonly attestationObject: ArrayBuffer;
- getAuthenticatorData(): ArrayBuffer;
- getPublicKey(): ArrayBuffer | null;
- getPublicKeyAlgorithm(): COSEAlgorithmIdentifier;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getTransports) */
- getTransports(): string[];
-}
-
-export interface AuthenticationExtensionsClientInputs {
- appid?: string;
- credProps?: boolean;
- hmacCreateSecret?: boolean;
-}
-
-export interface AuthenticationExtensionsClientOutputs {
- appid?: boolean;
- credProps?: CredentialPropertiesOutput;
- hmacCreateSecret?: boolean;
-}
-
-export interface AuthenticatorSelectionCriteria {
- authenticatorAttachment?: AuthenticatorAttachment;
- requireResidentKey?: boolean;
- residentKey?: ResidentKeyRequirement;
- userVerification?: UserVerificationRequirement;
-}
-
-/**
- * Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto)
- */
-export interface Crypto {
- /**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
- */
- readonly subtle: SubtleCrypto;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
- getRandomValues<T extends ArrayBufferView | null>(array: T): T;
- /**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
- */
- randomUUID(): `${string}-${string}-${string}-${string}-${string}`;
-}
-
-/**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PublicKeyCredential)
- */
-export interface PublicKeyCredential extends Credential {
- readonly authenticatorAttachment: string | null;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PublicKeyCredential/rawId) */
- readonly rawId: ArrayBuffer;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PublicKeyCredential/response) */
- readonly response: AuthenticatorResponse;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PublicKeyCredential/getClientExtensionResults) */
- getClientExtensionResults(): AuthenticationExtensionsClientOutputs;
-}
-
-export interface PublicKeyCredentialCreationOptions {
- attestation?: AttestationConveyancePreference;
- authenticatorSelection?: AuthenticatorSelectionCriteria;
- challenge: BufferSource;
- excludeCredentials?: PublicKeyCredentialDescriptor[];
- extensions?: AuthenticationExtensionsClientInputs;
- pubKeyCredParams: PublicKeyCredentialParameters[];
- rp: PublicKeyCredentialRpEntity;
- timeout?: number;
- user: PublicKeyCredentialUserEntity;
-}
-
-export interface PublicKeyCredentialDescriptor {
- id: BufferSource;
- transports?: AuthenticatorTransport[];
- type: PublicKeyCredentialType;
-}
-
-export interface PublicKeyCredentialParameters {
- alg: COSEAlgorithmIdentifier;
- type: PublicKeyCredentialType;
-}
-
-export interface PublicKeyCredentialRequestOptions {
- allowCredentials?: PublicKeyCredentialDescriptor[];
- challenge: BufferSource;
- extensions?: AuthenticationExtensionsClientInputs;
- rpId?: string;
- timeout?: number;
- userVerification?: UserVerificationRequirement;
-}
-
-export interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity {
- displayName: string;
- id: BufferSource;
-}
-
-/**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse)
- */
-export interface AuthenticatorResponse {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse/clientDataJSON) */
- readonly clientDataJSON: ArrayBuffer;
-}
-
-export interface CredentialPropertiesOutput {
- rk?: boolean;
-}
-
-/**
- * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
- */
-export interface SubtleCrypto {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
- decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
- deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
- deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
- digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
- encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
- exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
- exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
- generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
- generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
- generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
- importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
- importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
- sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
- unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
- verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
- wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
-}
-
-/**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential)
- */
-export interface Credential {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/id) */
- readonly id: string;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/type) */
- readonly type: string;
-}
-
-export interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity {
- id?: string;
-}
-
-export interface PublicKeyCredentialEntity {
- name: string;
-}
-
-export interface RsaOaepParams extends Algorithm {
- label?: BufferSource;
-}
-
-export interface AesCtrParams extends Algorithm {
- counter: BufferSource;
- length: number;
-}
-
-export interface AesCbcParams extends Algorithm {
- iv: BufferSource;
-}
-
-export interface AesGcmParams extends Algorithm {
- additionalData?: BufferSource;
- iv: BufferSource;
- tagLength?: number;
-}
-
-/**
- * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
- */
-export interface CryptoKey {
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
- readonly algorithm: KeyAlgorithm;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
- readonly extractable: boolean;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
- readonly type: KeyType;
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
- readonly usages: KeyUsage[];
-}
-
-export interface EcdhKeyDeriveParams extends Algorithm {
- public: CryptoKey;
-}
-
-export interface HkdfParams extends Algorithm {
- hash: HashAlgorithmIdentifier;
- info: BufferSource;
- salt: BufferSource;
-}
-
-export interface Pbkdf2Params extends Algorithm {
- hash: HashAlgorithmIdentifier;
- iterations: number;
- salt: BufferSource;
-}
-
-export interface AesDerivedKeyParams extends Algorithm {
- length: number;
-}
-
-export interface HmacImportParams extends Algorithm {
- hash: HashAlgorithmIdentifier;
- length?: number;
-}
-
-export interface JsonWebKey {
- alg?: string;
- crv?: string;
- d?: string;
- dp?: string;
- dq?: string;
- e?: string;
- ext?: boolean;
- k?: string;
- key_ops?: string[];
- kty?: string;
- n?: string;
- oth?: RsaOtherPrimesInfo[];
- p?: string;
- q?: string;
- qi?: string;
- use?: string;
- x?: string;
- y?: string;
-}
-
-export interface RsaHashedKeyGenParams extends RsaKeyGenParams {
- hash: HashAlgorithmIdentifier;
-}
-
-export interface EcKeyGenParams extends Algorithm {
- namedCurve: NamedCurve;
-}
-
-export interface CryptoKeyPair {
- privateKey: CryptoKey;
- publicKey: CryptoKey;
-}
-
-export interface AesKeyGenParams extends Algorithm {
- length: number;
-}
-
-export interface HmacKeyGenParams extends Algorithm {
- hash: HashAlgorithmIdentifier;
- length?: number;
-}
-
-export interface RsaHashedImportParams extends Algorithm {
- hash: HashAlgorithmIdentifier;
-}
-
-export interface EcKeyImportParams extends Algorithm {
- namedCurve: NamedCurve;
-}
-
-export interface AesKeyAlgorithm extends KeyAlgorithm {
- length: number;
-}
-
-export interface RsaPssParams extends Algorithm {
- saltLength: number;
-}
-
-export interface EcdsaParams extends Algorithm {
- hash: HashAlgorithmIdentifier;
-}
-
-export interface Algorithm {
- name: string;
-}
-
-export interface KeyAlgorithm {
- name: string;
-}
-
-export interface RsaOtherPrimesInfo {
- d?: string;
- r?: string;
- t?: string;
-}
-
-export interface RsaKeyGenParams extends Algorithm {
- modulusLength: number;
- publicExponent: BigInteger;
-}
-
-export type AttestationConveyancePreference = "direct" | "enterprise" | "indirect" | "none";
-export type AuthenticatorTransport = "ble" | "hybrid" | "internal" | "nfc" | "usb";
-export type COSEAlgorithmIdentifier = number;
-export type UserVerificationRequirement = "discouraged" | "preferred" | "required";
-export type AuthenticatorAttachment = "cross-platform" | "platform";
-export type ResidentKeyRequirement = "discouraged" | "preferred" | "required";
-export type BufferSource = ArrayBufferView | ArrayBuffer;
-export type PublicKeyCredentialType = "public-key";
-export type AlgorithmIdentifier = Algorithm | string;
-export type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
-export type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
-export type KeyType = "private" | "public" | "secret";
-export type HashAlgorithmIdentifier = AlgorithmIdentifier;
-export type NamedCurve = string;
-export type BigInteger = Uint8Array;
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts
deleted file mode 100644
index f06b26d..0000000
--- a/packages/typescript-types/src/index.ts
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- * @packageDocumentation
- * @module @simplewebauthn/typescript-types
- */
-
-import type {
- AttestationConveyancePreference,
- AuthenticationExtensionsClientInputs,
- AuthenticationExtensionsClientOutputs,
- AuthenticatorAssertionResponse,
- AuthenticatorAttachment,
- AuthenticatorAttestationResponse,
- AuthenticatorSelectionCriteria,
- COSEAlgorithmIdentifier,
- PublicKeyCredential,
- PublicKeyCredentialCreationOptions,
- PublicKeyCredentialDescriptor,
- PublicKeyCredentialParameters,
- PublicKeyCredentialRequestOptions,
- PublicKeyCredentialRpEntity,
- PublicKeyCredentialType,
- UserVerificationRequirement,
-} from './dom.ts';
-
-export type {
- AttestationConveyancePreference,
- AuthenticationExtensionsClientInputs,
- AuthenticationExtensionsClientOutputs,
- AuthenticatorAssertionResponse,
- AuthenticatorAttachment,
- AuthenticatorAttestationResponse,
- AuthenticatorSelectionCriteria,
- AuthenticatorTransport,
- COSEAlgorithmIdentifier,
- Crypto,
- PublicKeyCredential,
- PublicKeyCredentialCreationOptions,
- PublicKeyCredentialDescriptor,
- PublicKeyCredentialParameters,
- PublicKeyCredentialRequestOptions,
- PublicKeyCredentialRpEntity,
- PublicKeyCredentialType,
- PublicKeyCredentialUserEntity,
- UserVerificationRequirement,
-} from './dom.ts';
-
-/**
- * A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
- * (eventually) get passed into navigator.credentials.create(...) in the browser.
- *
- * This should eventually get replaced with official TypeScript DOM types when WebAuthn L3 types
- * eventually make it into the language:
- *
- * https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
- */
-export interface PublicKeyCredentialCreationOptionsJSON {
- rp: PublicKeyCredentialRpEntity;
- user: PublicKeyCredentialUserEntityJSON;
- challenge: Base64URLString;
- pubKeyCredParams: PublicKeyCredentialParameters[];
- timeout?: number;
- excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
- authenticatorSelection?: AuthenticatorSelectionCriteria;
- attestation?: AttestationConveyancePreference;
- extensions?: AuthenticationExtensionsClientInputs;
-}
-
-/**
- * A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to
- * (eventually) get passed into navigator.credentials.get(...) in the browser.
- */
-export interface PublicKeyCredentialRequestOptionsJSON {
- challenge: Base64URLString;
- timeout?: number;
- rpId?: string;
- allowCredentials?: PublicKeyCredentialDescriptorJSON[];
- userVerification?: UserVerificationRequirement;
- extensions?: AuthenticationExtensionsClientInputs;
-}
-
-/**
- * https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
- */
-export interface PublicKeyCredentialDescriptorJSON {
- id: Base64URLString;
- type: PublicKeyCredentialType;
- transports?: AuthenticatorTransportFuture[];
-}
-
-/**
- * https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
- */
-export interface PublicKeyCredentialUserEntityJSON {
- id: string;
- name: string;
- displayName: string;
-}
-
-/**
- * The value returned from navigator.credentials.create()
- */
-export interface RegistrationCredential extends PublicKeyCredentialFuture {
- response: AuthenticatorAttestationResponseFuture;
-}
-
-/**
- * A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
- * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
- *
- * https://w3c.github.io/webauthn/#dictdef-registrationresponsejson
- */
-export interface RegistrationResponseJSON {
- id: Base64URLString;
- rawId: Base64URLString;
- response: AuthenticatorAttestationResponseJSON;
- authenticatorAttachment?: AuthenticatorAttachment;
- clientExtensionResults: AuthenticationExtensionsClientOutputs;
- type: PublicKeyCredentialType;
-}
-
-/**
- * The value returned from navigator.credentials.get()
- */
-export interface AuthenticationCredential extends PublicKeyCredentialFuture {
- response: AuthenticatorAssertionResponse;
-}
-
-/**
- * A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that
- * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
- *
- * https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson
- */
-export interface AuthenticationResponseJSON {
- id: Base64URLString;
- rawId: Base64URLString;
- response: AuthenticatorAssertionResponseJSON;
- authenticatorAttachment?: AuthenticatorAttachment;
- clientExtensionResults: AuthenticationExtensionsClientOutputs;
- type: PublicKeyCredentialType;
-}
-
-/**
- * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that
- * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
- *
- * https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson
- */
-export interface AuthenticatorAttestationResponseJSON {
- clientDataJSON: Base64URLString;
- attestationObject: Base64URLString;
- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
- authenticatorData?: Base64URLString;
- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
- transports?: AuthenticatorTransportFuture[];
- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
- publicKeyAlgorithm?: COSEAlgorithmIdentifier;
- publicKey?: Base64URLString;
-}
-
-/**
- * A slightly-modified AuthenticatorAssertionResponse to simplify working with ArrayBuffers that
- * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
- *
- * https://w3c.github.io/webauthn/#dictdef-authenticatorassertionresponsejson
- */
-export interface AuthenticatorAssertionResponseJSON {
- clientDataJSON: Base64URLString;
- authenticatorData: Base64URLString;
- signature: Base64URLString;
- userHandle?: string;
-}
-
-/**
- * A WebAuthn-compatible device and the information needed to verify assertions by it
- */
-export type AuthenticatorDevice = {
- credentialPublicKey: Uint8Array;
- credentialID: Uint8Array;
- // Number of times this authenticator is expected to have been used
- counter: number;
- // From browser's `startRegistration()` -> RegistrationCredentialJSON.transports (API L2 and up)
- transports?: AuthenticatorTransportFuture[];
-};
-
-/**
- * An attempt to communicate that this isn't just any string, but a Base64URL-encoded string
- */
-export type Base64URLString = string;
-
-/**
- * AuthenticatorAttestationResponse in TypeScript's DOM lib is outdated (up through v3.9.7).
- * Maintain an augmented version here so we can implement additional properties as the WebAuthn
- * spec evolves.
- *
- * See https://www.w3.org/TR/webauthn-2/#iface-authenticatorattestationresponse
- *
- * Properties marked optional are not supported in all browsers.
- */
-export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse {
- getTransports(): AuthenticatorTransportFuture[];
-}
-
-/**
- * A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest
- * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
- * know about it (sometime after 4.6.3)
- */
-export type AuthenticatorTransportFuture =
- | 'ble'
- | 'cable'
- | 'hybrid'
- | 'internal'
- | 'nfc'
- | 'smart-card'
- | 'usb';
-
-/**
- * A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest
- * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
- * know about it (sometime after 4.6.3)
- */
-export interface PublicKeyCredentialDescriptorFuture
- extends Omit<PublicKeyCredentialDescriptor, 'transports'> {
- transports?: AuthenticatorTransportFuture[];
-}
-
-/** */
-export type PublicKeyCredentialJSON =
- | RegistrationResponseJSON
- | AuthenticationResponseJSON;
-
-/**
- * A super class of TypeScript's `PublicKeyCredential` that knows about upcoming WebAuthn features
- */
-export interface PublicKeyCredentialFuture extends PublicKeyCredential {
- type: PublicKeyCredentialType;
- // See https://github.com/w3c/webauthn/issues/1745
- isConditionalMediationAvailable?(): Promise<boolean>;
- // See https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON
- parseCreationOptionsFromJSON?(
- options: PublicKeyCredentialCreationOptionsJSON,
- ): PublicKeyCredentialCreationOptions;
- // See https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON
- parseRequestOptionsFromJSON?(
- options: PublicKeyCredentialRequestOptionsJSON,
- ): PublicKeyCredentialRequestOptions;
- // See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson
- toJSON?(): PublicKeyCredentialJSON;
-}
-
-/**
- * The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data:
- * - `"singleDevice"` credentials will never be backed up
- * - `"multiDevice"` credentials can be backed up
- */
-export type CredentialDeviceType = 'singleDevice' | 'multiDevice';