@@ -18,12 +18,25 @@ export enum SessionState {
18
18
}
19
19
20
20
export interface AddSessionRequest {
21
+ /** A user assigned label for the session. */
21
22
label : string ;
23
+ /**
24
+ * The session type. This will be used during macaroon construction to
25
+ * determine how restrictive to make the macaroon and thus the session access.
26
+ */
22
27
sessionType : SessionType ;
28
+ /** The time at which the session should automatically be revoked. */
23
29
expiryTimestampSeconds : string ;
30
+ /** The address of the mailbox server that the LNC connection should use. */
24
31
mailboxServerAddr : string ;
32
+ /** If set to true, tls will be skipped when connecting to the mailbox. */
25
33
devServer : boolean ;
34
+ /** Any custom permissions to add the session's macaroon. */
26
35
macaroonCustomPermissions : MacaroonPermission [ ] ;
36
+ /**
37
+ * The ID of the account to associate this session with. This should only be
38
+ * set if the session_type is TYPE_MACAROON_ACCOUNT.
39
+ */
27
40
accountId : string ;
28
41
}
29
42
@@ -37,34 +50,74 @@ export interface MacaroonPermission {
37
50
/**
38
51
* The action that is granted. If entity is set to "uri", then action must
39
52
* be set to either:
40
- * - a particular URI to which access should be granted.
41
- * - a URI regex, in which case access will be granted to each URI that
42
- * matches the regex.
43
- * - the "***readonly***" keyword. This will result in the access being
44
- * granted to all read-only endpoints.
53
+ * - a particular URI to which access should be granted.
54
+ * - a URI regex, in which case access will be granted to each URI that
55
+ * matches the regex.
56
+ * - the "***readonly***" keyword. This will result in the access being
57
+ * granted to all read-only endpoints.
45
58
*/
46
59
action : string ;
47
60
}
48
61
49
62
export interface AddSessionResponse {
63
+ /** The session of the newly created session. */
50
64
session : Session | undefined ;
51
65
}
52
66
53
67
export interface Session {
68
+ /**
69
+ * A unique ID assigned to the session. It is derived from the session
70
+ * macaroon.
71
+ */
54
72
id : Uint8Array | string ;
73
+ /** A user assigned label for the session. */
55
74
label : string ;
75
+ /**
76
+ * The current state that the session is in. This will give an indication of
77
+ * if the session is currently usable or not.
78
+ */
56
79
sessionState : SessionState ;
80
+ /**
81
+ * The session type. The will given an indication of the restrictions applied
82
+ * to the macaroon assigned to the session.
83
+ */
57
84
sessionType : SessionType ;
85
+ /** The time at which the session will automatically be revoked. */
58
86
expiryTimestampSeconds : string ;
87
+ /** The address of the mailbox server that the LNC connection should use. */
59
88
mailboxServerAddr : string ;
89
+ /** If set to true, tls will be skipped when connecting to the mailbox. */
60
90
devServer : boolean ;
91
+ /** The LNC pairing phrase in byte form. */
61
92
pairingSecret : Uint8Array | string ;
93
+ /** The LNC pairing phrase in mnemonic form. */
62
94
pairingSecretMnemonic : string ;
95
+ /**
96
+ * The long term, local static public key used by this node for the LNC
97
+ * connection.
98
+ */
63
99
localPublicKey : Uint8Array | string ;
100
+ /**
101
+ * The long term, remote static public key used by the remote party for the
102
+ * LNC connection.
103
+ */
64
104
remotePublicKey : Uint8Array | string ;
105
+ /** The time at which the session was created. */
65
106
createdAt : string ;
107
+ /**
108
+ * The recipe used for creating a macaroon to use with this session. This will
109
+ * be closely linked to the session type.
110
+ */
66
111
macaroonRecipe : MacaroonRecipe | undefined ;
112
+ /**
113
+ * If the session is for a specific account, then this will be the account ID
114
+ * it is associated with.
115
+ */
67
116
accountId : string ;
117
+ /**
118
+ * If this session is for Autopilot use, then this will be the set of features
119
+ * that the session can be used for along with the rules for each feature.
120
+ */
68
121
autopilotFeatureInfo : { [ key : string ] : RulesMap } ;
69
122
/**
70
123
* The unix timestamp indicating the time at which the session was revoked.
@@ -83,17 +136,24 @@ export interface Session_AutopilotFeatureInfoEntry {
83
136
}
84
137
85
138
export interface MacaroonRecipe {
139
+ /** A list of permissions that should be included in the macaroon. */
86
140
permissions : MacaroonPermission [ ] ;
141
+ /** A list of caveats to add to the macaroon. */
87
142
caveats : string [ ] ;
88
143
}
89
144
90
145
export interface ListSessionsRequest { }
91
146
92
147
export interface ListSessionsResponse {
148
+ /** A list of sessions. */
93
149
sessions : Session [ ] ;
94
150
}
95
151
96
152
export interface RevokeSessionRequest {
153
+ /**
154
+ * The local static key of the session to be revoked.
155
+ * When using REST, this field must be encoded as base64url.
156
+ */
97
157
localPublicKey : Uint8Array | string ;
98
158
}
99
159
@@ -170,22 +230,31 @@ export interface ChannelPolicyBounds {
170
230
}
171
231
172
232
export interface OffChainBudget {
233
+ /** The maximum amount that can be spent off-chain excluding fees. */
173
234
maxAmtMsat : string ;
235
+ /** The maximum amount that can be spent off-chain on fees. */
174
236
maxFeesMsat : string ;
175
237
}
176
238
177
239
export interface OnChainBudget {
240
+ /** The maximum amount that can be spent on-chain including fees. */
178
241
absoluteAmtSats : string ;
242
+ /** The maximum amount that can be spent on-chain in fees. */
179
243
maxSatPerVByte : string ;
180
244
}
181
245
182
246
export interface SendToSelf { }
183
247
184
248
export interface ChannelRestrict {
249
+ /**
250
+ * A list of channel IDs that the Autopilot should _not_ perform any actions
251
+ * on.
252
+ */
185
253
channelIds : string [ ] ;
186
254
}
187
255
188
256
export interface PeerRestrict {
257
+ /** A list of peer IDs that the Autopilot should _not_ perform any actions on. */
189
258
peerIds : string [ ] ;
190
259
}
191
260
@@ -194,8 +263,25 @@ export interface PeerRestrict {
194
263
* daemon's session system.
195
264
*/
196
265
export interface Sessions {
197
- addSession ( request ?: DeepPartial < AddSessionRequest > ) : Promise < AddSessionResponse > ;
198
- listSessions ( request ?: DeepPartial < ListSessionsRequest > ) : Promise < ListSessionsResponse > ;
266
+ /**
267
+ * litcli: `sessions add`
268
+ * AddSession adds and starts a new LNC session.
269
+ */
270
+ addSession (
271
+ request ?: DeepPartial < AddSessionRequest >
272
+ ) : Promise < AddSessionResponse > ;
273
+ /**
274
+ * litcli: `sessions list`
275
+ * ListSessions returns all sessions known to the session store.
276
+ */
277
+ listSessions (
278
+ request ?: DeepPartial < ListSessionsRequest >
279
+ ) : Promise < ListSessionsResponse > ;
280
+ /**
281
+ * litcli: `sessions revoke`
282
+ * RevokeSession revokes a single session and also stops it if it is currently
283
+ * active.
284
+ */
199
285
revokeSession (
200
286
request ?: DeepPartial < RevokeSessionRequest >
201
287
) : Promise < RevokeSessionResponse > ;
@@ -219,4 +305,3 @@ type DeepPartial<T> = T extends Builtin
219
305
: T extends { }
220
306
? { [ K in keyof T ] ?: DeepPartial < T [ K ] > }
221
307
: Partial < T > ;
222
-
0 commit comments