setNewKey method

void setNewKey({
  1. required String newModule,
  2. required String newKey,
  3. bool override = true,
})
override

Implementation

void setNewKey({required String newModule, required String newKey, bool override = true}){
  if(utf8.encode(newKey).length != _KEY_LENGTH) throw NUICryptoException(cause: NUICryptoError.KEY_LENGTH_NOT_MATCH);
  if(override){
    module[newModule] = newKey;
    return;
  }
  if(module.containsKey(newModule)) {
    throw NUICryptoException(cause: NUICryptoError.KEY_CANNOT_BE_OVERRIDE);
  }else{
    module[newModule] = newKey;
  }
}