Metadata-Version: 2.4
Name: attest-receipts
Version: 0.4.0
Summary: attest reference implementation (v0.1 and v0.2) — cryptographically-signed, offline-verifiable purchase receipts
Project-URL: Homepage, https://svm-98.github.io/attest/
Project-URL: Repository, https://github.com/SVM-98/attest
Project-URL: Documentation, https://github.com/SVM-98/attest/blob/main/docs/spec/attest-v0.2.md
Project-URL: Issues, https://github.com/SVM-98/attest/issues
Author: Samuele Martinalli
License: 
                                         Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: AUTHORS
License-File: LICENSE
License-File: LICENSE-docs
License-File: NOTICE
Keywords: consumer-protection,digital-purchases,ed25519,offline-verification,receipts
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: jsonschema>=4.21
Requires-Dist: pqcrypto==0.4.0
Requires-Dist: pynacl>=1.5
Provides-Extra: dev
Requires-Dist: dilithium-py>=1.4; extra == 'dev'
Requires-Dist: hypothesis>=6; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: pyyaml>=6; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# attest

**The store dies, the receipt survives.**

When a digital store shuts down or delists a title, buyers lose twice. The loud
loss is access: the game, book, or film stops working, and everyone talks about
that. The quiet loss is evidence: the only record that you ever paid lived in
the seller's database, so the proof of purchase dies at the same moment as
everything it could have proven — a refund, a dispute, a class action, a
preservation project's eligibility check. You go from "customer" to "nobody in
particular" the instant the server goes dark.

attest closes that second gap. It is an open standard and reference
implementation for signed purchase receipts the *buyer* holds: the store signs
a receipt once at checkout, the buyer keeps the file like a paper receipt, and
anyone can verify it offline, forever — even after the store is gone. It covers
any digital purchase: games, e-books, film and TV, music, software, courses.
No account, no wallet, no blockchain, no server that has to stay alive for the
proof to still work.

**Try it in your browser:** <https://svm-98.github.io/attest/> — drop a `.attest`
bundle (or the built-in sample) and watch it verify entirely client-side; the
page's CSP forbids it from talking to any other host.

## The problem

A digital "purchase" today is a revocable license living inside one company's
platform, not a thing you hold. When the platform shuts down, delists a title, or
changes terms, the buyer's library goes with it — regardless of medium: Robot Cache
bricked already-downloaded games at its May 2026 shutdown; Funimation wiped
customers' digital anime libraries in 2024; Kindle removed book export in
February 2025; Sony ends PlayStation disc production for new games in
January 2028, pushing more purchases into pure platform dependency. None of this is
hypothetical or gaming-specific — it is what "buy" already means for every kind of
digital media.

