# @fedikit/http-signature

> Building Blocks for Fediverse.

Latest version **0.0.1-alpha.7** (published 2024-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fedikit/http-signature
pnpm add @fedikit/http-signature
yarn add @fedikit/http-signature
bun add @fedikit/http-signature
```

## Health

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

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-alpha.7 |
| Published | 2024-01-19 |
| First published | 2023-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20.0.0 |
| Dependencies | 0 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 12 |
| Maintainers | kwaa |

## Links

- npm: https://www.npmjs.com/package/@fedikit/http-signature
- Repository: https://github.com/fedikit/fedikit
- Homepage: https://github.com/fedikit/fedikit#readme
- Issues: https://github.com/fedikit/fedikit/issues
- npm.io page: https://npm.io/package/@fedikit/http-signature

## Recent versions

- 0.0.1-alpha.7 (latest) — 2024-01-19
- 0.0.1-alpha.6 — 2023-11-19
- 0.0.1-alpha.4 — 2023-11-11
- 0.0.1-alpha.3 — 2023-11-10

## README

# @fedikit/http-signature

Modern alternative to `http-signature`. [WIP]

## About

`@fedikit/http-signature` Using the
[Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API),
currently supported up to
[draft-cavage-http-signatures-12](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12).

- Q: Why is the latest
  [draft-ietf-httpbis-message-signatures](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-message-signatures)
  not supported?
  - A: Most Fediverse apps aren't currently compatible with it, and I'll
    consider implementing it when at least two major app is.
- Q: Why Use the Web Crypto API?
  - A: 0KB! this means that this package can be more lightweight, at the cost of
    having to use async/await.

## Usage

###### Sign

```ts
import { generateKey, sign } from '@fedikit/http-signature'

const keyPair = await generateKey()

let req = new Request('https://post.deno.dev', {
  method: 'POST',
  body: JSON.stringify({
    message: 'Hello world!',
  }),
  headers: {
    'content-type': 'application/json',
  },
})

req = await sign(req, {
  key: keyPair.privateKey,
  keyId: 'rsa-key-1',
})

await fetch(req)
```

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