encodeBls12381PrivateKeyRaw static method

BuBytes encodeBls12381PrivateKeyRaw(
  1. List<int> privateKey
)

Not ASN.1 — a validated pass-through for a raw BLS12-381 private key scalar (32 bytes). This is the format every real BLS12-381 consumer actually uses; there is no DER/PKCS8 standard to conform to here.

Implementation

static BuBytes encodeBls12381PrivateKeyRaw(List<int> privateKey) {
  final priv = privateKey.asImmutableBytes;
  if (priv.length != 32) {
    throw CoreErrors.cryptoFailed(
      "encodeBls12381PrivateKeyRaw",
      reason: 'BLS12-381 private key must be 32 bytes',
    );
  }
  return priv;
}