Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Crypto

Index

Methods

Static _decode

  • _decode(recipientPrivate: string, senderPublic: string, payload: Uint8Array, iv: Uint8Array): string
  • Decode an encrypted message payload

    Parameters

    • recipientPrivate: string

      A recipient private key

    • senderPublic: string

      A sender public key

    • payload: Uint8Array

      An encrypted message payload in bytes

    • iv: Uint8Array

      16-byte AES initialization vector

    Returns string

    • The decoded payload as hex

Static _encode

  • _encode(senderPriv: string, recipientPub: string, msg: string, iv: Uint8Array): string
  • Encode a message, separated from encode() to help testing

    Parameters

    • senderPriv: string

      A sender private key

    • recipientPub: string

      A recipient public key

    • msg: string

      A text message

    • iv: Uint8Array

      An initialization vector

    Returns string

    • The encoded message

Static decode

  • decode(recipientPrivate: string, senderPublic: string, payload: string): string
  • Decode an encrypted message payload

    Parameters

    • recipientPrivate: string

      A recipient private key

    • senderPublic: string

      A sender public key

    • payload: string

      An encrypted message payload

    Returns string

    • The decoded payload as hex

Static decrypt

  • decrypt(data: any): any
  • Decrypt data

    Parameters

    • data: any

      An encrypted data object

    Returns any

    • The decrypted hex string

Static derivePassSha

  • derivePassSha(password: any, count: any): { priv: any }
  • Derive a private key from a password using count iterations of SHA3-256

    Parameters

    • password: any

      A wallet password

    • count: any

      A number of iterations above 0

    Returns { priv: any }

    • The derived private key
    • priv: any

Static encode

  • encode(senderPriv: string, recipientPub: string, msg: string, isHexString?: boolean): string
  • Encode a message

    Parameters

    • senderPriv: string

      A sender private key

    • recipientPub: string

      A recipient public key

    • msg: string

      A text message

    • Default value isHexString: boolean = false

      Is payload string a hexadecimal string (default = false)

    Returns string

    • The encoded message

Static encodePrivateKey

  • encodePrivateKey(privateKey: any, password: any): { ciphertext: any; iv: string }
  • Encode a private key using a password

    Parameters

    • privateKey: any

      An hex private key

    • password: any

      A password

    Returns { ciphertext: any; iv: string }

    • The encoded data
    • ciphertext: any
    • iv: string

Static encrypt

  • encrypt(data: any, key: any): { ciphertext: any; iv: any; key: any }
  • Encrypt hex data using a key

    Parameters

    • data: any

      An hex string

    • key: any

      An Uint8Array key

    Returns { ciphertext: any; iv: any; key: any }

    • The encrypted data
    • ciphertext: any
    • iv: any
    • key: any

Static passwordToPrivateKey

  • passwordToPrivateKey(common: any, walletAccount: any, algo: any): boolean
  • Reveal the private key of an account or derive it from the wallet password

    Parameters

    • common: any
    • walletAccount: any

      A wallet account object

    • algo: any

      A wallet algorithm

    Returns boolean

    • The account private key in and object or false

Static randomBytes

  • randomBytes(length: any): any
  • Generate random bytes by length

    Parameters

    • length: any

      The length of the random bytes

    Returns any

Static randomKey

  • randomKey(): any

Static toMobileKey

  • toMobileKey(password: any, privateKey: any): { encrypted: string; salt: any }
  • Encrypt a private key for mobile apps (AES_PBKF2)

    Parameters

    • password: any

      A wallet password

    • privateKey: any

      An account private key

    Returns { encrypted: string; salt: any }

    • The encrypted data
    • encrypted: string
    • salt: any

Generated using TypeDoc