encrypt method

  1. @override
FutureOr<String> encrypt({
  1. required String data,
  2. String moduleKey = defaultModuleKey,
})
override

The default value moduleKey -> 'defaultKey' 'defaultKey' is set upon initialize the NUICryptography

Implementation

@override
FutureOr<String> encrypt({required String data, String moduleKey = defaultModuleKey}) async {
  //Info to pass into isolate
  if(!module.containsKey(moduleKey)){
    throw NUICryptoException(cause: NUICryptoError.KEY_NOT_FOUND);
  }

  try{
    return await _doEncryption(data, module[moduleKey]!);
  }on Exception catch(e){
    logNUI("NUICryptography in Flutter Isolate", "Encryption Exception ${e.toString()}");
    rethrow;
  }
}