File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import (
12
12
"github.com/lightninglabs/lightning-terminal/litrpc"
13
13
"github.com/lightninglabs/lightning-terminal/session"
14
14
"google.golang.org/grpc"
15
+ "gopkg.in/macaroon-bakery.v2/bakery/checkers"
16
+ "gopkg.in/macaroon.v2"
15
17
)
16
18
17
19
// sessionRpcServer is the gRPC server for the Session RPC interface.
@@ -188,11 +190,22 @@ func (s *sessionRpcServer) resumeSession(sess *session.Session) error {
188
190
return nil
189
191
}
190
192
191
- readOnly := sess .Type == session .TypeMacaroonReadonly
193
+ var (
194
+ caveats []macaroon.Caveat
195
+ readOnly = sess .Type == session .TypeMacaroonReadonly
196
+ )
197
+
198
+ // Add the session expiry as a macaroon caveat.
199
+ macExpiry := checkers .TimeBeforeCaveat (sess .Expiry )
200
+ caveats = append (caveats , macaroon.Caveat {
201
+ Id : []byte (macExpiry .Condition ),
202
+ })
203
+
192
204
mac , err := s .cfg .superMacBaker (
193
205
context .Background (), sess .MacaroonRootKey ,
194
206
& session.MacaroonRecipe {
195
207
Permissions : GetAllPermissions (readOnly ),
208
+ Caveats : caveats ,
196
209
},
197
210
)
198
211
if err != nil {
You can’t perform that action at this time.
0 commit comments