Variable cryptoUtilsConst

cryptoUtils: {
    decodePrivate: ((encodedKey: string) => Buffer);
    doubleSha256: ((input: string | Buffer) => Buffer);
    encodePrivate: ((key: Buffer) => string);
    encodePublic: ((key: Buffer, prefix: string) => string);
    generateTrxId: ((transaction: Transaction) => string);
    isCanonicalSignature: ((signature: Buffer) => boolean);
    isWif: ((privWif: string) => boolean);
    regExpAccount: RegExp;
    regExpAtAccount: RegExp;
    ripemd160: ((input: string | Buffer) => Buffer);
    sha256: ((input: string | Buffer) => Buffer);
    signTransaction: ((transaction: Transaction, keys: any, chainId?: Buffer) => SignedTransaction);
    toBuffer: ((ab: ArrayBuffer) => Buffer);
    toByteBuffer: ((o: any) => any);
    toUint8Array: ((buf: Buffer) => Uint8Array);
    transactionDigest: ((transaction: Transaction | SignedTransaction, chainId?: Buffer) => Buffer);
    uniqueNonce: (() => string);
} = ...

Misc crypto utility functions.

Type declaration

  • decodePrivate: ((encodedKey: string) => Buffer)
      • (encodedKey): Buffer
      • Decode bs58+doubleSha256-checksum encoded private key

        Parameters

        • encodedKey: string

        Returns Buffer

  • doubleSha256: ((input: string | Buffer) => Buffer)
      • (input): Buffer
      • Return 2-round sha256 hash of input

        Parameters

        • input: string | Buffer

        Returns Buffer

  • encodePrivate: ((key: Buffer) => string)
      • (key): string
      • Encode bs58+doubleSha256-checksum private key

        Parameters

        • key: Buffer

        Returns string

  • encodePublic: ((key: Buffer, prefix: string) => string)
      • (key, prefix): string
      • Encode public key with bs58+ripemd160-checksum

        Parameters

        • key: Buffer
        • prefix: string

        Returns string

  • generateTrxId: ((transaction: Transaction) => string)
      • (transaction): string
      • Parameters

        Returns string

  • isCanonicalSignature: ((signature: Buffer) => boolean)
      • (signature): boolean
      • Return true if signature is canonical, otherwise false

        Parameters

        • signature: Buffer

        Returns boolean

  • isWif: ((privWif: string) => boolean)
      • (privWif): boolean
      • Return true if string is wif, otherwise false

        Parameters

        • privWif: string

        Returns boolean

  • regExpAccount: RegExp
  • regExpAtAccount: RegExp
  • ripemd160: ((input: string | Buffer) => Buffer)
      • (input): Buffer
      • Return ripemd160 hash of input

        Parameters

        • input: string | Buffer

        Returns Buffer

  • sha256: ((input: string | Buffer) => Buffer)
      • (input): Buffer
      • Return sha256 hash of input

        Parameters

        • input: string | Buffer

        Returns Buffer

  • signTransaction: ((transaction: Transaction, keys: any, chainId?: Buffer) => SignedTransaction)
      • (transaction, keys, chainId?): SignedTransaction
      • Return copy of transaction with signature appended to signatures array.

        Parameters

        • transaction: Transaction

          Transaction to sign.

        • keys: any

          Key(s) to sign transaction with.

        • chainId: Buffer = DEFAULT_CHAIN_ID

          Chain id used when computing the transaction digest.

        Returns SignedTransaction

  • toBuffer: ((ab: ArrayBuffer) => Buffer)
      • (ab): Buffer
      • From ArrayBuffer to Buffer

        Parameters

        • ab: ArrayBuffer

        Returns Buffer

  • toByteBuffer: ((o: any) => any)
      • (o): any
      • Converts a string, number or Long to a ByteBuffer object.

        Parameters

        • o: any

          The value to be converted.

        Returns any

        A ByteBuffer object.

        An error if the input is not a string, number or Long.

  • toUint8Array: ((buf: Buffer) => Uint8Array)
      • (buf): Uint8Array
      • From Buffer to Uint8Array

        Parameters

        • buf: Buffer

        Returns Uint8Array

  • transactionDigest: ((transaction: Transaction | SignedTransaction, chainId?: Buffer) => Buffer)
      • (transaction, chainId?): Buffer
      • Return the sha256 transaction digest.

        Parameters

        Returns Buffer

  • uniqueNonce: (() => string)
      • (): string
      • Returns string