ngnjs

ngnjs/libcrypto

A simple cryptography library for NGN

JavaScript
6
2
MIT License

iss), account (sub), and key id (kid) are required parameters. The remaining parameters are optional. The claims are an arbitrary object of claims that will be included in the payload. The headers are arbitrary objects of headers that will be included in the header. The `kid` header is the only header that is used internally. It is used to help determine the appropriate private key when verifying a token. To use RSA/ECDSA keys, use the `privateKey` and `publicKey` properties instead of `secret`. ```javascript const { privateKey, publicKey } = await crypto.generateKeys() const token = await crypto.JWT.create({ privateKey, algorithm: 'RS256', issuer: 'acme corp', account: 'acct name', claims: { name: 'John Doe', admin: true }, headers: { kid: 'testdata' } }) const verified = await crypto.JWT.verify(token, publicKey) ``` The `verify()` method will return false if verification fails. Otherwise, the `verify()` method will return an object containing the payload (claims), headers, and other JWT details. ## License MIT License. Copyright NGN.

Total donated
Undistributed
Share with your subscribers:

Recipients

How the donated funds are distributed

Support the dependencies

Support the repos that depend on this repository

Top contributors

coreybutler's profile
coreybutler
65 contributions

Recent events

Kivach works on the Obyte network, and therefore you can track all donations.

No events yet