Home Reference Source
public class | source

Aes

Provides symetric encrypt and decrypt via AES.

Static Method Summary

Static Public Methods
public static

decrypt_with_checksum(private_key: *, public_key: *, nonce: *, message: *, legacy: boolean): Buffer

public static

encrypt_with_checksum(private_key: *, public_key: *, nonce: *, message: *): Buffer

Identical to decrypt_with_checksum but used to encrypt.

public static

fromBuffer(buf: *): *

public static

fromSeed(seed: *): *

public static

fromSha512(hash: *): *

Constructor Summary

Private Constructor
private

Method Summary

Public Methods
public

clear(): *

This is an excellent way to ensure that all references to Aes can not operate anymore (example: a wallet becomes locked).

public

decrypt(ciphertext: *): Buffer

This method does not use a checksum, the returned data must be validated some other way.

public

decryptHex(cipher: *): string

This method does not use a checksum, the returned data must be validated some other way.

public

decryptHexToBuffer(cipher: *): Buffer

This method does not use a checksum, the returned data must be validated some other way.

public

decryptHexToText(cipher: *, encoding: string): String

This method does not use a checksum, the returned data must be validated some other way.

public

encrypt(plaintext: *): Buffer

This method does not use a checksum, the returned data must be validated some other way.

public

encryptHex(plainhex: *): String

This method does not use a checksum, the returned data must be validated some other way.

public

encryptToHex(plaintext: *): string

This method does not use a checksum, the returned data must be validated some other way.

Private Methods
private

_decrypt_word_array(cipher: *): *

private

_encrypt_word_array(plaintext: *): *

Static Public Methods

public static decrypt_with_checksum(private_key: *, public_key: *, nonce: *, message: *, legacy: boolean): Buffer source

Params:

NameTypeAttributeDescription
private_key *
public_key *
nonce *
message *
legacy boolean
  • optional
  • default: false

Return:

Buffer

Throw:

Error

"Invalid Key, ..."

public static encrypt_with_checksum(private_key: *, public_key: *, nonce: *, message: *): Buffer source

Identical to decrypt_with_checksum but used to encrypt. Should not throw an error.

Params:

NameTypeAttributeDescription
private_key *
public_key *
nonce *
message *

Return:

Buffer

message - Encrypted message which includes a checksum

public static fromBuffer(buf: *): * source

Params:

NameTypeAttributeDescription
buf *

Return:

*

public static fromSeed(seed: *): * source

Params:

NameTypeAttributeDescription
seed *

Return:

*

public static fromSha512(hash: *): * source

Params:

NameTypeAttributeDescription
hash *

Return:

*

Private Constructors

private constructor() source

Public Methods

public clear(): * source

This is an excellent way to ensure that all references to Aes can not operate anymore (example: a wallet becomes locked). An application should ensure there is only one Aes object instance for a given secret seed.

Return:

*

public decrypt(ciphertext: *): Buffer source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
ciphertext *

Return:

Buffer

binary

public decryptHex(cipher: *): string source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
cipher *

Return:

string

binary (could easily be readable text)

public decryptHexToBuffer(cipher: *): Buffer source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
cipher *

Return:

Buffer

encoded as specified by the parameter

public decryptHexToText(cipher: *, encoding: string): String source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
cipher *
encoding string
  • optional
  • default: binary

Return:

String

encoded as specified by the parameter

public encrypt(plaintext: *): Buffer source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
plaintext *

Return:

Buffer

binary

public encryptHex(plainhex: *): String source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
plainhex *

Return:

String

hex

public encryptToHex(plaintext: *): string source

This method does not use a checksum, the returned data must be validated some other way.

Params:

NameTypeAttributeDescription
plaintext *

Return:

string

hex

Private Methods

private _decrypt_word_array(cipher: *): * source

Params:

NameTypeAttributeDescription
cipher *

Return:

*

private _encrypt_word_array(plaintext: *): * source

Params:

NameTypeAttributeDescription
plaintext *

Return:

*