Policy is waking up to half of the problem. California's AB 2426 and Maryland's
[HB 208](https://mgaleg.maryland.gov/mgawebsite/Legislation/Details/hb0208?ys=2025RS)
require disclosure that a digital "purchase" is a license; the EU's Digital
Content Directive (2019/770) already grants consumers remedies when digital
content fails to conform; and in June 2026 the European Commission — answering
the 1.29-million-signature Stop Killing Games initiative — committed to an
industry code of conduct on video game end-of-life by the end of 2026. All of
those efforts are about access and disclosure. None of them puts proof of
purchase on the table — yet a right without evidence is unenforceable. Once the
seller's records are the only proof and the seller is gone, there is nothing
left to base a remedy on.

What's missing is not more disclosure law — it's an open technical standard for
a purchase record the buyer actually holds, independent of whether the seller
survives. That evidence layer is what attest is. Deliberately, it is *only*
that: attest does not keep content alive (see below), it makes sure that
whatever rights a buyer has can still be exercised after the store is gone.

## How it works, for humans

At checkout, the store signs a receipt and hands the buyer an `.attest` bundle —
a small file the buyer keeps anywhere: disk, cloud, USB, wherever. There is no
account to keep alive and nothing to sync. Later, anyone with a verifier — a
friend, a marketplace, the buyer themself — can check that bundle's signature
offline against the issuer's published key material and confirm it's a genuine,
unrevoked receipt. If the buyer needs to prove the receipt is specifically
*theirs* (not just a copy that has floated around), they can do so by disclosing
a salt or answering a key challenge, without exposing their identity to the
verifier. Nothing in this loop requires a server: there is no central attest
authority, no registry that must exist, and no phone-home — a verifier needs only
the receipt bytes, the issuer's key material, and, optionally, a revocation feed.

## What it is / is not

attest is a normative specification for a signed receipt envelope, a restricted
JSON canonicalization profile, a pinned Ed25519 signing/verification ruleset,
issuer key/artifact manifests with rotation and compromise handling, a layered
offline verification algorithm, revocation-by-class semantics, and buyer-binding
proof — plus a Python reference implementation and an independent TypeScript
verifier.

It is **not** a DRM-stripping tool, a content host, an index of content, a
marketplace, a resale/transfer protocol (not in v0.1 — see the reserved
`transferable` field), a blockchain or NFT product, or a payment instrument. A
receipt is evidence of a license grant, not the artifact itself and not the
transaction that paid for it.

None of this bypasses an unwilling seller: a receipt is issuer-signed, and attest
cannot conjure a valid one out of a store that refuses to sign. For incumbents who
won't adopt voluntarily, the lever is regulation and market pressure, not forgery.

## Status

Spec v0.1 is complete and v0.2 is specified and implemented on `main`, with two
independent implementations — a Python reference implementation and a TypeScript
verifier — that agree on all 97 conformance vector leaves across 36 groups: 51 of
them the v0.1 corpus, the rest exercising v0.2's hybrid signature profile,
transparency/anchoring behaviour, the upgrade-policy hardening (mixed-keyset
prohibition, artifact-manifest currency, anchor profile v2, logged revocation
deadlines), and Stage 3 issuer-mediated transfer. (A v0.1-only verifier is required
to reject v0.2 envelopes, so it is measured against the 51-leaf subset.) There is also an
end-to-end demo that deletes a store's entire infrastructure mid-lifecycle and
proves the receipt still verifies.

The published packages are `0.3.0`, which already ships v0.2 Stages 1 and 2
(hybrid signatures; transparency and anchoring). Stage 3 — issuer-mediated
transfer, this document's own §17 — is the remaining piece `0.4.0` ships.

Three pieces of assurance work go beyond what a test suite can show. They are
being finished on branches, and are linked here rather than left invisible:

- **Formal verification.** A [Tamarin model of the wire protocol](https://github.com/SVM-98/attest/blob/feature/p1.3-formal-verification/formal/attest.spthy):
  machine-checked theorems that acceptance implies an issuer signature, that key
  rotation cannot be hijacked, and that revocation is sound and effective — plus
  attack exhibits proved *reachable* rather than argued in prose, plus negative
  controls that must falsify. Each theorem states its own scope in the theory
  file; nothing is claimed more broadly there than the prover checked. In
  progress on [`feature/p1.3-formal-verification`](https://github.com/SVM-98/attest/tree/feature/p1.3-formal-verification).
- **[Threat model](https://github.com/SVM-98/attest/blob/pillar-1/docs/spec/attest-threat-model.md).**
  67 attacks catalogued across the whole receipt lifecycle, each either mitigated
  or recorded as out of scope with a reason, a traceability matrix, and the
  protocol gaps the exercise found left tracked in the open instead of quietly
  fixed. On [`pillar-1`](https://github.com/SVM-98/attest/tree/pillar-1).
- **[Privacy considerations](https://github.com/SVM-98/attest/blob/pillar-1/docs/spec/attest-privacy.md).**
  Every field classified by what it reveals to which observer, twenty testable
  privacy claims, and a GDPR annex covering what a receipt deliberately does not
  record. On [`pillar-1`](https://github.com/SVM-98/attest/tree/pillar-1).
- **[Transfer economics](https://github.com/SVM-98/attest/blob/pillar-1/docs/spec/attest-transfer-economics.md)
  (non-normative).** The market and legal context behind Stage 3's transfer
  profile — resale velocity, the issuer-royalty incentive, and the CJEU case law
  (*UsedSoft*, *Tom Kabinet*) that makes transfer issuer-mediated rather than a
  general resale right. On [`pillar-1`](https://github.com/SVM-98/attest/tree/pillar-1).

## Quickstart

Install the reference implementation from PyPI (the distribution is named
`attest-receipts`; the import package and the CLI are both `attest`):

```sh
pip install attest-receipts
attest --help
```

The TypeScript verifier is on npm as
[`attest-verifier`](https://www.npmjs.com/package/attest-verifier):

```sh
npm install attest-verifier
```

Or work from a checkout of this repo:

```sh
uv venv --python 3.12 .venv && uv pip install --python .venv -e '.[dev]'
# or: pip install -e .
```

```sh
.venv/bin/attest --help
```

```sh
.venv/bin/python demo/store_dies.py
```

```sh
.venv/bin/pytest --cov=attest --cov-report=term-missing
```

and a TypeScript verifier quickstart:

```sh
cd verifiers/ts && npm install && npm test
```

See [demo/README.md](demo/README.md) for what each step of the demo proves, and
[docs/spec/attest-v0.1.md](docs/spec/attest-v0.1.md) plus its companion
[JSON Schema](docs/spec/schema/attest-receipt.schema.json) for the normative
specification. [docs/spec/vectors/](docs/spec/vectors/) holds the conformance
corpus every implementation is checked against.

[docs/spec/attest-v0.2.md](docs/spec/attest-v0.2.md) is an additive delta
specification defining the v0.2 hybrid Ed25519+ML-DSA-65 signature profile
(post-quantum-resistant receipts, `attest_version: "0.2"`); v0.1 receipts
remain valid and verifiable forever. That profile was Stage 1; Stage 2 — issuer
key transparency and timestamp anchoring, where a log corroborates a receipt's
existence without ever being able to make an unsigned receipt look authentic —
is specified in the same document. Stage 3 — issuer-mediated transfer, giving
`license.transferable` its first real meaning, layered on top of the Stage 2 log
— is specified there too (§17); business economics around resale are
deliberately out of protocol and live in the non-normative
[transfer-economics annex](docs/spec/attest-transfer-economics.md).

[docs/spec/attest-versioning.md](docs/spec/attest-versioning.md) is the
normative upgrade policy governing both specifications above: the additive
pattern new extensions must follow, the eternal-verifiability guarantee, the
three-state algorithm lifecycle (`active` / `deprecated` / `unsafe`), the
amendment procedure, and the signature-suite, payload-field, revocation-class,
log-entry-type, and transfer-type registries.

[docs/spec/attest-threat-model.md](docs/spec/attest-threat-model.md) is the
maintained threat model behind the two specifications above — a living
normative companion that analyzes their mechanisms rather than imposing
requirements of its own — and
[docs/spec/attest-privacy.md](docs/spec/attest-privacy.md) is its
privacy-considerations sibling.

The core protocol properties are machine-checked in Tamarin: [formal/](formal/)
holds the model, the property↔lemma↔spec map, and the honest scope of what is
and is not proved, gated in CI by a statement-pinning checker.

## Roadmap / north star

Non-normative, and deliberately undated — these are directions, not commitments:

- **Authorized preservation escrow.** A path where a rights holder deposits a
  build or copy with a preservation institution and licenses buyers to retrieve
  it once official distribution ends — with the receipt as the eligibility
  check. Strictly rights-holder-authorized: attest will never host, index, or
  distribute content on its own.
- **Evidence capture for non-cooperating stores.** A research track into
  TLS-session-proof techniques (the zkTLS/TLSNotary class) that could let a buyer
  capture their own evidence of a purchase from a store that never signs anything,
  at weaker-than-issuer-signed trust. Legal review is required before any of this
  is built.
- **Registry / replication layer.** An optional layer for replicating verification
  material, with optional Merkle-root transparency anchoring — separate from the
  shipped §17.5 chain-of-title audit surface, and still strictly optional.

## Licensing, contributing, contact

**License.** Code is licensed [Apache-2.0](LICENSE); the specification and other
documentation are licensed [CC BY 4.0](LICENSE-docs) — reuse and derivatives of
the spec must credit the original author, since attribution is a condition of
that license, not a courtesy. [`NOTICE`](NOTICE) and [`AUTHORS`](AUTHORS) carry
the required attribution.

**Naming.** The name *attest* identifies this project and implementations that
actually conform to it; forks are welcome to use the technology but not the name
for a divergent derivative. This paragraph is a naming norm, not a trademark
registration — real trademark enforcement would require actually registering the
mark, which has not happened.

**Contributing.** See [`CONTRIBUTING.md`](CONTRIBUTING.md). Implementation pull
requests must pass all 97 conformance vector leaves and keep both the Python and
TypeScript suites green.

**Contact.** Use GitHub Issues for technical bugs, GitHub Discussions for
everything else, or email `SVM-98@proton.me`.
Security issues follow a different path — see [`SECURITY.md`](SECURITY.md), and
do not open a public issue for a vulnerability.

Skeptical about any of this? [docs/faq.md](docs/faq.md) answers the first
questions a reasonable person asks.
