@motebit/verify 0.6.11 → 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 CHANGED
@@ -1,26 +1,206 @@
1
- MIT License
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright (c) 2026 Motebit
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
7
+ 1. Definitions.
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
14
11
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
22
14
 
23
- "Motebit" is a trademark of Motebit, Inc. The MIT License grants rights to
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
24
204
  this software, not to any Motebit trademarks, logos, or branding. You may not
25
205
  use Motebit branding in a way that suggests endorsement or affiliation without
26
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 CHANGED
@@ -1,102 +1,121 @@
1
1
  # @motebit/verify
2
2
 
3
- Verify any Motebit artifact — identity files, execution receipts, verifiable credentials, and verifiable presentations.
3
+ The canonical motebit artifact verifier. A single `motebit-verify` command that verifies any signed motebit artifact — identity files, execution receipts, credentials, presentations — including credentials carrying hardware-attestation claims under any of the four platforms (Apple App Attest, Google Play Integrity, TPM 2.0, WebAuthn).
4
4
 
5
- One function. Any artifact. Zero runtime dependencies. MIT licensed.
6
-
7
- ## Install
5
+ Network-free. No relay contact, no external service, no cloud dependency. Every trust anchor is pinned in the installed package.
8
6
 
9
7
  ```bash
10
- npm install @motebit/verify
8
+ npm install -g @motebit/verify
9
+ motebit-verify cred.json
10
+ ```
11
+
12
+ ```
13
+ VALID (credential)
14
+ issuer: did:key:z6MkhaXgBZDvotDkL5257...
15
+ subject: did:key:z6MkhaXgBZDvotDkL5257...
16
+ expired: no
17
+ hardware: secure_enclave ✓
11
18
  ```
12
19
 
20
+ ## What it verifies
21
+
22
+ | Artifact | Detection |
23
+ | --------------------------- | --------------------------------------------------------------- |
24
+ | `motebit.md` identity files | YAML frontmatter + Ed25519 proof |
25
+ | Execution receipts | Signed JSON, signer keys chain |
26
+ | W3C VerifiableCredentials | `eddsa-jcs-2022` proof, hardware-attestation channel if present |
27
+ | VerifiablePresentations | Signed envelope + every embedded credential |
28
+
29
+ Hardware-attestation channel covers all four currently-shipped platforms:
30
+
31
+ | Platform | Adapter | Trust anchor |
32
+ | ---------------- | -------------------------------- | ------------------------------------------------------------ |
33
+ | `secure_enclave` | `@motebit/crypto` (built-in) | ECDSA-P256 signature; self-asserted SE public key |
34
+ | `device_check` | `@motebit/crypto-appattest` | Pinned Apple App Attestation Root CA |
35
+ | `tpm` | `@motebit/crypto-tpm` | Pinned Infineon / Nuvoton / STMicro / Intel PTT vendor roots |
36
+ | `play_integrity` | `@motebit/crypto-play-integrity` | Pinned Google JWKS |
37
+ | `webauthn` | `@motebit/crypto-webauthn` | Pinned Apple / Yubico / Microsoft FIDO roots |
38
+
39
+ Unknown platform → named error, fail-closed. Missing adapter context → named error, fail-closed. Never silent acceptance.
40
+
13
41
  ## Usage
14
42
 
