UNPKG

@tonappchain/adnl

Version:

ADNL TypeScript implementation

25 lines 801 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ADNLKeys = void 0; const ed25519_1 = require("@noble/ed25519"); const utils_1 = require("@noble/hashes/utils"); class ADNLKeys { constructor(peerPublicKey) { this._peer = peerPublicKey; } get public() { return new Uint8Array(this._public); } get shared() { return new Uint8Array(this._shared); } async generate() { const privateKey = (0, utils_1.randomBytes)(32); const publicKey = await (0, ed25519_1.getPublicKey)(privateKey); const shared = await (0, ed25519_1.getSharedSecret)(privateKey, this._peer); this._public = publicKey; this._shared = shared; } } exports.ADNLKeys = ADNLKeys; //# sourceMappingURL=keys.js.map