makeRandomMnemonic function

String makeRandomMnemonic(
  1. int size
)

Generates a random mnemonic of the given size

Implementation

String makeRandomMnemonic(int size) {
  if (bridge.nativeDvote == null)
    throw Exception("The library is not initialized");

  switch (size) {
    case 128:
    case 160:
    case 192:
    case 224:
    case 256:
      break;
    default:
      throw ArgumentError("Invalid key size");
  }

  // The actual native call
  final resultPtr = bridge.generateMnemonic(size);

  return bridge.handleResultStringPointer(resultPtr);
}