Function decodeBytesAuto

  • Decodes cryptographic bytes from a string, auto-determining the encoding based on the input length and character set.

    Parameters

    • encoded: string

      the string-encoded bytesd

    • encodingPattern: RegExp

      a regex which matches valid encodings of bytes with an expected fixed size. This pattern is expected to have groups separately matching each of the supported encodings. See PRIVATE_KEY_REGEX for an example.

    • encodingGroups: CryptoBytesEncodingGroups

      a description of the match groups in the regex, in the order they should be checked.

    • Optional errorMessage: string

      human-readable message for error thrown if decoding fails.

    Returns Buffer

    Throws

    TypeError if the pattern doesn't match

Generated using TypeDoc