UNPKG

navio-blsct

Version:

TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.

32 lines (31 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PrivSpendingKey = void 0; const blsct_1 = require("../blsct"); const scalar_1 = require("../scalar"); /** Represents a private spending key. A private spending key is a `Scalar` and introduces no new functionality; it serves purely as a semantic alias. * * Examples: * ```ts * const { PrivSpendingKey, PublicKey } = require('navio-blsct') * const pk = PublicKey.random() * const vk = Scalar.random() * const sk = Scalar.random() * new PrivSpendingKey(pk, vk, sk, 1, 2) * ``` */ class PrivSpendingKey extends scalar_1.Scalar { /** Constructs a new `PrivSpendingKey` instance. * * @param blindingPubKey - The public key used for blinding. * @param viewKey - The view key. * @param spendingKey - The spending key. * @param account - The account. * @param address - The address. */ constructor(blindingPubKey, viewKey, spendingKey, account, address) { const blsctPsk = (0, blsct_1.calcPrivSpendingKey)(blindingPubKey.value(), viewKey.value(), spendingKey.value(), account, address); super(blsctPsk); } } exports.PrivSpendingKey = PrivSpendingKey;