Generating Keys
PrivMX Endpoint library supports Wallet Import Format (WIF) keys by default and offers tools such as converting PEM keys (OpenSSL) and deterministic private key generation from any text, such as a user's password or a given file.
danger
Private keys should always be known only to their owners. Generate them client-side and don't save them anywhere. This practice ensures that only the rightful owner has access to their private keys, significantly reducing the risk of unauthorized access or theft.
Generating Keys using PrivMX Endpoint Library
Example snippet for generating a pair of keys in JS, using PrivMX Endpoint Library:
const PrivmxCrypto = require("privmx-crypto"); // npm i privmx-crypto --registry=https://npm.simplito.com
const priv = PrivmxCrypto.serviceSync.eccPrivRandom();
console.log("ECC private key WIF:", priv.toWIF());
console.log("ECC public key:", priv.getPublicKey().toBase58DER());
How to run:
mkdir test
cd test
npm i privmx-crypto --registry=https://npm.simplito.com
node gen-ecc-key.js