@cloakapi/conformance 0.0.0-stage → 0.1.4
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 +202 -0
- package/NOTICE +9 -0
- package/README.md +128 -2
- package/THIRD-PARTY-NOTICES.md +9 -0
- package/TRADEMARKS.md +23 -0
- package/badge/attestation.js +47 -0
- package/badge/badge.html +40 -0
- package/badge/make-variants.mjs +40 -0
- package/badge/verified-by-cloakapi-dark.svg +16 -0
- package/badge/verified-by-cloakapi-light.svg +16 -0
- package/badge/verified-by-cloakapi.svg +43 -0
- package/bin/cloakapi-conformance.js +150 -0
- package/fixtures/chain-broken.json +74 -0
- package/fixtures/chain-pass.json +74 -0
- package/fixtures/countersigned-forged.json +52 -0
- package/fixtures/countersigned-pass.json +52 -0
- package/fixtures/engine-hashes-unpublished.json +8 -0
- package/fixtures/engine-hashes.json +10 -0
- package/fixtures/jwks.json +13 -0
- package/fixtures/receipt-bad-token-hash.json +36 -0
- package/fixtures/receipt-future-engine.json +36 -0
- package/fixtures/receipt-no-egress-claim.json +35 -0
- package/fixtures/receipt-pass.json +36 -0
- package/fixtures/receipt-raw-pii.json +36 -0
- package/fixtures/receipt-spoofed-hash.json +36 -0
- package/fixtures/receipt-stale-engine.json +36 -0
- package/fixtures/receipt-tampered.json +36 -0
- package/package.json +56 -4
- package/src/checks.js +570 -0
- package/src/index.js +120 -0
- package/vendor/cloakapi-verify.d.ts +121 -0
- package/vendor/cloakapi-verify.js +1350 -0
- package/vendor/strict-json.js +143 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2024-2026 Klokk Nettablering
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CloakAPI conformance
|
|
2
|
+
Copyright 2024-2026 Klokk Nettablering (org. no. 821 466 962, Norway)
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
"CloakAPI" is a trademark of Klokk Nettablering.
|
|
7
|
+
The conformance badge is self-attested ("Self-attested with CloakAPI conformance").
|
|
8
|
+
The Apache License does not grant permission to use them (section 6);
|
|
9
|
+
see TRADEMARKS.md.
|
package/README.md
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cloakapi/conformance
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A **self-attested** check of the **receipts and declared engine metadata** a
|
|
4
|
+
third-party integration supplies. A passing run is the evidence for the
|
|
5
|
+
**"Self-attested with CloakAPI conformance"** badge. It does not prove the
|
|
6
|
+
integration behaves correctly in deployment.
|
|
7
|
+
|
|
8
|
+
> **This is self-attested, not third-party certification.** You run this on receipts
|
|
9
|
+
> **your own** integration emitted. There is no hosted issuer signing off — a
|
|
10
|
+
> `CONFORMANT` verdict is *your own evidence-backed attestation*. That is deliberate
|
|
11
|
+
> (CloakAPI is a blind relay), which is exactly why the checks below are strict: the
|
|
12
|
+
> badge only means something if the check genuinely fails a non-conformant integration.
|
|
13
|
+
|
|
14
|
+
CloakAPI is designed as a **blind pure-relay** and does not inspect request content
|
|
15
|
+
as part of relay handling; this suite cannot audit your server. Instead, correctness is made
|
|
16
|
+
**falsifiable** (ADR-0014 §5 #6) from the **OpenReceipt v3 receipts** and the
|
|
17
|
+
**declared engine identity** your integration emits. This suite checks those
|
|
18
|
+
artifacts, with clear pass/fail — and is explicit about what it *cannot* prove.
|
|
19
|
+
|
|
20
|
+
It reuses the **same cryptography** as the shipped `@cloakapi/verify-widget`
|
|
21
|
+
(JCS → SHA-256 → P-256 raw `r‖s`). No signature verification is hand-rolled here.
|
|
22
|
+
|
|
23
|
+
## What it checks
|
|
24
|
+
|
|
25
|
+
| Check | What a PASS proves (and how it FAILS a fake) |
|
|
26
|
+
|-------|--------------------|
|
|
27
|
+
| `receipt-signatures` | Real ECDSA-P256 verification (WebCrypto). A tampered receipt, a malformed/short signature, a spliced countersignature whose `receipt_hash` doesn't match its receipt, or a **forged gateway countersignature that fails against the JWKS**, all FAIL. For a self-signed device receipt the *content* is tamper-evident but **issuer identity is self-asserted** — supply `--jwks` on a gateway-countersigned result to anchor identity to CloakAPI. |
|
|
28
|
+
| `engine-current` | The declared `engine_ruleset_version` is a valid semver **at/above the published floor** *and* **not newer than any published ruleset** (`GET /api/v1/engine/hashes`). A stale, fabricated, or non-semver version FAILS. |
|
|
29
|
+
| `engine-genuine` | The declared `engine_binary_hash` is a well-formed digest **on the official published allowlist** *and* self-consistent with the `genuine_engine` flag. An off-allowlist ("spoofed") hash, a malformed hash, a `genuine_engine=false` receipt, or a certified-hash/`genuine_engine≠true` mismatch all FAIL. Honestly `UNKNOWN` when the allowlist isn't published yet (no overclaim). |
|
|
30
|
+
| `client-side-tokenisation` | Checks the signed receipt's tokenisation claim, privacy tier, and `tokenised_body_hash`. A PASS validates the submitted claim fields; it does **not** prove that a detector ran, that a specific binary ran, or that detection was complete. |
|
|
31
|
+
|
|
32
|
+
**Verdict:** `CONFORMANT` only when nothing FAILs **and** the signature + client-side
|
|
33
|
+
tokenisation checks both PASS. `NON-CONFORMANT` if anything fails.
|
|
34
|
+
`INCONCLUSIVE` if nothing failed but there wasn't enough provable evidence to certify.
|
|
35
|
+
`report.selfAttested` is `false` when the receipts are gateway-countersigned and
|
|
36
|
+
JWKS-verified (identity anchored); otherwise it is `true`.
|
|
37
|
+
|
|
38
|
+
## What it honestly CANNOT prove
|
|
39
|
+
|
|
40
|
+
The CLI prints these caveats, which are also carried verbatim in its attestations:
|
|
41
|
+
|
|
42
|
+
- **This is self-attested, not an audit.** You run it on receipts you supply.
|
|
43
|
+
- A self-signed device receipt is tamper-evident but its **issuer identity is self-asserted** — only a gateway countersignature (`--jwks`) cryptographically anchors it to CloakAPI. Without one, a receipt could in principle be produced by any key.
|
|
44
|
+
- CloakAPI is blind to your server — this verifies the **artifacts you emit**, not your server internals.
|
|
45
|
+
- **PII detection is best-effort and can miss content.** A PASS validates claims in supplied receipts; it does **not** prove that the tokeniser ran or that all PII tokens were caught. This is not a "100% safe" claim.
|
|
46
|
+
- It checks the receipts you **supply**; it can't prove you emit one for each request. Pair it with the end-user `@cloakapi/verify-widget` so your users verify live sessions themselves.
|
|
47
|
+
|
|
48
|
+
## CLI
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# The served tarball cloakapi-conformance-0.1.0.tgz was withdrawn (HTTP 410).
|
|
52
|
+
# Its verifier accepts malformed v3 receipts that omit required fields.
|
|
53
|
+
# The SDK packages are being republished for ruleset 1.6.1. The earlier builds were withdrawn.
|
|
54
|
+
# Do not install that tarball, and do not install the unscoped npm name.
|
|
55
|
+
# No conformance package is offered until a fixed build is listed.
|
|
56
|
+
# From a checkout of this source (not the withdrawn download):
|
|
57
|
+
node bin/cloakapi-conformance.js --receipts ./session.json
|
|
58
|
+
|
|
59
|
+
# Offline / air-gapped: supply the floor yourself.
|
|
60
|
+
cloakapi-conformance -r ./session.json --engine-hashes ./engine-hashes.json
|
|
61
|
+
cloakapi-conformance -r ./session.json --floor 1.4.0 --allowlist aaa...,bbb...
|
|
62
|
+
|
|
63
|
+
# Also verify a gateway countersignature against a JWKS.
|
|
64
|
+
cloakapi-conformance -r ./cs-result.json --jwks ./jwks.json
|
|
65
|
+
|
|
66
|
+
# Machine-readable, for CI.
|
|
67
|
+
cloakapi-conformance -r ./session.json --json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Exit codes: `0` CONFORMANT · `1` NON-CONFORMANT · `2` INCONCLUSIVE · `3` usage error.
|
|
71
|
+
|
|
72
|
+
## Programmatic API
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import { runConformance, fetchEngineHashes } from '@cloakapi/conformance';
|
|
76
|
+
|
|
77
|
+
const engineHashes = await fetchEngineHashes('https://api.cloakapi.io');
|
|
78
|
+
const report = await runConformance(receipts, { engineHashes /*, jwksJson, floorOverride, allowlistOverride */ });
|
|
79
|
+
|
|
80
|
+
report.conformant; // boolean
|
|
81
|
+
report.verdict; // 'CONFORMANT' | 'NON-CONFORMANT' | 'INCONCLUSIVE'
|
|
82
|
+
report.checks; // [{ id, title, status, detail }]
|
|
83
|
+
report.limitations; // honest, unprovable-by-a-blind-relay caveats
|
|
84
|
+
report.disclaimer; // the no-100% statement (do not drop it)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## The "Self-attested with CloakAPI conformance" badge
|
|
88
|
+
|
|
89
|
+
The SVG files keep the historical names `verified-by-cloakapi.svg` (and the
|
|
90
|
+
`-light` / `-dark` variants). Their accessible name and the words drawn in the
|
|
91
|
+
image are **Self-attested** / **conformance**. A
|
|
92
|
+
passing run is self-attested: this package does not issue, register or sign
|
|
93
|
+
the badge.
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<a href="https://your-app.example/verify">
|
|
97
|
+
<img src="verified-by-cloakapi.svg" alt="Self-attested with CloakAPI conformance" height="44">
|
|
98
|
+
</a>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- `verified-by-cloakapi.svg` — **adaptive** (follows the viewer's light/dark preference).
|
|
102
|
+
- `verified-by-cloakapi-light.svg` / `-dark.svg` — fixed-theme variants for renderers
|
|
103
|
+
that strip `<style>` (GitHub README, some email clients); use with `<picture>`.
|
|
104
|
+
- Self-contained, dependency-free badge assets; the SVG includes its own mark and styles.
|
|
105
|
+
|
|
106
|
+
**Badge ⇄ conformance wiring.** `badge/attestation.js` turns a run into a
|
|
107
|
+
**content-free** conformance *attestation* (verdict + per-check statuses + engine
|
|
108
|
+
floor + receipt JTIs + timestamp; it excludes PII and receipt bodies) — the artifact you
|
|
109
|
+
host next to your badge and/or submit for issuance.
|
|
110
|
+
|
|
111
|
+
**Issuance is honest about reality (GROUND-TRUTH):** automated
|
|
112
|
+
issuance/registry is not available in this release. The badge is a **trademark-governed claim**, not
|
|
113
|
+
a cryptographic entitlement — displaying it requires a *currently-passing* run and
|
|
114
|
+
honest wording per [`docs/governance/verified-by-cloakapi.md`](../../../docs/governance/verified-by-cloakapi.md).
|
|
115
|
+
Any manual review/registry is a human step via `trust@cloakapi.io`.
|
|
116
|
+
|
|
117
|
+
## Develop
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
node fixtures/generate.mjs # regenerate the real signed fixtures
|
|
121
|
+
node badge/make-variants.mjs # regenerate fixed-theme badge SVGs
|
|
122
|
+
node --test test/ # run the suite (no mocks — real signatures verified)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Apache-2.0.
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Apache-2.0 © 2024-2026 Klokk Nettablering. See LICENSE and NOTICE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
notice-profile: thin
|
|
4
|
+
|
|
5
|
+
This file lists third-party software and data shipped with this package.
|
|
6
|
+
It replaces the monorepo-wide pnpm table, which is not the contents of this tarball.
|
|
7
|
+
|
|
8
|
+
This package does not bundle the CloakAPI detection engine, the GeoNames
|
|
9
|
+
place-name data, or the Faker name gazetteer.
|
package/TRADEMARKS.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# CloakAPI trademark policy
|
|
2
|
+
|
|
3
|
+
"CloakAPI" and the CloakAPI logo are trademarks of Klokk Nettablering,
|
|
4
|
+
Norway. The Apache License 2.0 does not license them (section 6).
|
|
5
|
+
|
|
6
|
+
The conformance badge is self-attested ("Self-attested with CloakAPI conformance").
|
|
7
|
+
CloakAPI does not offer a separate verification mark for
|
|
8
|
+
that badge. A passing local check is not a certification.
|
|
9
|
+
|
|
10
|
+
You may:
|
|
11
|
+
- say truthfully that your software uses, or works with, the CloakAPI SDK;
|
|
12
|
+
- keep and reproduce the NOTICE file, as the license requires;
|
|
13
|
+
- show the self-attested badge on a build that passed the conformance check
|
|
14
|
+
you ran yourself, as described at https://docs.cloakapi.io/platform/verify-badge.
|
|
15
|
+
|
|
16
|
+
You may not:
|
|
17
|
+
- call a modified version "CloakAPI" or "CloakAPI SDK", or publish it under
|
|
18
|
+
the @cloakapi scope or a name that suggests it comes from us;
|
|
19
|
+
- show a badge that says CloakAPI verified or certified the build;
|
|
20
|
+
- suggest that we endorse, support or certify a modified version.
|
|
21
|
+
|
|
22
|
+
If you change the SDK, give your version a different name and say that it
|
|
23
|
+
is not an official CloakAPI release. Questions: trust@cloakapi.io
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* badge/attestation.js — turn a conformance REPORT into a content-free
|
|
3
|
+
* conformance ATTESTATION artifact (the thing that maps a passing run to the
|
|
4
|
+
* "Self-attested with CloakAPI conformance" badge).
|
|
5
|
+
*
|
|
6
|
+
* ISSUANCE MODEL — HONEST (no fake backend, GROUND-TRUTH):
|
|
7
|
+
* There is NO automated badge-issuance/registry service today. This function
|
|
8
|
+
* produces the artifact a builder attaches next to their badge and/or submits
|
|
9
|
+
* for MANUAL issuance (email trust@cloakapi.io → Rolf reviews). The badge is a
|
|
10
|
+
* TRADEMARK-governed claim (see docs/governance/verified-by-cloakapi.md), not a
|
|
11
|
+
* cryptographic entitlement: displaying it requires a currently-passing run.
|
|
12
|
+
*
|
|
13
|
+
* The attestation is CONTENT-FREE: it records only verdict + per-check statuses,
|
|
14
|
+
* the engine floor it was measured against, the receipt JTIs covered, the suite
|
|
15
|
+
* version, and a timestamp. It contains NO PII and NO receipt bodies. A builder
|
|
16
|
+
* MAY sign it with their own key; this module does not run a signing backend.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import('../src/index.js').ConformanceReport} report
|
|
21
|
+
* @param {{ suiteVersion?: string, integration?: string, engineFloor?: string|null }} [meta]
|
|
22
|
+
*/
|
|
23
|
+
export function buildAttestation(report, meta = {}) {
|
|
24
|
+
return {
|
|
25
|
+
kind: 'cloakapi-conformance-attestation',
|
|
26
|
+
spec: 'openreceipt-v3',
|
|
27
|
+
suite: '@cloakapi/conformance',
|
|
28
|
+
suite_version: meta.suiteVersion || '0.1.3',
|
|
29
|
+
integration: meta.integration || null,
|
|
30
|
+
engine_floor: meta.engineFloor ?? null,
|
|
31
|
+
verdict: report.verdict,
|
|
32
|
+
conformant: report.conformant,
|
|
33
|
+
checks: report.checks.map((c) => ({ id: c.id, status: c.status })),
|
|
34
|
+
counts: report.counts,
|
|
35
|
+
generated_at: report.generatedAt,
|
|
36
|
+
// Verbatim honesty carriers — a badge display MUST NOT drop these.
|
|
37
|
+
disclaimer: report.disclaimer,
|
|
38
|
+
limitations: report.limitations,
|
|
39
|
+
issuance:
|
|
40
|
+
'Self-attested from a conformance run. The badge text is "Self-attested with CloakAPI conformance". Display requires a currently-passing run and wording that stays inside what the run checked. There is no automated issuance backend.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** True only if this attestation currently entitles badge display (per governance). */
|
|
45
|
+
export function entitlesBadge(attestation) {
|
|
46
|
+
return attestation && attestation.conformant === true && attestation.verdict === 'CONFORMANT';
|
|
47
|
+
}
|
package/badge/badge.html
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<meta charset="utf-8">
|
|
3
|
+
<title>Self-attested with CloakAPI conformance — badge preview</title>
|
|
4
|
+
<!--
|
|
5
|
+
Preview of the self-contained badge assets on both themes. Nothing here is
|
|
6
|
+
loaded from a network; the SVGs are dependency-free. Builders embed the badge
|
|
7
|
+
with a plain <img> linking to their verification page (see README).
|
|
8
|
+
-->
|
|
9
|
+
<style>
|
|
10
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;margin:0}
|
|
11
|
+
.row{padding:28px 32px;display:flex;gap:22px;align-items:center}
|
|
12
|
+
.light{background:#f4f6fb;color:#10233b}
|
|
13
|
+
.dark{background:#0b1120;color:#e8eef7}
|
|
14
|
+
h1{font-size:15px;font-weight:700;margin:0 0 2px}
|
|
15
|
+
small{opacity:.7}
|
|
16
|
+
code{font-size:12px}
|
|
17
|
+
</style>
|
|
18
|
+
|
|
19
|
+
<div class="row light">
|
|
20
|
+
<a href="#" rel="noopener"><img src="verified-by-cloakapi-light.svg" alt="Self-attested with CloakAPI conformance" height="44"></a>
|
|
21
|
+
<div><h1>Light theme</h1><small>verified-by-cloakapi-light.svg</small></div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="row dark">
|
|
25
|
+
<a href="#" rel="noopener"><img src="verified-by-cloakapi-dark.svg" alt="Self-attested with CloakAPI conformance" height="44"></a>
|
|
26
|
+
<div><h1>Dark theme</h1><small>verified-by-cloakapi-dark.svg</small></div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="row light">
|
|
30
|
+
<a href="#" rel="noopener"><img src="verified-by-cloakapi.svg" alt="Self-attested with CloakAPI conformance" height="44"></a>
|
|
31
|
+
<div><h1>Adaptive</h1><small>verified-by-cloakapi.svg — follows the viewer's light/dark preference (when <style> is honoured)</small></div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="row light">
|
|
35
|
+
<div>
|
|
36
|
+
<h1>Embed</h1>
|
|
37
|
+
<p><code><a href="https://your-app.example/verify"><img src="verified-by-cloakapi.svg" alt="Self-attested with CloakAPI conformance" height="44"></a></code></p>
|
|
38
|
+
<p><small>Link the badge to a page that runs the end-user verify-widget so anyone can check a live session. Display requires a currently-passing conformance run — see the governance doc.</small></p>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emit fixed-theme badge variants (light/dark) from the adaptive master.
|
|
3
|
+
* Some renderers (GitHub README sanitiser, some email clients) strip <style>,
|
|
4
|
+
* so we inline concrete colours. Run: node badge/make-variants.mjs
|
|
5
|
+
*/
|
|
6
|
+
import { writeFileSync } from 'node:fs';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { dirname, join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
const THEMES = {
|
|
13
|
+
light: { bg: '#ffffff', border: '#e2e8f0', fg: '#10233b', muted: '#5b6b7f', brand: '#6C5CE7' },
|
|
14
|
+
dark: { bg: '#0f1826', border: '#25344a', fg: '#e8eef7', muted: '#9db0c6', brand: '#8b7cf0' },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function svg(t) {
|
|
18
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="232" height="44" viewBox="0 0 232 44" role="img" aria-label="Self-attested with CloakAPI conformance">
|
|
19
|
+
<title>Self-attested with CloakAPI conformance</title>
|
|
20
|
+
<rect x="0.75" y="0.75" width="230.5" height="42.5" rx="9" fill="${t.bg}" stroke="${t.border}" stroke-width="1.5"/>
|
|
21
|
+
<g transform="translate(10,5) scale(0.53)" fill="none" stroke="${t.brand}" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round">
|
|
22
|
+
<path d="M14 14 L32 8 L50 14 L50 34 L32 56 L14 34 Z"/>
|
|
23
|
+
<path d="M24 22 L32 20 L40 22 L40 32 L32 44 L24 32 Z"/>
|
|
24
|
+
<circle cx="32" cy="30" r="2.6" fill="${t.brand}" stroke="none"/>
|
|
25
|
+
<path d="M30.4 32 L31.4 38 L32.6 38 L33.6 32 Z" fill="${t.brand}" stroke="none"/>
|
|
26
|
+
</g>
|
|
27
|
+
<g transform="translate(30,25)">
|
|
28
|
+
<circle cx="0" cy="0" r="8" fill="${t.brand}"/>
|
|
29
|
+
<path d="M-3.4 0.2 L-1 2.6 L3.6 -2.6" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
30
|
+
</g>
|
|
31
|
+
<text x="52" y="18" fill="${t.muted}" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="9" font-weight="600" letter-spacing="1.2">SELF-ATTESTED</text>
|
|
32
|
+
<text x="52" y="34" fill="${t.fg}" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="15" font-weight="700" letter-spacing="0.2">conformance</text>
|
|
33
|
+
</svg>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (const [name, t] of Object.entries(THEMES)) {
|
|
38
|
+
writeFileSync(join(HERE, `verified-by-cloakapi-${name}.svg`), svg(t));
|
|
39
|
+
}
|
|
40
|
+
console.log('wrote verified-by-cloakapi-light.svg / -dark.svg');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="232" height="44" viewBox="0 0 232 44" role="img" aria-label="Self-attested with CloakAPI conformance">
|
|
2
|
+
<title>Self-attested with CloakAPI conformance</title>
|
|
3
|
+
<rect x="0.75" y="0.75" width="230.5" height="42.5" rx="9" fill="#0f1826" stroke="#25344a" stroke-width="1.5"/>
|
|
4
|
+
<g transform="translate(10,5) scale(0.53)" fill="none" stroke="#8b7cf0" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round">
|
|
5
|
+
<path d="M14 14 L32 8 L50 14 L50 34 L32 56 L14 34 Z"/>
|
|
6
|
+
<path d="M24 22 L32 20 L40 22 L40 32 L32 44 L24 32 Z"/>
|
|
7
|
+
<circle cx="32" cy="30" r="2.6" fill="#8b7cf0" stroke="none"/>
|
|
8
|
+
<path d="M30.4 32 L31.4 38 L32.6 38 L33.6 32 Z" fill="#8b7cf0" stroke="none"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="translate(30,25)">
|
|
11
|
+
<circle cx="0" cy="0" r="8" fill="#8b7cf0"/>
|
|
12
|
+
<path d="M-3.4 0.2 L-1 2.6 L3.6 -2.6" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
13
|
+
</g>
|
|
14
|
+
<text x="52" y="18" fill="#9db0c6" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="9" font-weight="600" letter-spacing="1.2">SELF-ATTESTED</text>
|
|
15
|
+
<text x="52" y="34" fill="#e8eef7" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="15" font-weight="700" letter-spacing="0.2">conformance</text>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="232" height="44" viewBox="0 0 232 44" role="img" aria-label="Self-attested with CloakAPI conformance">
|
|
2
|
+
<title>Self-attested with CloakAPI conformance</title>
|
|
3
|
+
<rect x="0.75" y="0.75" width="230.5" height="42.5" rx="9" fill="#ffffff" stroke="#e2e8f0" stroke-width="1.5"/>
|
|
4
|
+
<g transform="translate(10,5) scale(0.53)" fill="none" stroke="#6C5CE7" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round">
|
|
5
|
+
<path d="M14 14 L32 8 L50 14 L50 34 L32 56 L14 34 Z"/>
|
|
6
|
+
<path d="M24 22 L32 20 L40 22 L40 32 L32 44 L24 32 Z"/>
|
|
7
|
+
<circle cx="32" cy="30" r="2.6" fill="#6C5CE7" stroke="none"/>
|
|
8
|
+
<path d="M30.4 32 L31.4 38 L32.6 38 L33.6 32 Z" fill="#6C5CE7" stroke="none"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="translate(30,25)">
|
|
11
|
+
<circle cx="0" cy="0" r="8" fill="#6C5CE7"/>
|
|
12
|
+
<path d="M-3.4 0.2 L-1 2.6 L3.6 -2.6" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
13
|
+
</g>
|
|
14
|
+
<text x="52" y="18" fill="#5b6b7f" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="9" font-weight="600" letter-spacing="1.2">SELF-ATTESTED</text>
|
|
15
|
+
<text x="52" y="34" fill="#10233b" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="15" font-weight="700" letter-spacing="0.2">conformance</text>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="232" height="44" viewBox="0 0 232 44" role="img" aria-label="Self-attested with CloakAPI conformance">
|
|
2
|
+
<title>Self-attested with CloakAPI conformance</title>
|
|
3
|
+
<!--
|
|
4
|
+
Self-contained badge. Visible words: SELF-ATTESTED / conformance.
|
|
5
|
+
Accessible name: Self-attested with CloakAPI conformance.
|
|
6
|
+
Theme-aware: adapts to the viewer's light/dark preference via an embedded
|
|
7
|
+
@media(prefers-color-scheme) rule (honoured when rendered as an <img>/inline
|
|
8
|
+
SVG). For contexts that strip <style> (e.g. GitHub README sanitiser) use the
|
|
9
|
+
fixed variants verified-by-cloakapi-light.svg / -dark.svg with <picture>.
|
|
10
|
+
Brand: canonical hexagonal shield + keyhole, #6C5CE7 (cloakapi-symbol.svg).
|
|
11
|
+
-->
|
|
12
|
+
<style>
|
|
13
|
+
:root{
|
|
14
|
+
--bg:#ffffff; --border:#e2e8f0; --fg:#10233b; --muted:#5b6b7f; --brand:#6C5CE7;
|
|
15
|
+
}
|
|
16
|
+
@media (prefers-color-scheme: dark){
|
|
17
|
+
:root{ --bg:#0f1826; --border:#25344a; --fg:#e8eef7; --muted:#9db0c6; --brand:#8b7cf0; }
|
|
18
|
+
}
|
|
19
|
+
.bg{fill:var(--bg);stroke:var(--border)}
|
|
20
|
+
.brand{fill:var(--brand)}
|
|
21
|
+
.brandstroke{stroke:var(--brand)}
|
|
22
|
+
.kicker{fill:var(--muted)}
|
|
23
|
+
.word{fill:var(--fg)}
|
|
24
|
+
</style>
|
|
25
|
+
<rect class="bg" x="0.75" y="0.75" width="230.5" height="42.5" rx="9" stroke-width="1.5"/>
|
|
26
|
+
|
|
27
|
+
<!-- Shield mark (from cloakapi-symbol.svg), scaled + centred in a 34px box at x=10 -->
|
|
28
|
+
<g transform="translate(10,5) scale(0.53)" fill="none" class="brandstroke" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round">
|
|
29
|
+
<path d="M14 14 L32 8 L50 14 L50 34 L32 56 L14 34 Z"/>
|
|
30
|
+
<path d="M24 22 L32 20 L40 22 L40 32 L32 44 L24 32 Z"/>
|
|
31
|
+
<circle cx="32" cy="30" r="2.6" class="brand" stroke="none"/>
|
|
32
|
+
<path d="M30.4 32 L31.4 38 L32.6 38 L33.6 32 Z" class="brand" stroke="none"/>
|
|
33
|
+
</g>
|
|
34
|
+
|
|
35
|
+
<!-- Verified check chip on the shield's shoulder -->
|
|
36
|
+
<g transform="translate(30,25)">
|
|
37
|
+
<circle cx="0" cy="0" r="8" class="brand"/>
|
|
38
|
+
<path d="M-3.4 0.2 L-1 2.6 L3.6 -2.6" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
39
|
+
</g>
|
|
40
|
+
|
|
41
|
+
<text x="52" y="18" class="kicker" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="9" font-weight="600" letter-spacing="1.2">SELF-ATTESTED</text>
|
|
42
|
+
<text x="52" y="34" class="word" font-family="system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif" font-size="15" font-weight="700" letter-spacing="0.2">conformance</text>
|
|
43
|
+
</svg>
|