encryptMethod method

String encryptMethod(
  1. String method
)

Checks that method is valid, then encrypts it using saltBase64 and ivBase64

throws a NotMethodException if method is not a method

Implementation

String encryptMethod(String method) {
  if (!isMethod(method)) {
    throw NotMethodException(method: method);
  }
  final encrypter = Encrypter(AES(Key.fromBase64(saltBase64)));
  final reversedMethod =
      method.split('').reversed.reduce((value, element) => '$value$element');

  return encrypter
      .encrypt('$reversedMethod$method', iv: IV.fromBase64(ivBase64))
      .base64;
}