cmd/litcli: create account sessions

Create LNC account sessions through litcli
This commit is contained in:
Elle Mouton 2023-01-13 15:22:04 +02:00
parent 6a5a8c68f6
commit d3cab70928
No known key found for this signature in database
GPG key ID: D7D916376026F177

View file

@ -69,7 +69,7 @@ var addSessionCommand = cli.Command{
Usage: "session type to be created which will " +
"determine the permissions a user has when " +
"connecting with the session. Options " +
"include readonly|admin|custom",
"include readonly|admin|account|custom",
Value: "readonly",
},
cli.StringSliceFlag{
@ -85,6 +85,13 @@ var addSessionCommand = cli.Command{
"For example, '/lnrpc\\..*' will result in " +
"all `lnrpc` permissions being included.",
},
cli.StringFlag{
Name: "account_id",
Usage: "The account id that should be used for " +
"the account session. Note that this flag " +
"will only be used if the 'type' flag is " +
"set to 'account'.",
},
},
}
@ -122,6 +129,7 @@ func addSession(ctx *cli.Context) error {
MailboxServerAddr: ctx.String("mailboxserveraddr"),
DevServer: ctx.Bool("devserver"),
MacaroonCustomPermissions: macPerms,
AccountId: ctx.String("account_id"),
},
)
if err != nil {
@ -139,6 +147,8 @@ func parseSessionType(sessionType string) (litrpc.SessionType, error) {
return litrpc.SessionType_TYPE_MACAROON_ADMIN, nil
case "readonly":
return litrpc.SessionType_TYPE_MACAROON_READONLY, nil
case "account":
return litrpc.SessionType_TYPE_MACAROON_ACCOUNT, nil
case "custom":
return litrpc.SessionType_TYPE_MACAROON_CUSTOM, nil
default: