Skip to content

Commit 268f407

Browse files
committed
feat: set secrets endpoint
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
1 parent 7cdf3e0 commit 268f407

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

runtime/internal/routes/auth.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package routes
2+
3+
import "net/http"
4+
5+
func init() {
6+
registerPrivateRoute(authSecretsHandler)
7+
}
8+
9+
func authSecretsHandler(c Config) (Path, http.Handler, error) {
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package authsecrets
2+
3+
import (
4+
"context"
5+
6+
"github.com/docker/secrets-engine/runtime/internal/registry"
7+
"github.com/docker/secrets-engine/x/logging"
8+
"github.com/docker/secrets-engine/x/secrets"
9+
"github.com/docker/secrets-engine/x/telemetry"
10+
)
11+
12+
func New() Service {
13+
return &authService{}
14+
}
15+
16+
type Service interface {
17+
Save(ctx context.Context, id secrets.ID, secret secrets.Envelope) error
18+
Delete(ctx context.Context, id secrets.ID) error
19+
Get(ctx context.Context, id secrets.ID) (secrets.Envelope, error)
20+
}
21+
22+
type authService struct {
23+
reg registry.Registry
24+
logger logging.Logger
25+
tracker telemetry.Tracker
26+
}

x/api/authsecrets/secrets.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package authsecrets

x/api/authsecrets/v1/api.proto

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
edition = "2023";
2+
3+
package resolver.v1;
4+
5+
import "google/protobuf/timestamp.proto";
6+
import "google/protobuf/duration.proto";
7+
8+
option go_package = "github.com/docker/secrets-engine/x/api/authsecrets/v1;authsecretsv1";
9+
10+
service AuthSecretsService {
11+
// Resolve a secret by its ID.
12+
rpc GetSecrets(GetAuthSecretRequest) returns (GetAuthSecretResponse);
13+
rpc SetSecret(SetAuthSecretRequest) returns (SetAuthSecretResponse);
14+
rpc DeleteSecret(DeleteAuthSecretRequest) returns (DeleteAuthSecretResponse);
15+
}
16+
17+
message DeleteAuthSecretRequest {
18+
// ID of the secret
19+
string id = 1;
20+
}
21+
22+
message DeleteAuthSecretResponse {}
23+
24+
message GetAuthSecretRequest {
25+
// ID of the secret to resolve.
26+
string pattern = 1;
27+
}
28+
29+
message SetAuthSecretRequest {
30+
// ID of the secret
31+
string id = 1;
32+
string username = 2;
33+
string email = 3;
34+
// The secret value
35+
bytes value = 4;
36+
// The public metadata of the secret
37+
map<string, string> metadata = 5;
38+
google.protobuf.Timestamp expires_at = 10;
39+
}
40+
41+
message SetAuthSecretResponse {}
42+
43+
message GetAuthSecretResponse {
44+
repeated AuthSecret secrets = 1;
45+
46+
message AuthSecret {
47+
// ID of the secret to resolve.
48+
string id = 1;
49+
// The resolved secret value.
50+
bytes value = 2;
51+
52+
string username = 3;
53+
54+
string email = 4;
55+
56+
string provider = 5;
57+
58+
map<string, string> metadata = 6;
59+
60+
string version = 7;
61+
62+
google.protobuf.Timestamp created_at = 8;
63+
64+
google.protobuf.Timestamp resolved_at = 9;
65+
66+
google.protobuf.Timestamp expires_at = 10;
67+
}
68+
}

0 commit comments

Comments
 (0)