(ctx context.Context, req *getGraphEncryptKeysRequest)
| 554 | } |
| 555 | |
| 556 | func (s *server) getGraphEncryptKeys(ctx context.Context, req *getGraphEncryptKeysRequest) (*getGraphEncryptKeysResponse, error) { |
| 557 | gID := db.GraphID(req.GraphUUID) |
| 558 | |
| 559 | keys, err := s.db.GraphEncryptKeys(ctx, gID) |
| 560 | if err != nil { |
| 561 | return nil, httperr.Internal("failed to get graph encrypt keys %w", err) |
| 562 | } |
| 563 | if len(keys) == 0 { |
| 564 | return nil, httperr.NotFound("no graph encrypt keys for %q", gID) |
| 565 | } |
| 566 | |
| 567 | // Get the last/latest key |
| 568 | key := keys[len(keys)-1] |
| 569 | |
| 570 | return &getGraphEncryptKeysResponse{ |
| 571 | PublicKey: key.PublicKey, |
| 572 | EncryptedPrivateKey: key.EncryptedPrivateKey, |
| 573 | }, nil |
| 574 | } |
| 575 | |
| 576 | type createGraphSaltRequest struct { |
| 577 | GraphUUID string `json:"GraphUUID"` |
nothing calls this directly
no test coverage detected