@motebit/verify 0.7.0 → 1.1.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 +198 -18
- package/NOTICE +19 -0
- package/README.md +92 -69
- package/dist/adapters.d.ts +132 -0
- package/dist/adapters.d.ts.map +1 -0
- package/dist/adapters.js +74 -0
- package/dist/adapters.js.map +1 -0
- package/dist/cli.d.ts +45 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +317 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +25 -230
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -1513
- package/dist/index.js.map +1 -1
- package/package.json +38 -16
package/LICENSE
CHANGED
|
@@ -1,26 +1,206 @@
|
|
|
1
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
4
6
|
|
|
5
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
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
|
-
"
|
|
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,125 @@
|
|
|
1
1
|
# @motebit/verify
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The canonical `motebit-verify` command-line tool. A single binary that verifies any signed motebit artifact — identity files, execution receipts, credentials, presentations — including credentials carrying hardware-attestation claims under any of the four canonical sovereign-verifiable platforms (Apple App Attest, Android Hardware-Backed Keystore Attestation, TPM 2.0, WebAuthn) plus the deprecated Play Integrity adapter bundled for one minor cycle for backward compat with already-minted credentials.
|
|
4
4
|
|
|
5
|
-
|
|
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 every currently-shipped platform:
|
|
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
|
+
| `android_keystore` | `@motebit/crypto-android-keystore` | Pinned Google Hardware Attestation roots (RSA + ECDSA P-384) |
|
|
37
|
+
| `webauthn` | `@motebit/crypto-webauthn` | Pinned Apple / Yubico / Microsoft FIDO roots |
|
|
38
|
+
| `play_integrity` _(deprecated)_ | `@motebit/crypto-play-integrity` | Operator-supplied JWKS (no global Google JWKS exists; bundled for one minor cycle for backward compat — see `docs/doctrine/hardware-attestation.md`) |
|
|
39
|
+
|
|
40
|
+
Unknown platform → named error, fail-closed. Missing adapter context → named error, fail-closed. Never silent acceptance.
|
|
41
|
+
|
|
13
42
|
## Usage
|
|
14
43
|
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
}
|
|
44
|
+
```bash
|
|
45
|
+
motebit-verify <file> # auto-detect, print human-readable
|
|
46
|
+
motebit-verify <file> --json # structured JSON output
|
|
47
|
+
motebit-verify <file> --expect credential # pin expected artifact type
|
|
48
|
+
motebit-verify <file> --clock-skew 30 # allow N seconds of clock drift
|
|
49
|
+
|
|
50
|
+
# Platform overrides (defaults match motebit's canonical identifiers)
|
|
51
|
+
motebit-verify <file> \
|
|
52
|
+
--bundle-id com.example.app \
|
|
53
|
+
--android-attestation-application-id ./app-id.bin \
|
|
54
|
+
--android-package com.example.app \
|
|
55
|
+
--rp-id example.com
|
|
47
56
|
```
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
**Verifying `android_keystore` credentials requires `--android-attestation-application-id`.** The flag's value is a path to a binary file containing the raw bytes of the leaf cert's `attestationApplicationId` extension — operators capture this once at build time (deterministic from the registered Android package name + signing-cert SHA-256) and commit the file alongside other pinned config. Without the flag, the Android Keystore arm is intentionally unwired (passing a placeholder would false-reject every real claim); the dispatcher reports `"verifier not wired"`. The legacy `--android-package` flag still configures the deprecated Play Integrity adapter for backward-compat with already-minted credentials.
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
Exit codes:
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
62
|
+
- `0` — artifact verified (including hardware-attestation channel)
|
|
63
|
+
- `1` — artifact detected but signature / hardware channel invalid
|
|
64
|
+
- `2` — usage or I/O error
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
## Programmatic use
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
import { parse } from "@motebit/verify";
|
|
68
|
+
The CLI is a thin wrapper — every capability is available programmatically:
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
```ts
|
|
71
|
+
import { verifyFile } from "@motebit/verifier"; // Apache-2.0 library (file I/O + formatting)
|
|
72
|
+
import { buildHardwareVerifiers } from "@motebit/verify"; // Apache-2.0 CLI + programmatic adapter bundle
|
|
73
|
+
|
|
74
|
+
const result = await verifyFile("cred.json", {
|
|
75
|
+
hardwareAttestation: buildHardwareVerifiers(),
|
|
76
|
+
});
|
|
65
77
|
```
|
|
66
78
|
|
|
67
|
-
##
|
|
79
|
+
## The three-package lineage
|
|
68
80
|
|
|
69
|
-
|
|
81
|
+
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
82
|
|
|
71
|
-
|
|
83
|
+
```
|
|
84
|
+
@motebit/verify Apache-2.0 the CLI motebit-verify + bundled adapters (the tool — this package)
|
|
85
|
+
@motebit/verifier Apache-2.0 library: verifyFile, verifyArtifact, formatHuman
|
|
86
|
+
@motebit/crypto Apache-2.0 primitives: verify, sign, suite dispatch
|
|
87
|
+
```
|
|
72
88
|
|
|
73
|
-
-
|
|
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`
|
|
89
|
+
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
90
|
|
|
77
|
-
|
|
91
|
+
- 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.
|
|
92
|
+
- 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 bundled platform adapters.
|
|
93
|
+
- Install **`@motebit/crypto`** when you want the primitives — the verify dispatcher, sign APIs, suite registry — to build your own verification tooling from scratch.
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
## Superseding the deprecated `@motebit/verify@0.x`
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
The original `@motebit/verify@0.7.0` was a zero-dep MIT library with a single `verify()` function. It was deprecated and split:
|
|
82
98
|
|
|
83
|
-
|
|
99
|
+
- **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.
|
|
100
|
+
- **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`.
|
|
101
|
+
- **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
102
|
|
|
85
|
-
|
|
103
|
+
If you were on `@motebit/verify@^0.7.0`, migration depends on what you were using:
|
|
86
104
|
|
|
87
|
-
|
|
105
|
+
| You were using | Migrate to |
|
|
106
|
+
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
|
|
107
|
+
| The `verify()` function in TypeScript | `import { verify } from "@motebit/crypto"` — same shape, more features |
|
|
108
|
+
| `verifyFile()` / `formatHuman()` / programmatic CLI wrappers | `import { ... } from "@motebit/verifier"` |
|
|
109
|
+
| Running `motebit-verify` on the command line | `npm install -g @motebit/verify` at `^1.0.0` — same command, full platform coverage |
|
|
88
110
|
|
|
89
|
-
|
|
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 |
|
|
111
|
+
## Related
|
|
95
112
|
|
|
96
|
-
|
|
113
|
+
- [`@motebit/verifier`](https://www.npmjs.com/package/@motebit/verifier) — Apache-2.0 library underneath this CLI (`verifyFile`, `verifyArtifact`, `formatHuman`)
|
|
114
|
+
- [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto) — Apache-2.0 primitives (`verify`, `sign`, suite dispatch; zero monorepo deps)
|
|
115
|
+
- [`@motebit/crypto-appattest`](https://www.npmjs.com/package/@motebit/crypto-appattest) — Apple App Attest adapter bundled into this CLI
|
|
116
|
+
- [`@motebit/crypto-play-integrity`](https://www.npmjs.com/package/@motebit/crypto-play-integrity) — Google Play Integrity adapter bundled into this CLI
|
|
117
|
+
- [`@motebit/crypto-tpm`](https://www.npmjs.com/package/@motebit/crypto-tpm) — TPM 2.0 EK chain adapter bundled into this CLI
|
|
118
|
+
- [`@motebit/crypto-webauthn`](https://www.npmjs.com/package/@motebit/crypto-webauthn) — WebAuthn packed-attestation adapter bundled into this CLI
|
|
119
|
+
- [`motebit`](https://www.npmjs.com/package/motebit) — reference runtime and operator console
|
|
97
120
|
|
|
98
121
|
## License
|
|
99
122
|
|
|
100
|
-
|
|
123
|
+
Apache-2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
|
|
101
124
|
|
|
102
|
-
"Motebit" is a trademark. The
|
|
125
|
+
"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,132 @@
|
|
|
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 leaves
|
|
6
|
+
* itself; that keeps it dep-thin. This Apache-2.0 aggregator imports
|
|
7
|
+
* every leaf (`@motebit/crypto-appattest`,
|
|
8
|
+
* `@motebit/crypto-android-keystore`, `@motebit/crypto-tpm`,
|
|
9
|
+
* `@motebit/crypto-webauthn`, plus the deprecated
|
|
10
|
+
* `@motebit/crypto-play-integrity` for backward compatibility during
|
|
11
|
+
* its 1.x deprecation cycle) and produces a single
|
|
12
|
+
* `HardwareAttestationVerifiers` object the CLI hands to `verifyFile`.
|
|
13
|
+
* Any credential whose subject carries a hardware-attestation claim
|
|
14
|
+
* for any of the canonical platforms now verifies end-to-end — chain
|
|
15
|
+
* + nonce + bundle + identity — instead of returning the
|
|
16
|
+
* `adapter not yet shipped` sentinel.
|
|
17
|
+
*
|
|
18
|
+
* Defaults match motebit's canonical app identifiers:
|
|
19
|
+
* - App Attest → bundleId `com.motebit.mobile`
|
|
20
|
+
* - Android Keystore → caller-supplied attestationApplicationId (no
|
|
21
|
+
* canonical default — the bytes are
|
|
22
|
+
* deterministic from `(packageName, signing-cert
|
|
23
|
+
* SHA-256)` known at the operator's build time;
|
|
24
|
+
* no analogous "magic string" fits)
|
|
25
|
+
* - WebAuthn → rpId `motebit.com`
|
|
26
|
+
* - TPM → the pinned vendor roots in `@motebit/crypto-tpm`
|
|
27
|
+
*
|
|
28
|
+
* Operators verifying credentials from a different motebit deployment
|
|
29
|
+
* can override any of these via the config parameter.
|
|
30
|
+
*
|
|
31
|
+
* Play Integrity (deprecated): wired for one minor cycle so
|
|
32
|
+
* already-minted credentials carrying `platform: "play_integrity"`
|
|
33
|
+
* continue to verify cleanly through the same CLI invocation. New
|
|
34
|
+
* mobile builds emit `platform: "android_keystore"` instead — see
|
|
35
|
+
* `docs/doctrine/hardware-attestation.md` § "Three architectural
|
|
36
|
+
* categories".
|
|
37
|
+
*/
|
|
38
|
+
import type { HardwareAttestationVerifiers } from "@motebit/crypto";
|
|
39
|
+
import { type GoogleJwks } from "@motebit/crypto-play-integrity";
|
|
40
|
+
export interface HardwareVerifierBundleConfig {
|
|
41
|
+
/**
|
|
42
|
+
* Apple App Attest — bundle ID the attested iOS app was built with.
|
|
43
|
+
* Defaults to `com.motebit.mobile`. Override when verifying credentials
|
|
44
|
+
* minted by a different motebit iOS build.
|
|
45
|
+
*/
|
|
46
|
+
readonly appAttestBundleId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Apple App Attest — override the pinned Apple App Attestation Root
|
|
49
|
+
* CA PEM. Defaults to the constant in `@motebit/crypto-appattest`.
|
|
50
|
+
* Exposed only so test fabrications can exercise the chain-validation
|
|
51
|
+
* code path with a fabricated root.
|
|
52
|
+
*/
|
|
53
|
+
readonly appAttestRootPem?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Android Hardware-Backed Keystore Attestation — `attestationApplicationId`
|
|
56
|
+
* bytes (raw, captured-from-leaf-cert form) the leaf cert MUST carry.
|
|
57
|
+
* Required at wiring time when verifying Android-Keystore-attested
|
|
58
|
+
* credentials. Operators compute this at build time as
|
|
59
|
+
* `(packageName, signing-cert SHA-256)` and pin the result here; the
|
|
60
|
+
* verifier byte-compares against the leaf's KeyDescription extension.
|
|
61
|
+
* Absent → the Android Keystore arm is not wired and the canonical
|
|
62
|
+
* dispatcher returns "verifier not wired".
|
|
63
|
+
*/
|
|
64
|
+
readonly androidKeystoreExpectedAttestationApplicationId?: Uint8Array;
|
|
65
|
+
/**
|
|
66
|
+
* Android Hardware-Backed Keystore Attestation — override the pinned
|
|
67
|
+
* Google attestation roots. Defaults to
|
|
68
|
+
* `DEFAULT_ANDROID_KEYSTORE_TRUST_ANCHORS` (RSA-4096 + ECDSA P-384,
|
|
69
|
+
* covering both pre- and post-rotation device fleets).
|
|
70
|
+
*/
|
|
71
|
+
readonly androidKeystoreRootPems?: ReadonlyArray<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Google Play Integrity (DEPRECATED) — Android package name the
|
|
74
|
+
* attested app was built with. Defaults to `com.motebit.mobile`.
|
|
75
|
+
* Wired during the `@motebit/crypto-play-integrity@1.x`
|
|
76
|
+
* deprecation cycle so already-minted credentials continue to
|
|
77
|
+
* verify; new mobile builds emit `platform: "android_keystore"`.
|
|
78
|
+
*/
|
|
79
|
+
readonly playIntegrityPackageName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Google Play Integrity (DEPRECATED) — override the pinned JWKS.
|
|
82
|
+
* Fail-closed by default — see the structural-mismatch note in
|
|
83
|
+
* `@motebit/crypto-play-integrity`'s CLAUDE.md (no global Google
|
|
84
|
+
* JWKS exists; this verifier is operator-key-mediated rather than
|
|
85
|
+
* sovereign-verifiable, which is why it's been deprecated).
|
|
86
|
+
*/
|
|
87
|
+
readonly playIntegrityPinnedJwks?: GoogleJwks;
|
|
88
|
+
/**
|
|
89
|
+
* Google Play Integrity (DEPRECATED) — relax the device-integrity
|
|
90
|
+
* floor. Defaults to the strict `"MEETS_DEVICE_INTEGRITY"`.
|
|
91
|
+
*/
|
|
92
|
+
readonly playIntegrityRequiredDeviceIntegrity?: string;
|
|
93
|
+
/**
|
|
94
|
+
* WebAuthn — Relying Party ID the credential was minted for.
|
|
95
|
+
* Defaults to `motebit.com`.
|
|
96
|
+
*/
|
|
97
|
+
readonly webauthnRpId?: string;
|
|
98
|
+
/**
|
|
99
|
+
* WebAuthn — override the pinned FIDO root set. Defaults to
|
|
100
|
+
* `DEFAULT_FIDO_ROOTS` (Apple Anonymous Attestation, Yubico, Microsoft).
|
|
101
|
+
*/
|
|
102
|
+
readonly webauthnRootPems?: ReadonlyArray<string>;
|
|
103
|
+
/**
|
|
104
|
+
* TPM — override the pinned vendor root PEMs. Defaults to the four
|
|
105
|
+
* TPM-vendor roots in `@motebit/crypto-tpm` (Infineon, Nuvoton,
|
|
106
|
+
* STMicro, Intel PTT).
|
|
107
|
+
*/
|
|
108
|
+
readonly tpmRootPems?: ReadonlyArray<string>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build the full `HardwareAttestationVerifiers` object covering every
|
|
112
|
+
* canonical platform adapter. Pass the result to `verifyFile`:
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { verifyFile } from "@motebit/verifier";
|
|
116
|
+
* import { buildHardwareVerifiers } from "@motebit/verify";
|
|
117
|
+
*
|
|
118
|
+
* const result = await verifyFile("cred.json", {
|
|
119
|
+
* hardwareAttestation: buildHardwareVerifiers({
|
|
120
|
+
* androidKeystoreExpectedAttestationApplicationId: appIdBytes,
|
|
121
|
+
* }),
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* Pure function: every dependency is captured at factory time and the
|
|
126
|
+
* returned verifiers are idempotent across calls. The Android Keystore
|
|
127
|
+
* arm is wired only when `androidKeystoreExpectedAttestationApplicationId`
|
|
128
|
+
* is supplied — there is no canonical default for the leaf-cert
|
|
129
|
+
* package binding, by design.
|
|
130
|
+
*/
|
|
131
|
+
export declare function buildHardwareVerifiers(config?: HardwareVerifierBundleConfig): HardwareAttestationVerifiers;
|
|
132
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAIpE,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;;;;;;;;;OASG;IACH,QAAQ,CAAC,+CAA+C,CAAC,EAAE,UAAU,CAAC;IACtE;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzD;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,UAAU,CAAC;IAC9C;;;OAGG;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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,4BAA4B,GACpC,4BAA4B,CA4C9B"}
|