Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "utils/cryptoUtils"

Index

Variables

Const ENCRYPTION_IV_LENGTH

ENCRYPTION_IV_LENGTH: 16 = 16

Const randomBytes

randomBytes: (arg1: T1) => Promise<TResult> = promisify(cryptoRandomBytes)

A promisified wrapper for the NodeJS crypto.randomBytes method.

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

Functions

decrypt

  • decrypt(payload: Buffer | string, password: string): Buffer
  • Decrypts a Buffer or base64 string using a password

    Parameters

    • payload: Buffer | string

      a Buffer or base64 string

    • password: string

    Returns Buffer

    a decrypted Buffer

encrypt

  • encrypt(payload: Buffer | string, password: string): Promise<Buffer>
  • Encrypts a Buffer or base64 string using a password

    Parameters

    • payload: Buffer | string

      a Buffer or base64 string

    • password: string

    Returns Promise<Buffer>

    an encrypted Buffer

generatePreimageAndHash

  • generatePreimageAndHash(): Promise<{ rHash: string; rPreimage: string }>
  • Returns a random payment preimage and hash in hex encoding.

    Returns Promise<{ rHash: string; rPreimage: string }>

getCipherKey

  • getCipherKey(password: string): Buffer

Generated using TypeDoc