15
- ```typescript
16
- import { verify } from "@motebit/verify";
17
-
18
- // Identity file
19
- const r1 = await verify(fs.readFileSync("motebit.md", "utf-8"));
20
- if (r1.type === "identity" && r1.valid) {
21
- console.log(r1.did); // did:key:z...
22
- console.log(r1.identity); // full identity file contents
23
- console.log(r1.succession); // key rotation chain (if present)
24
- }
25
-
26
- // Execution receipt (object or JSON string)
27
- const r2 = await verify(receipt);
28
- if (r2.type === "receipt" && r2.valid) {
29
- console.log(r2.signer); // did:key of the signing agent
30
- console.log(r2.delegations); // nested delegation verification results
31
- }
32
-
33
- // Verifiable credential
34
- const r3 = await verify(credential);
35
- if (r3.type === "credential" && r3.valid) {
36
- console.log(r3.issuer); // did:key of the issuer
37
- console.log(r3.subject); // did:key of the subject
38
- console.log(r3.expired); // false
39
- }
40
-
41
- // Verifiable presentation
42
- const r4 = await verify(presentation);
43
- if (r4.type === "presentation" && r4.valid) {
44
- console.log(r4.holder); // did:key of the holder
45
- console.log(r4.credentials); // each credential verified independently
46
- }
43
+ ```bash
44
+ motebit-verify <file> # auto-detect, print human-readable
45
+ motebit-verify <file> --json # structured JSON output
46
+ motebit-verify <file> --expect credential # pin expected artifact type
47
+ motebit-verify <file> --clock-skew 30 # allow N seconds of clock drift
48
+
49
+ # Platform overrides (defaults match motebit's canonical identifiers)
50
+ motebit-verify <file> \
51
+ --bundle-id com.example.app \
52
+ --android-package com.example.app \
53
+ --rp-id example.com
47
54
  ```
48
55
 
49
- ### Strict mode
56
+ Exit codes:
50
57
 
51
- Pass `expectedType` to fail fast if the artifact doesn't match:
58
+ - `0` artifact verified (including hardware-attestation channel)
59
+ - `1` — artifact detected but signature / hardware channel invalid
60
+ - `2` — usage or I/O error
52
61
 
53
- ```typescript
54
- const result = await verify(artifact, { expectedType: "receipt" });
55
- // result.valid is false if artifact is not a receipt
56
- ```
62
+ ## Programmatic use
57
63
 
58
- ### Parse without verifying
64
+ The CLI is a thin wrapper — every capability is available programmatically:
59
65
 
60
- ```typescript
61
- import { parse } from "@motebit/verify";
66
+ ```ts
67
+ import { verifyFile } from "@motebit/verifier"; // Apache-2.0 library (file I/O + formatting)
68
+ import { buildHardwareVerifiers } from "@motebit/verify"; // Apache-2.0 CLI + programmatic adapter bundle
62
69
 
63
- const { frontmatter, signature, rawFrontmatter } = parse(identityFileContent);
64
- console.log(frontmatter.motebit_id);
70
+ const result = await verifyFile("cred.json", {
71
+ hardwareAttestation: buildHardwareVerifiers(),
72
+ });
65
73
  ```
66
74
 
67
- ## API
75
+ ## The three-package lineage
68
76
 
69
- ### `verify(artifact, options?): Promise<VerifyResult>`
77
+ This package sits at the top of a deliberate three-layer split — the same shape long-lived tool lineages use (git / libgit2, cargo / tokio, npm / @npm/arborist):
70
78
 
71
- Verify any Motebit artifact. Detects the type automatically from the input.
79
+ ```
80
+ @motebit/verify Apache-2.0 the CLI motebit-verify + bundled adapters (the tool — this package)
81
+ @motebit/verifier Apache-2.0 library: verifyFile, verifyArtifact, formatHuman
82
+ @motebit/crypto Apache-2.0 primitives: verify, sign, suite dispatch
83
+ ```
72
84
 
73
- - **Strings** containing `---` are parsed as identity files
74
- - **Strings** containing JSON are parsed and detected by shape
75
- - **Objects** are detected by shape: receipts have `task_id` + `signature`, credentials have `credentialSubject` + `proof`, presentations have `holder` + `verifiableCredential` + `proof`
85
+ All three are Apache-2.0 with explicit patent grant the full verification surface ships under the permissive floor. The BSL line stays at `motebit` (the operator console) and everything below it, where the motebit-proprietary judgment actually lives.
76
86
 
77
- Returns a discriminated union narrow on `result.type` to access type-specific fields.
87
+ - Install **`@motebit/verify`** when you want the command-line tool with every platform bundled. One install, verify anything offline, no license friction in CI pipelines.
88
+ - Install **`@motebit/verifier`** when you're writing TypeScript code that needs to read + verify motebit artifacts programmatically and want the dep-thin library without the four bundled platform adapters.
89
+ - Install **`@motebit/crypto`** when you want the primitives — the verify dispatcher, sign APIs, suite registry — to build your own verification tooling from scratch.
78
90
 
