@Test public void testDbKeyIsLoadedFromBackupFile() throws Exception { storeDatabaseKey(keyBackupFile, encryptedKeyHex); assertFalse(keyFile.exists()); assertEquals(encryptedKeyHex, loadDatabaseKey(keyBackupFile)); assertEquals(encryptedKeyHex, accountManager.loadEncryptedDatabaseKey()); assertFalse(keyFile.exists()); assertEquals(encryptedKeyHex, loadDatabaseKey(keyBackupFile)); }
@Nullable protected String loadEncryptedDatabaseKey() { String key = readDbKeyFromFile(dbKeyFile); if (key == null) { LOG.info("No database key in primary file"); key = readDbKeyFromFile(dbKeyBackupFile); if (key == null) LOG.info("No database key in backup file"); else LOG.warning("Found database key in backup file"); } else { LOG.info("Found database key in primary file"); } return key; }
AccountManagerImpl implements AccountManager { @Nullable protected String loadEncryptedDatabaseKey() { String key = readDbKeyFromFile(dbKeyFile); if (key == null) { LOG.info("No database key in primary file"); key = readDbKeyFromFile(dbKeyBackupFile); if (key == null) LOG.info("No database key in backup file"); else LOG.warning("Found database key in backup file"); } else { LOG.info("Found database key in primary file"); } return key; } }
AccountManagerImpl implements AccountManager { @Nullable protected String loadEncryptedDatabaseKey() { String key = readDbKeyFromFile(dbKeyFile); if (key == null) { LOG.info("No database key in primary file"); key = readDbKeyFromFile(dbKeyBackupFile); if (key == null) LOG.info("No database key in backup file"); else LOG.warning("Found database key in backup file"); } else { LOG.info("Found database key in primary file"); } return key; } @Inject  AccountManagerImpl(DatabaseConfig databaseConfig, CryptoComponent crypto,
			IdentityManager identityManager); }
AccountManagerImpl implements AccountManager { @Nullable protected String loadEncryptedDatabaseKey() { String key = readDbKeyFromFile(dbKeyFile); if (key == null) { LOG.info("No database key in primary file"); key = readDbKeyFromFile(dbKeyBackupFile); if (key == null) LOG.info("No database key in backup file"); else LOG.warning("Found database key in backup file"); } else { LOG.info("Found database key in primary file"); } return key; } @Inject  AccountManagerImpl(DatabaseConfig databaseConfig, CryptoComponent crypto,
			IdentityManager identityManager); @Override boolean hasDatabaseKey(); @Override @Nullable SecretKey getDatabaseKey(); @Override boolean accountExists(); @Override boolean createAccount(String name, String password); @Override void deleteAccount(); @Override boolean signIn(String password); @Override boolean changePassword(String oldPassword, String newPassword); }
AccountManagerImpl implements AccountManager { @Nullable protected String loadEncryptedDatabaseKey() { String key = readDbKeyFromFile(dbKeyFile); if (key == null) { LOG.info("No database key in primary file"); key = readDbKeyFromFile(dbKeyBackupFile); if (key == null) LOG.info("No database key in backup file"); else LOG.warning("Found database key in backup file"); } else { LOG.info("Found database key in primary file"); } return key; } @Inject  AccountManagerImpl(DatabaseConfig databaseConfig, CryptoComponent crypto,
			IdentityManager identityManager); @Override boolean hasDatabaseKey(); @Override @Nullable SecretKey getDatabaseKey(); @Override boolean accountExists(); @Override boolean createAccount(String name, String password); @Override void deleteAccount(); @Override boolean signIn(String password); @Override boolean changePassword(String oldPassword, String newPassword);  }