Skip to content

li0ard/ssh

Repository files navigation

@li0ard/ssh
SSH keys toolkit
docs




Installation

# from NPM
npm i @li0ard/ssh

# from JSR
bunx jsr i @li0ard/ssh

Features

  • Provides simple and modern API
  • Most of the APIs are strictly typed
  • Supports Bun, Node.js, Deno, Browsers
  • Works with ED25519 and ECDSA keys (including password-encrypted keys)
  • Supports conversion to Age format

Examples

import { PrivateKey, PublicKey } from "@li0ard/ssh";

const privateKey = PrivateKey.parse("-----BEGIN OPENSSH PRIVATE KEY...", "yourcoolpasshprase");
const publicKey = PublicKey.parse("ssh-ed25519...");

const data = new Uint8Array([0xAA, 0xBB, 0xCC, 0xDD]);
const signature = privateKey.sign(data);

console.log(signature); // -> Uint8Array [...]
console.log(publicKey.verify(data, signature)); // -> true

Acknowledgements

About

SSH keys toolkit

Topics

Resources

License

Stars

Watchers

Forks

Contributors