Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nkeys.js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nkeys.js

A public-key signature system based on Ed25519 for the NATS ecosystem in javascript

  • 1.0.1-2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
244K
increased by4.68%
Maintainers
1
Weekly downloads
 
Created

What is nkeys.js?

The nkeys.js package is a JavaScript library for handling NATS keys. It provides functionalities for creating, managing, and verifying NATS keys, which are used for secure communication in NATS (a high-performance messaging system).

What are nkeys.js's main functionalities?

Generate a new NATS key pair

This feature allows you to generate a new NATS key pair, which includes a public key and a private key. The public key can be shared, while the private key should be kept secure.

const nkeys = require('nkeys.js');
const kp = nkeys.createAccount();
console.log('Public Key:', kp.getPublicKey());
console.log('Private Key:', kp.getPrivateKey());

Sign a message

This feature allows you to sign a message using the private key of a NATS key pair. The signature can be used to verify the authenticity of the message.

const nkeys = require('nkeys.js');
const kp = nkeys.createAccount();
const message = Buffer.from('Hello, NATS!');
const signature = kp.sign(message);
console.log('Signature:', signature.toString('hex'));

Verify a message signature

This feature allows you to verify the signature of a message using the public key of a NATS key pair. It ensures that the message was signed by the corresponding private key.

const nkeys = require('nkeys.js');
const kp = nkeys.createAccount();
const message = Buffer.from('Hello, NATS!');
const signature = kp.sign(message);
const publicKey = kp.getPublicKey();
const isValid = nkeys.fromPublic(publicKey).verify(message, signature);
console.log('Is the signature valid?', isValid);

Other packages similar to nkeys.js

Keywords

FAQs

Package last updated on 13 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc