A TypeScript library for generating, managing, signing, and verifying asymmetric key pairs.
npm i kee-pair
import { KeePair } from 'kee-pair';
// Generate a new Secp256k1 key pair
const keyPair = KeePair.generate('secp256k1');
// Sign some data
const message = 'Hello, KeePair!';
const signature = keyPair.sign(message, 'sha256');
// Verify the signature
const isValid = keyPair.verify(message, signature, 'sha256');
console.log('Signature valid:', isValid);
// Restore key pair from an existing private key
const restored = KeePair.fromPrivateKey(keyPair.privateKey, 'secp256k1');
console.log(
'Public keys match:',
restored.publicKey.equals(keyPair.publicKey)
);
For all configuration options, please see the API docs.
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub.
Thanks again for your support, it is much appreciated! 🙏
MIT © Shahrad Elahi and contributors.