# @sphereon/ed25519-signature-2018

> ``` npm i @transmute/ed25519-signature-2018 --save ```

Latest version **0.7.0-unstable.6** (published 2023-05-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @sphereon/ed25519-signature-2018
pnpm add @sphereon/ed25519-signature-2018
yarn add @sphereon/ed25519-signature-2018
bun add @sphereon/ed25519-signature-2018
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0-unstable.6 |
| Published | 2023-05-06 |
| First published | 2021-12-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 8 |
| Unpacked size | 454.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Sphereon |
| Maintainers | nklomp78, nklomp, spostma, bramtencate |

## Links

- npm: https://www.npmjs.com/package/@sphereon/ed25519-signature-2018
- Repository: https://github.com/transmute-industries/verifiable-data
- Homepage: https://github.com/transmute-industries/verifiable-data/tree/main/packages/ed25519-signature-2018
- npm.io page: https://npm.io/package/@sphereon/ed25519-signature-2018

## Dependencies (8)

- [@transmute/jose-ld](https://npm.io/package/@transmute/jose-ld.md) ^0.7.0-unstable.80
- [fast-text-encoding](https://npm.io/package/fast-text-encoding.md) ^1.0.3
- [@digitalcredentials/jsonld](https://npm.io/package/@digitalcredentials/jsonld.md) ^5.2.1
- [@transmute/ed25519-key-pair](https://npm.io/package/@transmute/ed25519-key-pair.md) 0.7.0-unstable.80
- [@transmute/security-context](https://npm.io/package/@transmute/security-context.md) ^0.7.0-unstable.80
- [@sphereon/isomorphic-webcrypto](https://npm.io/package/@sphereon/isomorphic-webcrypto.md) ^2.4.0-unstable.4
- [@transmute/credentials-context](https://npm.io/package/@transmute/credentials-context.md) ^0.7.0-unstable.80
- [@digitalcredentials/credentials-context](https://npm.io/package/@digitalcredentials/credentials-context.md) ^1.0.5

## Recent versions

- 0.7.0-unstable.6 (latest) — 2023-05-06
- 0.7.0-unstable.5 — 2023-05-06
- 0.7.0-unstable.4 — 2023-05-06
- 0.7.0-unstable.3 — 2023-05-06
- 0.7.0-unstable.2 — 2022-01-16
- 0.7.0-unstable.1 — 2022-01-16
- 2.0.2-unstable.0 — 2021-12-07

## README

# @transmute/ed25519-signature-2018

```
npm i @transmute/ed25519-signature-2018 --save
```

- [Read the Spec](https://w3c-ccg.github.io/lds-ed25519-2018/)

## Usage

```ts
import {
  Ed25519VerificationKey2018,
  Ed25519Signature2018,
} from "@transmute/ed25519-signature-2018";
import { documentLoader } from "path/somewhere";
import { verifiable } from "@transmute/vc.js";

const key = await Ed25519VerificationKey2018.from({
  id:
    "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC#z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
  type: "Ed25519VerificationKey2018",
  controller: "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
  publicKeyBase58: "FEkRBiL3GfrG2m1yh5mrxds8vTkRwYzwgBKWSH33J64p",
  privateKeyBase58:
    "4ywHegJBWnGAu3ZTtMX3Jtu1XUMtJJdmzEoqMk8RS2Fkv5W9hnJpyooY5qNFBTWEPHT5uSjakt2rJodp4DundZvg",
});

const result = await verifiable.credential.create({
  credential: {
    "@context": ["https://www.w3.org/2018/credentials/v1"],
    id: "https://example.com/credentials/123",
    type: ["VerifiableCredential"],
    issuer: "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
    issuanceDate: "2019-12-03T12:19:52Z",
    credentialSubject: {
      id: "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
    },
  },
  format: ["vc"],
  documentLoader: documentLoader,
  suite: new Ed25519Signature2018({
    key,
  }),
});

const result2 = await verifiable.credential.verify({
  credential: result.items[0],
  format: ["vc"],
  documentLoader: (iri: string) => {
    if (iri.startsWith("did:key:z6Mkth1Tmxa")) {
      return {
        documentUrl: iri,
        document: {
          "@context": [
            "https://www.w3.org/ns/did/v1",
            "https://w3id.org/security/suites/ed25519-2018/v1",
          ],
          id: "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
          assertionMethod: [
            {
              id:
                "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC#z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
              type: "Ed25519VerificationKey2018",
              controller:
                "did:key:z6Mkth1TmxaUcDLj9FrgNejhojR8k32HMSFJNCESGZ14DJrC",
              publicKeyBase58: "FEkRBiL3GfrG2m1yh5mrxds8vTkRwYzwgBKWSH33J64p",
            },
          ],
        },
      };
    }
    return documentLoader(iri);
  },
  suite: [new Ed25519Signature2018()],
});
```

## Development

Install and run tests for this package

```
npm i
npm t
```

This package contains interopability fixtures generated from Digital Bazaar libraries.
The fixtures can be regenerated with the following command

```
npm run generate:fixtures
```

## About

This typescript module has been built to support direct substitutability with [digitalbazaar/jsonld-signatures](https://github.com/digitalbazaar/jsonld-signatures/blob/master/lib/suites/Ed25519Signature2018.js) for Linked Data Proofs.

However, some changes were made to support typescript, and no `defaultDocumentLoader` is provided.

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