Hinkal WaaS

Generating Keypair

Every user in Hinkal WaaS is identified by an Ed25519 public key. You generate the keypair yourself client-side - the private key never leaves your system.

Install dependency

npm install tweetnacl

Generate a new keypair

const nacl = require("tweetnacl");

const keypair = nacl.sign.keyPair();

const publicKeyHex  = Buffer.from(keypair.publicKey).toString("hex");
const privateKeyHex = Buffer.from(keypair.secretKey.slice(0, 32)).toString("hex");

console.log("Public key (register this with Hinkal):", publicKeyHex);
console.log("Private key seed (store this securely):", privateKeyHex);

The publicKeyHex is what you register when creating a user. The privateKeyHex is the 32-byte seed - store it securely and never share it.

Restore a keypair from a saved seed

const nacl = require("tweetnacl");

function keypairFromSeedHex(seedHex) {
  const seed = Buffer.from(seedHex, "hex");
  return nacl.sign.keyPair.fromSeed(seed);
}

const keypair = keypairFromSeedHex(process.env.PRIVATE_KEY_SEED_HEX);