UNPKG

@botwall/sdk

Version:

BotWall SDK for site protection and bot crawling

19 lines 781 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateKeypair = generateKeypair; const tweetnacl_1 = __importDefault(require("tweetnacl")); /** * Generates a new Ed25519 keypair. * @returns { publicKey: string, privateKey: string } * Both keys are base64-encoded strings. */ function generateKeypair() { const keypair = tweetnacl_1.default.sign.keyPair(); const publicKey = Buffer.from(keypair.publicKey).toString('base64'); const privateKey = Buffer.from(keypair.secretKey).toString('base64'); return { publicKey, privateKey }; } //# sourceMappingURL=generateKeypair.js.map