@@ -25,8 +25,8 @@ trait CryptoPublicStore extends AutoCloseable {
25
25
implicit val ec : ExecutionContext
26
26
27
27
// Cached values for public keys with names
28
- protected val signingKeyMap : TrieMap [Fingerprint , SigningPublicKeyWithName ] = TrieMap .empty
29
- protected val encryptionKeyMap : TrieMap [Fingerprint , EncryptionPublicKeyWithName ] = TrieMap .empty
28
+ private val signingKeyMap : TrieMap [Fingerprint , SigningPublicKeyWithName ] = TrieMap .empty
29
+ private val encryptionKeyMap : TrieMap [Fingerprint , EncryptionPublicKeyWithName ] = TrieMap .empty
30
30
31
31
// Write methods that the underlying store has to implement for the caching
32
32
protected def writeSigningKey (key : SigningPublicKey , name : Option [KeyName ])(implicit
@@ -53,7 +53,7 @@ trait CryptoPublicStore extends AutoCloseable {
53
53
traceContext : TraceContext
54
54
): EitherT [Future , CryptoPublicStoreError , Set [EncryptionPublicKeyWithName ]]
55
55
56
- def storePublicKey (publicKey : PublicKey , name : Option [KeyName ])(implicit
56
+ private [crypto] def storePublicKey (publicKey : PublicKey , name : Option [KeyName ])(implicit
57
57
traceContext : TraceContext
58
58
): EitherT [Future , CryptoPublicStoreError , Unit ] =
59
59
(publicKey : @ unchecked) match {
@@ -89,22 +89,12 @@ trait CryptoPublicStore extends AutoCloseable {
89
89
): EitherT [Future , CryptoPublicStoreError , Option [SigningPublicKey ]] =
90
90
listSigningKeys.map(_.find(_.name.contains(keyName)).map(_.publicKey))
91
91
92
- def findSigningKeyIdByFingerprint (fingerprint : Fingerprint )(implicit
93
- traceContext : TraceContext
94
- ): EitherT [Future , CryptoPublicStoreError , Option [SigningPublicKey ]] =
95
- listSigningKeys.map(_.find(_.publicKey.fingerprint == fingerprint).map(_.publicKey))
96
-
97
92
def findEncryptionKeyIdByName (keyName : KeyName )(implicit
98
93
traceContext : TraceContext
99
94
): EitherT [Future , CryptoPublicStoreError , Option [EncryptionPublicKey ]] =
100
95
listEncryptionKeys.map(_.find(_.name.contains(keyName)).map(_.publicKey))
101
96
102
- def findEncryptionKeyIdByFingerprint (fingerprint : Fingerprint )(implicit
103
- traceContext : TraceContext
104
- ): EitherT [Future , CryptoPublicStoreError , Option [EncryptionPublicKey ]] =
105
- listEncryptionKeys.map(_.find(_.publicKey.fingerprint == fingerprint).map(_.publicKey))
106
-
107
- def publicKeysWithName (implicit
97
+ private [crypto] def publicKeysWithName (implicit
108
98
traceContext : TraceContext
109
99
): EitherT [Future , CryptoPublicStoreError , Set [PublicKeyWithName ]] =
110
100
for {
@@ -126,7 +116,7 @@ trait CryptoPublicStore extends AutoCloseable {
126
116
): EitherT [Future , CryptoPublicStoreError , Set [SigningPublicKey ]] =
127
117
retrieveKeysAndUpdateCache(listSigningKeys, signingKeyMap)
128
118
129
- def storeSigningKey (key : SigningPublicKey , name : Option [KeyName ] = None )(implicit
119
+ private [crypto] def storeSigningKey (key : SigningPublicKey , name : Option [KeyName ] = None )(implicit
130
120
traceContext : TraceContext
131
121
): EitherT [Future , CryptoPublicStoreError , Unit ] =
132
122
writeSigningKey(key, name).map { _ =>
@@ -147,8 +137,8 @@ trait CryptoPublicStore extends AutoCloseable {
147
137
): EitherT [Future , CryptoPublicStoreError , Set [EncryptionPublicKey ]] =
148
138
retrieveKeysAndUpdateCache(listEncryptionKeys, encryptionKeyMap)
149
139
150
- def storeEncryptionKey (key : EncryptionPublicKey , name : Option [KeyName ] = None )(implicit
151
- traceContext : TraceContext
140
+ private [crypto] def storeEncryptionKey (key : EncryptionPublicKey , name : Option [KeyName ] = None )(
141
+ implicit traceContext : TraceContext
152
142
): EitherT [Future , CryptoPublicStoreError , Unit ] =
153
143
writeEncryptionKey(key, name)
154
144
.map { _ =>
@@ -175,7 +165,7 @@ trait CryptoPublicStore extends AutoCloseable {
175
165
for {
176
166
// we always rebuild the cache here just in case new keys have been added by another process
177
167
// this should not be a problem since these operations to get all keys are infrequent and typically
178
- // typically the number of keys is not very large
168
+ // the number of keys is not very large
179
169
storedKeys <- keysFromDb
180
170
_ = cache ++= storedKeys.map(k => k.publicKey.id -> k)
181
171
} yield storedKeys.map(_.publicKey)
0 commit comments