@motebit/crypto-webauthn 1.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/LICENSE ADDED
@@ -0,0 +1,206 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Motebit, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+ "Motebit" is a trademark of Motebit, Inc. The Apache License grants rights to
204
+ this software, not to any Motebit trademarks, logos, or branding. You may not
205
+ use Motebit branding in a way that suggests endorsement or affiliation without
206
+ written permission.
package/NOTICE ADDED
@@ -0,0 +1,19 @@
1
+ Motebit
2
+ Copyright 2026 Motebit, Inc.
3
+
4
+ This product includes software developed at Motebit, Inc. (https://motebit.com).
5
+
6
+ The permissive-floor packages (the protocol, SDK, cryptographic primitives,
7
+ platform-attestation verifier leaves, scaffolding CLI, and GitHub Action) are
8
+ licensed under the Apache License, Version 2.0. See LICENSE files in each
9
+ `packages/*/` subdirectory and in `spec/` for the full license text.
10
+
11
+ The remaining packages, apps, and services are licensed under the Business
12
+ Source License 1.1 and convert to the Apache License, Version 2.0 four years
13
+ after each version's first public release. See `LICENSE` at the repository
14
+ root and `LICENSING.md` for the full license boundary.
15
+
16
+ "Motebit" is a trademark of Motebit, Inc. The licenses granted here cover
17
+ this software only, not Motebit trademarks, logos, or branding. Use of
18
+ Motebit branding in a way that suggests endorsement or affiliation requires
19
+ written permission.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @motebit/crypto-webauthn
2
+
3
+ Offline Apache-2.0 verifier for W3C WebAuthn packed-attestation hardware-attestation credentials.
4
+
5
+ ```bash
6
+ npm i @motebit/crypto-webauthn
7
+ ```
8
+
9
+ Plugs into [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto)'s `HardwareAttestationVerifiers` dispatcher as the `webauthn` verifier — called when a credential declares `platform: "webauthn"` (any browser platform authenticator).
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { verify } from "@motebit/crypto";
15
+ import { webauthnVerifier } from "@motebit/crypto-webauthn";
16
+
17
+ const result = await verify(credential, {
18
+ hardwareAttestation: { webauthn: webauthnVerifier({ expectedRpId: "motebit.com" }) },
19
+ });
20
+ ```
21
+
22
+ ## What it verifies
23
+
24
+ 1. The CBOR attestation object the browser emits — `{ fmt, attStmt, authData }`.
25
+ 2. **Full attestation** (`fmt: "packed"` with `x5c`): chain-verify the leaf against the **pinned FIDO root set** (Apple Anonymous Attestation, Yubico, Microsoft). Every non-leaf must carry `basicConstraints.cA === true`, terminal cert DER byte-equal to one of the pinned roots. Then `attStmt.sig` verifies over `authData || clientDataHash` using the leaf's public key and `attStmt.alg`.
26
+ 3. **Self attestation** (`fmt: "packed"` without `x5c`): `attStmt.sig` verifies over `authData || clientDataHash` using the credential's own public key carried in `authData`. Scores as hardware-exported-equivalent — proves only that the credential's key signed the challenge, not that any specific vendor minted it.
27
+ 4. **Identity binding.** The transmitted `clientDataHash` must equal `SHA-256(canonicalJson({ attested_at, device_id, identity_public_key, motebit_id, platform: "webauthn", version: "1" }))` — the same body the web mint path composes. A malicious page that substitutes any other body fails here.
28
+
29
+ ## Scope
30
+
31
+ v1 accepts `fmt: "packed"` only. Other formats (`tpm`, `android-key`, `android-safetynet`, `fido-u2f`, `apple`, `none`) return a structured `fmt-not-supported` error. Additional formats land as additive arms + fixtures.
32
+
33
+ ## Why pinned
34
+
35
+ A verifier that dynamically fetches the FIDO Metadata Service has no sovereign story. The pinned root set is the self-attesting contract — third parties audit `DEFAULT_FIDO_ROOTS` and know which vendor roots this library accepts. Rotations land as additive constants.
36
+
37
+ ## Related
38
+
39
+ - [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto) — dispatcher (pure permissive-floor; zero deps)
40
+ - [`@motebit/crypto-appattest`](https://www.npmjs.com/package/@motebit/crypto-appattest) — iOS sibling
41
+ - [`@motebit/crypto-play-integrity`](https://www.npmjs.com/package/@motebit/crypto-play-integrity) — Android sibling
42
+ - [`@motebit/crypto-tpm`](https://www.npmjs.com/package/@motebit/crypto-tpm) — TPM 2.0 sibling
43
+ - [`@motebit/verify`](https://www.npmjs.com/package/@motebit/verify) — canonical CLI bundling all four leaves with motebit defaults
44
+
45
+ ## License
46
+
47
+ Apache-2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
48
+
49
+ "Motebit" is a trademark. The Apache License grants rights to this software, not to any Motebit trademarks, logos, or branding. You may not use Motebit branding in a way that suggests endorsement or affiliation without written permission.
package/dist/cbor.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Thin CBOR decoder for WebAuthn attestation objects.
3
+ *
4
+ * `navigator.credentials.create({ publicKey: { attestation: "direct", … }})`
5
+ * returns a `PublicKeyCredential` whose `.response.attestationObject` is
6
+ * a CBOR-encoded W3C WebAuthn shape:
7
+ *
8
+ * {
9
+ * fmt: "packed" | "tpm" | "android-key" | "android-safetynet"
10
+ * | "fido-u2f" | "apple" | "none",
11
+ * attStmt: { alg: int, sig: bytes, x5c?: bytes[] },
12
+ * authData: bytes
13
+ * }
14
+ *
15
+ * Delegating to `cbor2` lets us parse that without writing a full CBOR
16
+ * implementation. We expose a typed `parseWebAuthnAttestationObjectCbor`
17
+ * so the verifier never touches raw `unknown` shapes — every field is
18
+ * validated as it's lifted out.
19
+ *
20
+ * Intentionally a fork of the `@motebit/crypto-appattest` CBOR parser:
21
+ * the App Attest shape carries `attStmt.receipt` (Apple's server-side
22
+ * refresh blob) and does NOT carry `attStmt.alg` or `attStmt.sig`; the
23
+ * WebAuthn packed shape is the inverse. Forking keeps each adapter's
24
+ * parser narrow and self-documenting — no shared base that silently
25
+ * papers over two different wire-format contracts.
26
+ */
27
+ export interface WebAuthnAttestationObjectCbor {
28
+ readonly fmt: string;
29
+ /** COSE algorithm identifier (e.g. -7 for ES256). Only relevant for `packed` fmt. */
30
+ readonly alg: number | null;
31
+ /** Signature over `authData || clientDataHash`. Required for packed fmt. */
32
+ readonly sig: Uint8Array | null;
33
+ /**
34
+ * Certificate chain. Empty when the attestation is self-attested
35
+ * (the credential's own key signed the challenge — no vendor chain).
36
+ */
37
+ readonly x5c: readonly Uint8Array[];
38
+ readonly authData: Uint8Array;
39
+ }
40
+ /**
41
+ * Parse a CBOR-encoded WebAuthn attestation object.
42
+ *
43
+ * Returns a typed view or throws on malformed / unexpected shape. The
44
+ * caller (`verify.ts`) catches the throw and converts to the
45
+ * `{ valid: false, errors: [...] }` result shape.
46
+ */
47
+ export declare function parseWebAuthnAttestationObjectCbor(attestationObjectBytes: Uint8Array): WebAuthnAttestationObjectCbor;
48
+ //# sourceMappingURL=cbor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,SAAS,UAAU,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAChD,sBAAsB,EAAE,UAAU,GACjC,6BAA6B,CAuD/B"}
package/dist/cbor.js ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Thin CBOR decoder for WebAuthn attestation objects.
3
+ *
4
+ * `navigator.credentials.create({ publicKey: { attestation: "direct", … }})`
5
+ * returns a `PublicKeyCredential` whose `.response.attestationObject` is
6
+ * a CBOR-encoded W3C WebAuthn shape:
7
+ *
8
+ * {
9
+ * fmt: "packed" | "tpm" | "android-key" | "android-safetynet"
10
+ * | "fido-u2f" | "apple" | "none",
11
+ * attStmt: { alg: int, sig: bytes, x5c?: bytes[] },
12
+ * authData: bytes
13
+ * }
14
+ *
15
+ * Delegating to `cbor2` lets us parse that without writing a full CBOR
16
+ * implementation. We expose a typed `parseWebAuthnAttestationObjectCbor`
17
+ * so the verifier never touches raw `unknown` shapes — every field is
18
+ * validated as it's lifted out.
19
+ *
20
+ * Intentionally a fork of the `@motebit/crypto-appattest` CBOR parser:
21
+ * the App Attest shape carries `attStmt.receipt` (Apple's server-side
22
+ * refresh blob) and does NOT carry `attStmt.alg` or `attStmt.sig`; the
23
+ * WebAuthn packed shape is the inverse. Forking keeps each adapter's
24
+ * parser narrow and self-documenting — no shared base that silently
25
+ * papers over two different wire-format contracts.
26
+ */
27
+ import { decode as cborDecode } from "cbor2";
28
+ /**
29
+ * Parse a CBOR-encoded WebAuthn attestation object.
30
+ *
31
+ * Returns a typed view or throws on malformed / unexpected shape. The
32
+ * caller (`verify.ts`) catches the throw and converts to the
33
+ * `{ valid: false, errors: [...] }` result shape.
34
+ */
35
+ export function parseWebAuthnAttestationObjectCbor(attestationObjectBytes) {
36
+ const decoded = cborDecode(attestationObjectBytes);
37
+ if (decoded === null || typeof decoded !== "object") {
38
+ throw new Error("attestation object is not a CBOR map");
39
+ }
40
+ const getFromAny = (key) => {
41
+ if (decoded instanceof Map)
42
+ return decoded.get(key);
43
+ return decoded[key];
44
+ };
45
+ const fmt = getFromAny("fmt");
46
+ if (typeof fmt !== "string")
47
+ throw new Error("attestation `fmt` missing or not a string");
48
+ const attStmt = getFromAny("attStmt");
49
+ if (attStmt === null || typeof attStmt !== "object") {
50
+ throw new Error("attestation `attStmt` missing or not an object");
51
+ }
52
+ const attStmtGet = (key) => {
53
+ if (attStmt instanceof Map)
54
+ return attStmt.get(key);
55
+ return attStmt[key];
56
+ };
57
+ // `alg` and `sig` are specific to the `packed` fmt (and a couple of
58
+ // others); for shapes that lack them we surface null and let the
59
+ // verifier reject based on the fmt arm.
60
+ const algRaw = attStmtGet("alg");
61
+ const alg = typeof algRaw === "number" ? algRaw : algRaw === undefined ? null : NaN;
62
+ if (Number.isNaN(alg))
63
+ throw new Error("attestation `attStmt.alg` present but not a number");
64
+ const sigRaw = attStmtGet("sig");
65
+ const sig = sigRaw === undefined ? null : coerceBytes(sigRaw);
66
+ if (sigRaw !== undefined && sig === null) {
67
+ throw new Error("attestation `attStmt.sig` present but not bytes");
68
+ }
69
+ const x5cRaw = attStmtGet("x5c");
70
+ const x5c = [];
71
+ if (x5cRaw !== undefined) {
72
+ if (!Array.isArray(x5cRaw)) {
73
+ throw new Error("attestation `attStmt.x5c` present but not an array");
74
+ }
75
+ for (const entry of x5cRaw) {
76
+ const bytes = coerceBytes(entry);
77
+ if (!bytes)
78
+ throw new Error("attestation `attStmt.x5c` entry is not bytes");
79
+ x5c.push(bytes);
80
+ }
81
+ }
82
+ const authDataRaw = getFromAny("authData");
83
+ const authData = coerceBytes(authDataRaw);
84
+ if (!authData)
85
+ throw new Error("attestation `authData` missing or not bytes");
86
+ return { fmt, alg, sig, x5c, authData };
87
+ }
88
+ /**
89
+ * cbor2 can surface byte strings as `Uint8Array` or, in some Node builds,
90
+ * as `Buffer` (a Uint8Array subclass). This helper collapses both shapes
91
+ * into a plain `Uint8Array` copy the rest of the verifier operates on.
92
+ */
93
+ function coerceBytes(v) {
94
+ if (v instanceof Uint8Array) {
95
+ return new Uint8Array(v.buffer, v.byteOffset, v.byteLength).slice();
96
+ }
97
+ return null;
98
+ }
99
+ //# sourceMappingURL=cbor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbor.js","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,OAAO,CAAC;AAgB7C;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAChD,sBAAkC;IAElC,MAAM,OAAO,GAAY,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE5D,IAAI,OAAO,KAAK,IA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C,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Pinned FIDO-vendor root certificates the `packed`-attestation full-
3
+ * attestation verifier accepts as trust anchors.
4
+ *
5
+ * This is the self-attesting contract: a verifier that dynamically
6
+ * fetched FIDO Metadata Service roots would have no sovereign story —
7
+ * third parties auditing our output could never reproduce the decision
8
+ * without trusting our fetch path. By committing the exact bytes of the
9
+ * CAs we accept, anyone can audit this file, pin the same bytes in their
10
+ * own verifier, and reach the same yes/no answer for any WebAuthn
11
+ * attestation they receive.
12
+ *
13
+ * Starter set (v1):
14
+ * - Apple WebAuthn Anonymous Attestation CA — the platform-authenticator
15
+ * root iOS/macOS `Touch ID` / `Face ID` / `Passkey` attestations
16
+ * chain to when a site requests `attestation: "direct"`.
17
+ * Source: https://www.apple.com/certificateauthority/Apple_WebAuthn_Root_CA.pem
18
+ *
19
+ * - Yubico FIDO Root CA Serial 457200631 — the Yubico attestation
20
+ * root every modern YubiKey (FIDO2 / Security Key) leaf certifies
21
+ * under. Source: https://developers.yubico.com/PKI/yubico-ca-certs.txt
22
+ *
23
+ * - Microsoft TPM Root CA 2014 — the root Microsoft TPM-backed
24
+ * platform-authenticator leaves chain to on Windows Hello setups.
25
+ * Source: https://www.microsoft.com/pkiops/certs/Microsoft%20TPM%20Root%20Certificate%20Authority%202014.crt
26
+ *
27
+ * Rotations land as additive constants and a dispatch arm on the
28
+ * accept-set here. Removing a root is a wire-format break and MUST be
29
+ * coordinated with a spec version bump.
30
+ *
31
+ * Tests override the accept-set via `WebAuthnVerifyOptions.rootPems` so
32
+ * chain-validation exercises the same code path without needing a real
33
+ * vendor-signed leaf.
34
+ */
35
+ /**
36
+ * Apple WebAuthn Anonymous Attestation Root CA.
37
+ *
38
+ * Published by Apple as the root for WebAuthn packed-attestation leaves
39
+ * minted by iOS / macOS platform authenticators. Byte-for-byte match of
40
+ * Apple's published certificate at
41
+ * https://www.apple.com/certificateauthority/Apple_WebAuthn_Root_CA.pem.
42
+ */
43
+ export declare const APPLE_WEBAUTHN_ROOT_PEM = "-----BEGIN CERTIFICATE-----\nMIICEjCCAZmgAwIBAgIQaB0BbHo84wIlpQGUKEdXcTAKBggqhkjOPQQDAzBLMR8w\nHQYDVQQDDBZBcHBsZSBXZWJBdXRobiBSb290IENBMRMwEQYDVQQKDApBcHBsZSBJ\nbmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMB4XDTIwMDMxODE4MjEzMloXDTQ1MDMx\nNTAwMDAwMFowSzEfMB0GA1UEAwwWQXBwbGUgV2ViQXV0aG4gUm9vdCBDQTETMBEG\nA1UECgwKQXBwbGUgSW5jLjETMBEGA1UECAwKQ2FsaWZvcm5pYTB2MBAGByqGSM49\nAgEGBSuBBAAiA2IABCJCQ2pTVhzjl4Wo6IhHtMSAzO2cv+H9DQKev3//fG59G11k\nxu9eI0/7o6V5uShBpe1u6l6mS19S1FEh6yGljnZAJ+2GNP1mi/YK2kSXIuTHjxA/\npcoRf7XkOtO4o1qlcaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJtdk\n2cV4wlpn0afeaxLQG2PxxtcwDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA\nMGQCMFrZ+9DsJ1PW9hfNdBywZDsWDbWFp28it1d/5w2RPkRX3Bbn/UbDTNLx7Jr3\njAGGiQIwHFj+dJZYUJR786osByBelJYsVZd2GbHQu209b5RCmGQ21gWSw2PdMsSn\n1LabATR4H7iIgXPxz8m8KiS1hXiz\n-----END CERTIFICATE-----\n";
44
+ /**
45
+ * Yubico FIDO Root CA — Serial 457200631.
46
+ *
47
+ * Root of trust for YubiKey FIDO2 / Security Key attestation leaves.
48
+ * Byte-for-byte match of Yubico's published certificate at
49
+ * https://developers.yubico.com/PKI/yubico-ca-certs.txt.
50
+ */
51
+ export declare const YUBICO_FIDO_ROOT_PEM = "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iGn05ZsqeY1gx4g0xLBqc\nU9psmyPzK+Vsgw2jeRQ5JlKDyqE0hebfC1tvFu0CCrJFcw==\n-----END CERTIFICATE-----\n";
52
+ /**
53
+ * Microsoft TPM Root Certificate Authority 2014.
54
+ *
55
+ * Root of trust for Windows-Hello TPM-backed platform-authenticator
56
+ * attestation leaves. Byte-for-byte match of Microsoft's published
57
+ * certificate at
58
+ * https://www.microsoft.com/pkiops/certs/Microsoft%20TPM%20Root%20Certificate%20Authority%202014.crt.
59
+ *
60
+ * Note: Microsoft's Windows Hello attestation commonly uses `fmt: "tpm"`
61
+ * rather than `fmt: "packed"`; this root is pinned for forward-compatibility
62
+ * with Microsoft-signed `packed` leaves and for the TPM fmt's additive
63
+ * arm (non-goal in v1).
64
+ */
65
+ export declare const MICROSOFT_TPM_ROOT_PEM = "-----BEGIN CERTIFICATE-----\nMIIF9TCCA92gAwIBAgIQXbYwTgy/J79JuMhpUB5dyzANBgkqhkiG9w0BAQsFADCB\njDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl\nZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjE2MDQGA1UEAxMt\nTWljcm9zb2Z0IFRQTSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAyMDE0MB4X\nDTE0MTIxMDIxMzExOVoXDTM5MTIxMDIxMzkyOFowgYwxCzAJBgNVBAYTAlVTMRMw\nEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN\naWNyb3NvZnQgQ29ycG9yYXRpb24xNjA0BgNVBAMTLU1pY3Jvc29mdCBUUE0gUm9v\ndCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxNDCCAiIwDQYJKoZIhvcNAQEBBQAD\nggIPADCCAgoCggIBAJ+n+bnKt/JHIRC/oI/xgkgsYdPzP0gpvduDA2GbRtth+L4W\nUyoZKGB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hVbazQWGF6cnKE0NYZy7UCjl2ZWN+FYHUX3tzrK\nUXDy3jl6wmRy+R0O7CJjEgQsaa4Rkz/L+0mdCIdhTNijxPRTaPcLGn1l5ZxtqWl3\nOdcbVjQGMnOWrkaxpbI99/C8tBiYuUCiPkCeuK+0wLMjP3b3zlPGjZnTVSgq52bK\n7JIB70R8dnC6PIPjY9QeY5bOTQJ1LJ/h8Hcn4Vam0aZMIpWDjMOXK48rLNG1+mXB\noDpoa1jAD+hxi54GSJHgGtVHG/HEiBdpHumOBYDLv5UZ9T2nHhPbmkpTA5JvzaCT\nWb0B4htaAlVCbQ0Tn4mNHhASa/rsSpl0C5bpFggsDdaaRmcRJ3UPy+GmSZPT9Xsh\nHv7yoFFKi50iNfc59NhT2Qh/6V/8gK7U+rfcKk+KlW/2k+JSX+4Dyh8=\n-----END CERTIFICATE-----\n";
66
+ /**
67
+ * Default FIDO root accept-set. Full attestation (x5c present) must
68
+ * chain to exactly one of these. Tests override by passing
69
+ * `WebAuthnVerifyOptions.rootPems` — the runtime-injected set replaces
70
+ * the pinned default so fabricated chains can exercise the same code
71
+ * path.
72
+ */
73
+ export declare const DEFAULT_FIDO_ROOTS: ReadonlyArray<string>;
74
+ /**
75
+ * WebAuthn attestation format discriminator the verifier accepts in v1.
76
+ * `packed` is the broadest-coverage format and the only one v1 handles.
77
+ * `tpm`, `android-key`, `android-safetynet`, `fido-u2f`, `apple`, and
78
+ * `none` are rejected with a structured `fmt-not-supported` error.
79
+ */
80
+ export declare const WEBAUTHN_FMT_PACKED = "packed";
81
+ //# sourceMappingURL=fido-roots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fido-roots.d.ts","sourceRoot":"","sources":["../src/fido-roots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,izBAcnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,+oCAmBhC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,qnEAkClC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAIpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC"}