Skip to main content

parseAndValidatePrivateKey

Callable

  • parseAndValidatePrivateKey(data: Bytes, ignoreLength?: boolean): Uint8Array

  • Get the private key Uint8Array after the validation. Note: This function is not exported through main web3 package, so for using it directly import from accounts package.


    Parameters

    • data: Bytes

      Private key

    • optionalignoreLength: boolean

      Optional, ignore length check during validation

    Returns Uint8Array

    The Uint8Array private key

    parseAndValidatePrivateKey("0x08c673022000ece7964ea4db2d9369c50442b2869cbd8fc21baaca59e18f642c")

    > Uint8Array(32) [
    186, 26, 143, 168, 235, 179, 90, 75,
    101, 63, 84, 221, 152, 150, 30, 203,
    8, 113, 94, 226, 53, 213, 216, 5,
    194, 159, 17, 53, 219, 97, 121, 248
    ]