https://github.com/serviejs/keysign
Data signing and verification for rotating credentials and algorithms
https://github.com/serviejs/keysign
cryptography data-integrity hmac hmac-sha256 sign
Last synced: 6 months ago
JSON representation
Data signing and verification for rotating credentials and algorithms
- Host: GitHub
- URL: https://github.com/serviejs/keysign
- Owner: serviejs
- License: other
- Created: 2018-06-09T14:17:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T06:59:07.000Z (about 2 years ago)
- Last Synced: 2025-07-03T05:04:22.667Z (6 months ago)
- Topics: cryptography, data-integrity, hmac, hmac-sha256, sign
- Language: TypeScript
- Size: 57.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Keysign
[](https://npmjs.org/package/keysign)
[](https://npmjs.org/package/keysign)
[](https://travis-ci.org/serviejs/keysign)
[](https://coveralls.io/r/serviejs/keysign?branch=master)
> Data signing and verification for rotating credentials and algorithms.
_(Inspired by [keygrip](https://github.com/crypto-utils/keygrip) and API compatible with [keycrypt](https://github.com/serviejs/keycrypt))._
## Installation
```
npm install keysign --save
```
## Usage
Signs a `Buffer` using the first `key` (secret) and returns the data. Upon decoding, checks each secret for a valid HMAC and returns the plain data (or `undefined` if nothing matches).
```ts
import { Keysign } from 'keysign'
const secrets = [Buffer.from('secret', 'utf8')]
const keysign = new Keysign(secrets)
const raw = Buffer.from('some data', 'utf8')
const signed = keysign.encode(raw)
const verified = keysign.decode(encrypted)
assert.equal(verified, raw)
```
## TypeScript
This project is using [TypeScript](https://github.com/Microsoft/TypeScript) and publishes the definitions to NPM.
## License
Apache 2.0