(ctx context.Context, req *getGraphSaltRequest)
| 613 | } |
| 614 | |
| 615 | func (s *server) getGraphSalt(ctx context.Context, req *getGraphSaltRequest) (*getGraphSaltResponse, error) { |
| 616 | salts, err := s.db.GraphSalts(ctx, db.GraphID(req.GraphUUID)) |
| 617 | if db.IsNotExists(err) { |
| 618 | return nil, httperr.NotFound("graph %q wasn't found", req.GraphUUID) |
| 619 | } else if err != nil { |
| 620 | return nil, httperr.Internal("failed to load graph salts: %w", err) |
| 621 | } |
| 622 | if len(salts) == 0 { |
| 623 | // This was observed in the original API |
| 624 | return nil, httperr.Gone("no salts in graph %q", req.GraphUUID) |
| 625 | } |
| 626 | salt := salts[len(salts)-1] |
| 627 | |
| 628 | // XXX: The end salt is the latest, which maybe isn't a great assumption to bake into our DB API. |
| 629 | return &getGraphSaltResponse{ |
| 630 | Value: base64.StdEncoding.EncodeToString(salt.Value), |
| 631 | ExpiredAt: salt.ExpiredAt.UnixMilli(), |
| 632 | }, nil |
| 633 | } |
| 634 | |
| 635 | type uploadGraphEncryptKeysRequest struct { |
| 636 | EncryptedPrivateKey string `json:"encrypted-private-key"` |
nothing calls this directly
no test coverage detected