createKeyPairFromPrivateKeyBytes function

KeyPair createKeyPairFromPrivateKeyBytes(
  1. Uint8List bytes
)

Creates a KeyPair from a 32-byte private key, deriving the corresponding public key.

Throws a SolanaError with code SolanaErrorCode.keysInvalidPrivateKeyByteLength if bytes is not exactly 32 bytes.

Implementation

KeyPair createKeyPairFromPrivateKeyBytes(Uint8List bytes) {
  assertIsPrivateKey(bytes);
  final publicKeyBytes = getPublicKeyFromPrivateKey(bytes);
  return KeyPair(privateKey: bytes, publicKey: publicKeyBytes);
}