(id string)
| 173 | } |
| 174 | |
| 175 | func (m *CachedStorage) GetKeyFromID(id string) (*KeyPair, error) { |
| 176 | if keyPair, err := m.cache.GetKeyFromID(id); err == nil { |
| 177 | return keyPair, nil |
| 178 | } |
| 179 | |
| 180 | keyPair, err := m.backend.GetKeyFromID(id) |
| 181 | if err != nil { |
| 182 | return nil, err |
| 183 | } |
| 184 | |
| 185 | // set key to the cache |
| 186 | if err := m.cache.AddKey(keyPair); err != nil { |
| 187 | return nil, err |
| 188 | } |
| 189 | |
| 190 | return keyPair, nil |
| 191 | } |
| 192 | |
| 193 | func (m *CachedStorage) GetKeyFromPublic(public string) (*KeyPair, error) { |
| 194 | if keyPair, err := m.cache.GetKeyFromPublic(public); err == nil { |
nothing calls this directly
no test coverage detected