1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package guestcp
import (
"context"
"encoding/json"
"github.com/johnandersen777/socialweb-computer-kcp/api/v1alpha1"
)
const (
CapabilityInputs = "guestcp.inputs"
CapabilityGuests = "guestcp.guests"
CapabilityGrants = "guestcp.grants"
)
type Inputs struct {
DID string
Issuer string
OpenBao *v1alpha1.OpenBaoServerStatus
ComputeVMs []v1alpha1.ComputeVM
Grants []v1alpha1.GuestIdentityGrant
}
type Source interface {
Inputs(ctx context.Context) (Inputs, error)
Watch(fn func(Inputs)) (cancel func())
}
type Guests interface {
RecordGuest(ctx context.Context, name string, report v1alpha1.ComputeVMGuestReport) error
}
type Grants interface {
Apply(ctx context.Context, grant v1alpha1.GuestIdentityGrant) error
Delete(ctx context.Context, name string) error
}
type Reply struct {
Status int
Body json.RawMessage
}
type EventsRequest struct {
AcceptURI string
AcceptCID string
Record map[string]any
}
type Plane interface {
LoginStep(ctx context.Context, step string, input map[string]any) Reply
OIDCToken(ctx context.Context, role, vaultToken string) Reply
Discovery(ctx context.Context) Reply
Keys(ctx context.Context) Reply
Events(ctx context.Context, authorization string, request EventsRequest) Reply
Authenticate(ctx context.Context, authorization string) (string, error)
}
type Relay interface {
URL() string
Close()
}