Skip to content

Commit 3b67325

Browse files
committed
multi: implement lit-autopilot rpc server
1 parent f9ffc0c commit 3b67325

File tree

5 files changed

+613
-23
lines changed

5 files changed

+613
-23
lines changed

itest/litd_mode_integrated_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ var (
153153
litConn := litrpc.NewAccountsClient(c)
154154
return litConn.ListAccounts(ctx, &litrpc.ListAccountsRequest{})
155155
}
156+
litAutopilotRequestFn = func(ctx context.Context,
157+
c grpc.ClientConnInterface) (proto.Message, error) {
158+
159+
litConn := litrpc.NewAutopilotClient(c)
160+
return litConn.ListAutopilotFeatures(
161+
ctx, &litrpc.ListAutopilotFeaturesRequest{},
162+
)
163+
}
156164
litMacaroonFn = func(cfg *LitNodeConfig) string {
157165
return cfg.LitMacPath
158166
}
@@ -232,6 +240,13 @@ var (
232240
successPattern: "\"accounts\":[]",
233241
allowedThroughLNC: false,
234242
grpcWebURI: "/litrpc.Accounts/ListAccounts",
243+
}, {
244+
name: "litrpc-autopilot",
245+
macaroonFn: litMacaroonFn,
246+
requestFn: litAutopilotRequestFn,
247+
successPattern: "\"features\":{",
248+
allowedThroughLNC: true,
249+
grpcWebURI: "/litrpc.Autopilot/ListAutopilotFeatures",
235250
}}
236251

237252
// customURIs is a map of endpoint URIs that we want to allow via a

perms/permissions.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,26 @@ var (
6262
Entity: "account",
6363
Action: "write",
6464
}},
65-
"/litrpc.Lit/ListActions": {{
65+
"/litrpc.Firewall/ListActions": {{
6666
Entity: "actions",
6767
Action: "read",
6868
}},
69+
"/litrpc.Autopilot/ListAutopilotFeatures": {{
70+
Entity: "autopilot",
71+
Action: "read",
72+
}},
73+
"/litrpc.Autopilot/AddAutopilotSession": {{
74+
Entity: "autopilot",
75+
Action: "write",
76+
}},
77+
"/litrpc.Autopilot/ListAutopilotSessions": {{
78+
Entity: "autopilot",
79+
Action: "read",
80+
}},
81+
"/litrpc.Autopilot/RevokeAutopilotSession": {{
82+
Entity: "autopilot",
83+
Action: "write",
84+
}},
6985
}
7086

7187
// whiteListedLNDMethods is a map of all lnd RPC methods that don't

session/interface.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515
type Type uint8
1616

1717
const (
18-
TypeMacaroonReadonly Type = 0
19-
TypeMacaroonAdmin Type = 1
20-
TypeMacaroonCustom Type = 2
21-
TypeUIPassword Type = 3
22-
typeReservedForFutureUse Type = 4
23-
TypeMacaroonAccount Type = 5
18+
TypeMacaroonReadonly Type = 0
19+
TypeMacaroonAdmin Type = 1
20+
TypeMacaroonCustom Type = 2
21+
TypeUIPassword Type = 3
22+
TypeAutopilot Type = 4
23+
TypeMacaroonAccount Type = 5
2424
)
2525

2626
// State represents the state of a session.

0 commit comments

Comments
 (0)