@wavesenterprise/rtk-encrypt
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

Usage example

Generate and encrypt one bulletin

// hex string
const mainKey = '4c6466afe2d0fdf4b8e052e011214308f98c8bbe30cbe54a1f781dd842e70052bf711e3674000f8d63ed96f1fb4c757a2de95419376ea664f12448dc8d508fa8'

// num of fields in bulletin
const fields = 3

const encryptOptions = {
  mainKey,
  dimension: [
    { min: 1, max: 1, options: fields },
    { min: 1, max: 1, options: fields * 2 },
  ],
  bulletin: [
    [...Array(fields - 1).fill(0), 1],
    [...Array(fields * 2 - 1).fill(0), 1],
  ],
  validation: false,
  ctx: 'pollId', // poll ctx string
}
const encrypted = encrypt(encryptOptions)

Pack to binary

// ...
const encrypted = encrypt(encryptOptions)
const binary = pack(encrypted)
console.log(`Binary size: ${binary.length}`)

Changelog

v2.0.0

  • support for new crypto

v1.2.0-RC1

  • GOST curve & hash

v1.0.0-RC2

  • removed config param
  • moved to seckp256k1 lib with fallback elliptic.js
  • removed compact flag

v0.9.1-RC7

  • config.basePoint renamed to config.base
  • config.base format - hex string
  • mainKey format - hex string
  • removed config.padersenBase
  • added compact param for encrypt()

Readme

Keywords

none

Package Sidebar

Install

npm i @wavesenterprise/rtk-encrypt

Weekly Downloads

76

Version

2.0.6

License

ISC

Unpacked Size

21.2 kB

Total Files

20

Last publish

Collaborators

  • stfy
  • sergeymart
  • nbugaev
  • wavesadmin
  • aklyavlin
  • dimalitvinov
  • mikhail.milekhin