KeyPairStorage is responsible of managing key pairs
| 38 | |
| 39 | // KeyPairStorage is responsible of managing key pairs |
| 40 | type KeyPairStorage interface { |
| 41 | // AddKey adds the given key pair to the storage |
| 42 | AddKey(*KeyPair) error |
| 43 | |
| 44 | // DeleteKey deletes the given key pairs from the storage |
| 45 | DeleteKey(*KeyPair) error |
| 46 | |
| 47 | // GetKeyFromID retrieves the KeyPair from the given ID |
| 48 | GetKeyFromID(id string) (*KeyPair, error) |
| 49 | |
| 50 | // GetKeyFromPublic retrieves the KeyPairs from the given public key. |
| 51 | // |
| 52 | // If the key is no longer valid and the storage is able to deterime |
| 53 | // that it was deleted, the returned error is of *DeletedKeyPairError |
| 54 | // type. |
| 55 | GetKeyFromPublic(publicKey string) (*KeyPair, error) |
| 56 | |
| 57 | // Is valid checks if the given publicKey is valid or not. It's up to the |
| 58 | // implementer how to implement it. A valid public key returns a nil error. |
| 59 | // |
| 60 | // If the key is no longer valid and the storage is able to deterime |
| 61 | // that it was deleted, the returned error is of *DeletedKeyPairError |
| 62 | // type. |
| 63 | IsValid(publicKey string) error |
| 64 | } |
| 65 | |
| 66 | func NewMemKeyPairStorage() *MemKeyPairStorage { |
| 67 | return &MemKeyPairStorage{ |
no outgoing calls
no test coverage detected