NodeJS bindings of the nostr
crate.
This library works only on native environments (Linux, macOS and Windows).
Check also @rust-nostr/nostr
for the JavaScript bindings.
npm i @rust-nostr/nostr-nodejs
When installing, NPM will download the corresponding prebuilt Rust library for your current host system.
const { Keys } = require("@rust-nostr/nostr-nodejs");
async function main() {
let keys = Keys.generate();
// Hex keys
console.log("Public key (hex): ", keys.publicKey().toHex());
console.log("Secret key (hex): ", keys.secretKey().toHex());
// Bech32 keys
console.log("Public key (bech32): ", keys.publicKey().toBech32());
console.log("Secret key (bech32): ", keys.secretKey().toBech32());
}
main();
More examples can be found in the examples directory.
Look at https://github.com/rust-nostr/nostr/tree/master/crates/nostr#supported-nips
This library is in an ALPHA state, things that are implemented generally work but the API will change in breaking ways.
This project is distributed under the MIT software license - see the LICENSE file for details
⚡ Tips: https://getalby.com/p/yuki
⚡ Lightning Address: [email protected]