MCPcopy Create free account
hub / github.com/copernet/copernicus / AddKey

Method AddKey

crypto/keystore.go:47–54  ·  view source on GitHub ↗
(privateKey *PrivateKey)

Source from the content-addressed store, hash-verified

45}
46
47func (ks *KeyStore) AddKey(privateKey *PrivateKey) {
48 keyPair := NewKeyPair(privateKey)
49
50 ks.Lock()
51 defer ks.Unlock()
52
53 ks.keys[keyPair.GetKeyID()] = keyPair
54}
55
56func (ks *KeyStore) GetKeyPair(pubKeyHash []byte) *KeyPair {
57 ks.RLock()

Callers 11

TestKeyStore_GetKeyPairFunction · 0.95
TestKeyStore_GetKeyPairsFunction · 0.95
TestKeyStore_AddKeyPairsFunction · 0.95
getKeyStoreFunction · 0.95
getKeyStoreFunction · 0.95
getKeysFunction · 0.95
loadFromDBMethod · 0.80
GenerateNewKeyMethod · 0.80
initVarFunction · 0.80
initVarFunction · 0.80

Calls 4

GetKeyIDMethod · 0.95
NewKeyPairFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by 8

TestKeyStore_GetKeyPairFunction · 0.76
TestKeyStore_GetKeyPairsFunction · 0.76
TestKeyStore_AddKeyPairsFunction · 0.76
getKeyStoreFunction · 0.76
getKeyStoreFunction · 0.76
initVarFunction · 0.64
initVarFunction · 0.64