WalletApiImpl extends AbstractApi implements WalletApi, Signer { @Override public boolean unlock(final Authentication authentication) { try { assertNotNull(authentication, "Authentication must not null"); logger.debug("Unlock with {}", authentication); synchronized (lock) { if (this.proxySigner.isUnlocked()) { throw new HerajException("Lock already unlocked one"); } this.proxySigner.setUnlocked(keyStore.load(authentication)); } return true; } catch (InvalidAuthenticationException e) { return false; } catch (Exception e) { throw converter.convert(e); } } WalletApiImpl(final KeyStore keyStore, final TryCountAndInterval tryCountAndInterval); @Override void bind(final AergoClient aergoClient); @Override PreparedWalletApi with(final AergoClient aergoClient); @Override boolean unlock(final Authentication authentication); @Override boolean lock(final Authentication authentication); @Override boolean lock(); @Override TransactionApi transactionApi(); @Override QueryApi queryApi(); @Override Transaction sign(final RawTransaction rawTransaction); @Override Signature signMessage(final BytesValue message); @Override Signature signMessage(final Hash hashedMessage); @Override AccountAddress getPrincipal(); @Override String toString();  }
@Test public void testUnlock() { final WalletApi walletApi = supplyWalletApi(); assertTrue(walletApi.unlock(valid)); }
@Test public void shouldUnlockTwiceFail() { try { final WalletApi walletApi = supplyWalletApi(); walletApi.unlock(valid); walletApi.unlock(valid); fail(); } catch (Exception e) { } }