-
Notifications
You must be signed in to change notification settings - Fork 7
/
KeyManageable.java
101 lines (88 loc) · 2.52 KB
/
KeyManageable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* @copyright defined in LICENSE.txt
*/
package hera.wallet;
import hera.api.model.Authentication;
import hera.api.model.Identity;
import hera.exception.KeyStoreException;
import hera.key.AergoKey;
import java.io.Closeable;
import java.util.List;
@Deprecated
public interface KeyManageable extends Closeable {
/**
* Bind a keystore with wallet. This operation has a meaning only for {@link WalletType#Secure}.
* For other wallet type, do nothing.
*
* @param keyStore a java keystore
*/
void bindKeyStore(java.security.KeyStore keyStore);
/**
* Save an aergo key to the key store. This operation has no meaning to {@link WalletType#Naive}.
*
* @param aergoKey an aergo key
* @param password an encrypt key
*
* @throws KeyStoreException on keystore error
*/
void saveKey(AergoKey aergoKey, String password);
/**
* Save an aergo key to the key store. This operation has no meaning to {@link WalletType#Naive}.
*
* @param aergoKey an aergo key
* @param identity an identity to save key
* @param password an encrypt key
*
* @throws KeyStoreException on keystore error
*/
void saveKey(AergoKey aergoKey, Identity identity, String password);
/**
* Export an aergo key of a current account with encrypted.
*
* @param authentication an authentication
* @return encoded encrypted private key
*
* @throws KeyStoreException on keystore error
*/
String exportKey(Authentication authentication);
/**
* Get all the stored identities in a binded key store.
*
* @return stored identities
*
* @throws KeyStoreException on keystore error
*/
List<Identity> listKeyStoreIdentities();
/**
* Unlock account with {@code Authentication}.
*
* @param authentication an authentication
* @return unlock result
*
* @throws KeyStoreException on keystore error
*/
boolean unlock(Authentication authentication);
/**
* Lock current account with {@code Authentication}.
*
* @param authentication an authentication
* @return unlock result
*
* @throws KeyStoreException on keystore error
*/
boolean lock(Authentication authentication);
/**
* Store the keystore to the path. This operation has a meaning only for
* {@link WalletType#Secure}. For other wallet type, do nothing.
*
* @param path a path
* @param password a password used in storing key store
*
* @throws KeyStoreException on keystore error
*/
void storeKeyStore(String path, String password);
/**
* {@inheritDoc}
*/
void close();
}