# @tokenscript/attestation

> A library for integrating cryptographic attestations into applications

Latest version **0.7.0-rc.2** (published 2023-10-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install @tokenscript/attestation
pnpm add @tokenscript/attestation
yarn add @tokenscript/attestation
bun add @tokenscript/attestation
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0-rc.2 |
| Published | 2023-10-20 |
| First published | 2022-03-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 52 |
| Maintainers | stj89, jf-stl, futantan, jot2re, micwallace, victor928, nicholastaras |

## Links

- npm: https://www.npmjs.com/package/@tokenscript/attestation
- Repository: https://github.com/TokenScript/attestation
- Homepage: https://github.com/TokenScript/attestation#readme
- Issues: https://github.com/TokenScript/attestation/issues
- npm.io page: https://npm.io/package/@tokenscript/attestation

## Dependencies (10)

- [url](https://npm.io/package/url.md) ^0.11.0
- [ethers](https://npm.io/package/ethers.md) ^5.7.2
- [js-sha3](https://npm.io/package/js-sha3.md) ^0.8.0
- [elliptic](https://npm.io/package/elliptic.md) ^6.5.3
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^9.0.0
- [patch-package](https://npm.io/package/patch-package.md) ^6.5.0
- [secure-random](https://npm.io/package/secure-random.md) ^1.1.2
- [@peculiar/asn1-schema](https://npm.io/package/@peculiar/asn1-schema.md) ^2.3.3
- [string.prototype.matchall](https://npm.io/package/string.prototype.matchall.md) ^4.0.8
- [@ethereum-attestation-service/eas-sdk](https://npm.io/package/@ethereum-attestation-service/eas-sdk.md) ^0.29.1

## Recent versions

- 0.7.0-rc.2 (latest) — 2023-10-20
- 0.7.0-rc.1 (rc) — 2023-09-15
- 0.6.0-beta1 (beta) — 2023-07-11
- 0.5.0-alpha.6 (alpha) — 2023-05-18
- 0.4.1-mw (mw) — 2022-11-22
- 0.3.9-dc.4 (dc) — 2022-10-08
- 0.3.9-sc.5 (sc) — 2022-08-11
- 0.6.0-rc.6 — 2023-08-16
- 0.6.0-rc.5 — 2023-08-16
- 0.6.0-rc.4 — 2023-08-16
- 0.6.0-rc.3 — 2023-08-04
- 0.6.0-rc.2 — 2023-08-03
- 0.6.0-rc.1 — 2023-08-01
- 0.5.1 — 2023-06-02
- 0.5.1-beta.2 — 2023-05-30
- … 39 more at https://npm.io/package/@tokenscript/attestation/versions

## README

# TokenScript - Attestation

This repository host the attestation libraries as part of TokenScript. Discussion goes to the forum https://community.tokenscript.org/

You can always use this project in your own code through Maven central, by adding the following dependency in your POM:
 ```dtd
 <dependency>
   <groupId>org.tokenscript</groupId>
   <artifactId>attestation</artifactId>
   <version>0.4.1</version>
 </dependency>
```

This repository's library serves 3 use-cases of attestations.

| Use-case               | Description                                                  | Protocol                                                     | Cmd Demo                         |
| ---------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------- |
| Identifier attestation | Identifies a person by their Internet identifier such as Twitter Handle and email address. | See below                                                    |                                  |
| Cheque                 | Cheque: a signed message allows the beneficiary to perform an action, such as withdrawing Ether. | [Send-token-by-identifier](http://tokenscript.org/Cheque/send_token_by_identifier.html) | [demo](cli-attestation-demo.md). |
| Attestation as token   | An attestation that can be used as a non-fungible token.     |                                                              |                                  |



## How is the code organised?

The code is not compartmentalised by use-cases, since they share common components. We provide the common components as library, then, for each use-case, a commandline utility.

Since in most cases these attestations are used on the web, Web-developers should be more interested in attestations being implemented as part of token-neogotiation instead of the basic commandline form. Therefore, **this repository should be more of interest by the protocol developers**. Our JavaScript based token negotiation implementation is at the [token-negotiator repo](https://github.com/TokenScript/token-negotiator).

Together with repos that uses the library code, in total we maintain 4 repos. The relationship between these 4 repos are demonstrated here. This one is the first (the upper-left one).

![various repos for components](docs/code-layout.svg)

## Build

You need the following installed:

- JDK (version 11 or higher)
- Gradle (version 7.1.1 is used by our devs)
- node.js (version 15 is used by our devs)

Once you have them installed, run:

    $ gradle build

The build script will run a few tests, resulting a few pem files created in `build/test-results/` directory.

## Try it yourself

To create a jar file for running the demo, run:

    $ gradle shadowJar

Which will create a jar file that you can run in the commandline

    build/libs/attestation-all.jar

There is a walk-through to use the functionalities provided by this library through commandline: [commandline cheque demonstration](cli-attestation-demo.md) and the  [commandline EIP712 attestation demonstration](cli-cheque-demo.md)

## Organisation of this repo

This repository has the following content:

data-modules
:the data modules definitions used in this project

src
:the implementation of the attestation and protocols. We use a Java-Solidity model for quick prototyping - testing.

ethereum/lib
: lib for smart contracts which uses attestations

ethereum/issuers
: example smart contracts used by issuers, for example, revocation list management.

ethereum/trustlist
: members of trustlists to be adopted by smart contracts

ethereum/experiments
: work not in the published specifications

ethereum/example-james-squire
: an example to be used in your projects which requires attestations

paper
: the paper behind the design of this project. The current version there is dated (2018) and doesn't reflect the new work in the last a few years. The current focus is the [cheque/attestation protocol](http://tokenscript.org/Cheque/send_token_by_identifier.html)


# ERC publications

ERC's related to this stream of work are:

[ERC1386](https://github.com/ethereum/EIPs/issues/1386), [ERC1387](https://github.com/ethereum/EIPs/issues/1387) & [ERC1388](https://github.com/ethereum/EIPs/issues/1388)

---
_Source: https://npm.io/package/@tokenscript/attestation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