79
- ### `verifyIdentityFile(content): Promise<LegacyVerifyResult>`
91
+ ## Superseding the deprecated `@motebit/verify@0.x`
80
92
 
81
- Verify a `motebit.md` identity file. Returns the legacy result shape with `.identity`, `.did`, `.error` fields directly (no type narrowing needed).
93
+ The original `@motebit/verify@0.7.0` was a zero-dep MIT library with a single `verify()` function. It was deprecated and split:
82
94
 
83
- ### `parse(content): { frontmatter, signature, rawFrontmatter }`
95
+ - **The `verify()` library primitive** moved to [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto). Now Apache-2.0 (upgraded from MIT — adds an explicit patent grant), same zero deps, same function shape, plus full sign / verify / cryptosuite support.
96
+ - **The file-reading + human-formatting helpers** live at [`@motebit/verifier`](https://www.npmjs.com/package/@motebit/verifier). Apache-2.0, thin layer above `@motebit/crypto`.
97
+ - **The `motebit-verify` CLI — the tool most users actually wanted when they typed `npm install @motebit/verify`** — is now this package, shipped at `1.0.0`. Runs offline. Verifies every motebit artifact. Bundles every hardware-attestation platform.
84
98
 
85
- Parse a `motebit.md` file into its components. Does not verify the signature. Throws if malformed.
99
+ If you were on `@motebit/verify@^0.7.0`, migration depends on what you were using:
86
100
 
87
- ## What can it verify?
101
+ | You were using | Migrate to |
102
+ | ------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
103
+ | The `verify()` function in TypeScript | `import { verify } from "@motebit/crypto"` — same shape, more features |
104
+ | `verifyFile()` / `formatHuman()` / programmatic CLI wrappers | `import { ... } from "@motebit/verifier"` |
105
+ | Running `motebit-verify` on the command line | `npm install -g @motebit/verify` at `^1.0.0` — same command, full platform coverage |
88
106
 
89
- | Artifact | Input | What it checks |
90
- | ----------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------- |
91
- | Identity file | String (YAML frontmatter + Ed25519 signature) | Signature over frontmatter, succession chain linkage + temporal ordering |
92
- | Execution receipt | Object or JSON | Ed25519 signature over canonical JSON, embedded public key, recursive delegation chain |
93
- | Verifiable credential | Object or JSON | eddsa-jcs-2022 Data Integrity proof, expiry, issuer DID extraction |
94
- | Verifiable presentation | Object or JSON | Envelope proof + each contained credential independently |
107
+ ## Related
95
108
 
96
- All verification is **offline** — no network calls, no relay lookup, no runtime dependency. Receipts embed the signer's public key. Credentials embed the issuer's DID. Everything needed for verification is in the artifact itself.
109
+ - [`@motebit/verifier`](https://www.npmjs.com/package/@motebit/verifier) Apache-2.0 library underneath this CLI (`verifyFile`, `verifyArtifact`, `formatHuman`)
110
+ - [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto) — Apache-2.0 primitives (`verify`, `sign`, suite dispatch; zero monorepo deps)
111
+ - [`@motebit/crypto-appattest`](https://www.npmjs.com/package/@motebit/crypto-appattest) — Apple App Attest adapter bundled into this CLI
112
+ - [`@motebit/crypto-play-integrity`](https://www.npmjs.com/package/@motebit/crypto-play-integrity) — Google Play Integrity adapter bundled into this CLI
113
+ - [`@motebit/crypto-tpm`](https://www.npmjs.com/package/@motebit/crypto-tpm) — TPM 2.0 EK chain adapter bundled into this CLI
114
+ - [`@motebit/crypto-webauthn`](https://www.npmjs.com/package/@motebit/crypto-webauthn) — WebAuthn packed-attestation adapter bundled into this CLI
115
+ - [`motebit`](https://www.npmjs.com/package/motebit) — reference runtime and operator console
97
116
 
98
117
  ## License
99
118
 
100
- MIT — see [LICENSE](./LICENSE).
119
+ Apache-2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
101
120
 
102
- "Motebit" is a trademark. The MIT 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.
121
+ "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.
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Bundled-adapter wiring — the core reason this package exists.
3
+ *
4
+ * `@motebit/verifier` (Apache-2.0) accepts an optional
5
+ * `HardwareAttestationVerifiers` record but wires none of the four
6
+ * leaves itself; that keeps it dep-thin. This Apache-2.0 aggregator
7
+ * imports every leaf (`@motebit/crypto-appattest`,
8
+ * `@motebit/crypto-tpm`, `@motebit/crypto-play-integrity`,
9
+ * `@motebit/crypto-webauthn`) and
10
+ * produces a single `HardwareAttestationVerifiers` object the CLI
11
+ * hands to `verifyFile`. Any credential whose subject carries a
12
+ * hardware-attestation claim for any of the four platforms now
13
+ * verifies end-to-end — chain + nonce + bundle + identity — instead
14
+ * of returning the `adapter not yet shipped` sentinel.
15
+ *
16
+ * Defaults match motebit's canonical app identifiers:
17
+ * - App Attest → bundleId `com.motebit.mobile`
18
+ * - Play Integrity → packageName `com.motebit.mobile`
19
+ * - WebAuthn → rpId `motebit.com`
20
+ * - TPM → the pinned vendor roots in `@motebit/crypto-tpm`
21
+ *
22
+ * Operators verifying credentials from a different motebit deployment
23
+ * can override any of these via the config parameter.
24
+ */
25
+ import type { HardwareAttestationVerifiers } from "@motebit/crypto";
26
+ import { type GoogleJwks } from "@motebit/crypto-play-integrity";
27
+ export interface HardwareVerifierBundleConfig {
28
+ /**
29
+ * Apple App Attest — bundle ID the attested iOS app was built with.
30
+ * Defaults to `com.motebit.mobile`. Override when verifying credentials
31
+ * minted by a different motebit iOS build.
32
+ */
33
+ readonly appAttestBundleId?: string;
34
+ /**
35
+ * Apple App Attest — override the pinned Apple App Attestation Root
36
+ * CA PEM. Defaults to the constant in `@motebit/crypto-appattest`.
37
+ * Exposed only so test fabrications can exercise the chain-validation
38
+ * code path with a fabricated root.
39
+ */
40
+ readonly appAttestRootPem?: string;
41
+ /**
42
+ * Google Play Integrity — Android package name the attested app was
43
+ * built with. Defaults to `com.motebit.mobile`.
44
+ */
45
+ readonly playIntegrityPackageName?: string;
46
+ /**
47
+ * Google Play Integrity — override the pinned JWKS. Fail-closed by
48
+ * default (see `@motebit/crypto-play-integrity` doctrine); operators
49
+ * pin real keys here once the production key-acquisition path lands.
50
+ */
51
+ readonly playIntegrityPinnedJwks?: GoogleJwks;
52
+ /**
53
+ * Google Play Integrity — relax the device-integrity floor. Defaults
54
+ * to the strict `"MEETS_DEVICE_INTEGRITY"`. Development / sideloaded
55
+ * scenarios may lower to `"MEETS_BASIC_INTEGRITY"`.
56
+ */
57
+ readonly playIntegrityRequiredDeviceIntegrity?: string;
58
+ /**
59
+ * WebAuthn — Relying Party ID the credential was minted for.
60
+ * Defaults to `motebit.com`.
61
+ */
62
+ readonly webauthnRpId?: string;
63
+ /**
64
+ * WebAuthn — override the pinned FIDO root set. Defaults to
65
+ * `DEFAULT_FIDO_ROOTS` (Apple Anonymous Attestation, Yubico, Microsoft).
66
+ */
67
+ readonly webauthnRootPems?: ReadonlyArray<string>;
68
+ /**
69
+ * TPM — override the pinned vendor root PEMs. Defaults to the four
70
+ * TPM-vendor roots in `@motebit/crypto-tpm` (Infineon, Nuvoton,
71
+ * STMicro, Intel PTT).
72
+ */
73
+ readonly tpmRootPems?: ReadonlyArray<string>;
74
+ }
75
+ /**
76
+ * Build the full `HardwareAttestationVerifiers` object covering all four
77
+ * platform adapters. Pass the result to `verifyFile`:
78
+ *
79
+ * ```ts
80
+ * import { verifyFile } from "@motebit/verifier";
81
+ * import { buildHardwareVerifiers } from "@motebit/verify";
82
+ *
83
+ * const result = await verifyFile("cred.json", {
84
+ * hardwareAttestation: buildHardwareVerifiers(),
85
+ * });
86
+ * ```
87
+ *
88
+ * Pure function: every dependency is captured at factory time and the
89
+ * returned verifiers are idempotent across calls.
90
+ */
91
+ export declare function buildHardwareVerifiers(config?: HardwareVerifierBundleConfig): HardwareAttestationVerifiers;
92
+ //# sourceMappingURL=adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAIxF,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,UAAU,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,oCAAoC,CAAC,EAAE,MAAM,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,4BAA4B,GACpC,4BAA4B,CA2B9B"}
@@ -0,0 +1,52 @@
1
+ import { deviceCheckVerifier, APPLE_APPATTEST_ROOT_PEM } from "@motebit/crypto-appattest";
2
+ import { playIntegrityVerifier } from "@motebit/crypto-play-integrity";
3
+ import { tpmVerifier } from "@motebit/crypto-tpm";
4
+ import { webauthnVerifier, DEFAULT_FIDO_ROOTS } from "@motebit/crypto-webauthn";
5
+ /** Motebit's canonical iOS / Android app identifier. */
6
+ const DEFAULT_BUNDLE_ID = "com.motebit.mobile";
7
+ /** Motebit's canonical Relying Party ID for WebAuthn credentials. */
8
+ const DEFAULT_WEBAUTHN_RP_ID = "motebit.com";
9
+ /**
10
+ * Build the full `HardwareAttestationVerifiers` object covering all four
11
+ * platform adapters. Pass the result to `verifyFile`:
12
+ *
13
+ * ```ts
14
+ * import { verifyFile } from "@motebit/verifier";
15
+ * import { buildHardwareVerifiers } from "@motebit/verify";
16
+ *
17
+ * const result = await verifyFile("cred.json", {
18
+ * hardwareAttestation: buildHardwareVerifiers(),
19
+ * });
20
+ * ```
21
+ *
22
+ * Pure function: every dependency is captured at factory time and the
23
+ * returned verifiers are idempotent across calls.
24
+ */
25
+ export function buildHardwareVerifiers(config) {
26
+ const appAttestBundleId = config?.appAttestBundleId ?? DEFAULT_BUNDLE_ID;
27
+ const playIntegrityPackageName = config?.playIntegrityPackageName ?? DEFAULT_BUNDLE_ID;
28
+ const webauthnRpId = config?.webauthnRpId ?? DEFAULT_WEBAUTHN_RP_ID;
29
+ return {
30
+ deviceCheck: deviceCheckVerifier({
31
+ expectedBundleId: appAttestBundleId,
32
+ rootPem: config?.appAttestRootPem ?? APPLE_APPATTEST_ROOT_PEM,
33
+ }),
34
+ tpm: tpmVerifier({
35
+ ...(config?.tpmRootPems !== undefined ? { rootPems: config.tpmRootPems } : {}),
36
+ }),
37
+ playIntegrity: playIntegrityVerifier({
38
+ expectedPackageName: playIntegrityPackageName,
39
+ ...(config?.playIntegrityPinnedJwks !== undefined
40
+ ? { pinnedJwks: config.playIntegrityPinnedJwks }
41
+ : {}),
42
+ ...(config?.playIntegrityRequiredDeviceIntegrity !== undefined
43
+ ? { requiredDeviceIntegrity: config.playIntegrityRequiredDeviceIntegrity }
44
+ : {}),
45
+ }),
46
+ webauthn: webauthnVerifier({
47
+ expectedRpId: webauthnRpId,
48
+ rootPems: config?.webauthnRootPems ?? DEFAULT_FIDO_ROOTS,
49
+ }),
50
+ };
51
+ }
52
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAmB,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAmDhF,wDAAwD;AACxD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,qEAAqE;AACrE,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAqC;IAErC,MAAM,iBAAiB,GAAG,MAAM,EAAE,iBAAiB,IAAI,iBAAiB,CAAC;IACzE,MAAM,wBAAwB,GAAG,MAAM,EAAE,wBAAwB,IAAI,iBAAiB,CAAC;IACvF,MAAM,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,sBAAsB,CAAC;IAEpE,OAAO;QACL,WAAW,EAAE,mBAAmB,CAAC;YAC/B,gBAAgB,EAAE,iBAAiB;YACnC,OAAO,EAAE,MAAM,EAAE,gBAAgB,IAAI,wBAAwB;SAC9D,CAAC;QACF,GAAG,EAAE,WAAW,CAAC;YACf,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC;QACF,aAAa,EAAE,qBAAqB,CAAC;YACnC,mBAAmB,EAAE,wBAAwB;YAC7C,GAAG,CAAC,MAAM,EAAE,uBAAuB,KAAK,SAAS;gBAC/C,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,uBAAuB,EAAE;gBAChD,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,MAAM,EAAE,oCAAoC,KAAK,SAAS;gBAC5D,CAAC,CAAC,EAAE,uBAAuB,EAAE,MAAM,CAAC,oCAAoC,EAAE;gBAC1E,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACF,QAAQ,EAAE,gBAAgB,CAAC;YACzB,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,MAAM,EAAE,gBAAgB,IAAI,kBAAkB;SACzD,CAAC;KACH,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `motebit-verify` CLI — the canonical motebit artifact verifier.
4
+ *
5
+ * Verifies identity files, execution receipts, credentials, and
6
+ * presentations against their embedded signatures. When a credential
7
+ * carries a `hardware_attestation` claim for `device_check` / `tpm` /
8
+ * `play_integrity` / `webauthn`, the bundled platform adapters verify
9
+ * the chain, nonce, bundle, and identity binding end-to-end.
10
+ *
11
+ * ```
12
+ * motebit-verify <file> # auto-detect, print human
13
+ * motebit-verify <file> --json # structured output
14
+ * motebit-verify <file> --expect credential
15
+ * motebit-verify <file> --clock-skew 30
16
+ *
17
+ * # Platform-specific overrides (all optional; defaults match
18
+ * # motebit's canonical identifiers).
19
+ * motebit-verify <file> \
20
+ * --bundle-id com.example.app \
21
+ * --android-package com.example.app \
22
+ * --rp-id example.com
23
+ * ```
24
+ *
25
+ * Exit codes:
26
+ * 0 artifact verified (including any hardware-attestation channel)
27
+ * 1 artifact detected but signature / hardware-channel invalid
28
+ * 2 usage / I/O error
29
+ *
30
+ * Network-free by design. Every adapter pins its own trust anchor
31
+ * (Apple App Attest Root CA, FIDO roots, TPM vendor roots); Play
32
+ * Integrity's JWKS is fail-closed by default until an operator lands
33
+ * real bytes (see `@motebit/crypto-play-integrity`'s CLAUDE.md).
34
+ *
35
+ * Three-package lineage — mirrors how tools like `git` / `libgit2` or
36
+ * `cargo` / `tokio` separate the verb-tool from the library layer:
37
+ *
38
+ * @motebit/verify — this CLI (Apache-2.0, bundles all 4 adapters)
39
+ * @motebit/verifier — Apache-2.0 library (file I/O, human formatting)
40
+ * @motebit/crypto — Apache-2.0 primitives (verify, sign, suite dispatch)
41
+ */
42
+ export {};
43
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG"}