updateMainKeyVaultStore method

  1. @override
Future<Either<WalletKeyException, Unit>> updateMainKeyVaultStore(
  1. VaultStore mainKeyVaultStore,
  2. String name
)

Updates the main key vault store.

mainKeyVaultStore is the new VaultStore to update to. name is the filepath of the VaultStore to update.

Returns nothing if successful. Throws an exception if the VaultStore does not exist.

Implementation

@override
Future<Either<WalletKeyException, Unit>> updateMainKeyVaultStore(
    VaultStore mainKeyVaultStore, String name) async {
  if (await _storage.containsKey(key: name)) {
    (await saveMainKeyVaultStore(mainKeyVaultStore, name))
        .withResult((res) => res);
    return Either.unit();
  } else {
    return Either.left(_vaultStoreDoesNotExist(name));
  }
}