SymmetricKey.generate constructor

SymmetricKey.generate(
  1. int bitLength
)

Implementation

factory SymmetricKey.generate(int bitLength) {
  if (bitLength % 8 != 0) {
    throw ArgumentError(
        'Illegal bit length $bitLength, should be mutiple of 8.');
  }
  var value = DefaultSecureRandom().nextBytes(bitLength ~/ 8);
  return SymmetricKey(keyValue: value);
}