Function: normalizePrivateKey()
GalaChain core SDK 1.0.0-rc.8 / index / normalizePrivateKey
Function: normalizePrivateKey()
normalizePrivateKey(
input):Uint8Array
Defined in: packages/gala-core-sdk/dist/index.d.ts:1568
Normalizes a secp256k1 private key to a fresh 32-byte array (the caller may zero it). Also
accepts 32 raw bytes, which are validated and copied. For strings it accepts what @gala-chain/api's
normalizePrivateKey accepted for a usable key: 64 hex characters (optionally 0x-prefixed;
a 63-character hex key is left-padded with a zero) or a 44-character base64 string.
Parameters
input
string | Uint8Array<ArrayBufferLike>
Returns
Uint8Array
Throws
GalaSDKError (INVALID_PRIVATE_KEY; params.reason is one of
INVALID_PRIVATE_KEY_REASONS: wrong_length for raw bytes that are not 32 long,
bad_encoding for any other string shape, not_on_curve for an out-of-range scalar).