Skip to content

Commit

Permalink
proto: run make protos
Browse files Browse the repository at this point in the history
  • Loading branch information
ellemouton committed Mar 20, 2023
1 parent 7d55d74 commit e203fee
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 15 deletions.
8 changes: 4 additions & 4 deletions proto/lit-accounts.proto
Expand Up @@ -5,7 +5,7 @@ package litrpc;
option go_package = "github.com/lightninglabs/lightning-terminal/litrpc";

service Accounts {
/*
/* litcli: `accounts create`
CreateAccount adds an entry to the account database. This entry represents
an amount of satoshis (account balance) that can be spent using off-chain
transactions (e.g. paying invoices).
Expand All @@ -20,18 +20,18 @@ service Accounts {
*/
rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse);

/*
/* litcli: `accounts update`
UpdateAccount updates an existing account in the account database.
*/
rpc UpdateAccount (UpdateAccountRequest) returns (Account);

/*
/* litcli: `accounts list`
ListAccounts returns all accounts that are currently stored in the account
database.
*/
rpc ListAccounts (ListAccountsRequest) returns (ListAccountsResponse);

/*
/* litcli: `accounts remove`
RemoveAccount removes the given account from the account database.
*/
rpc RemoveAccount (RemoveAccountRequest) returns (RemoveAccountResponse);
Expand Down
149 changes: 138 additions & 11 deletions proto/lit-sessions.proto
Expand Up @@ -7,10 +7,20 @@ option go_package = "github.com/lightninglabs/lightning-terminal/litrpc";
// Sessions is a service that gives access to the core functionalities of the
// daemon's session system.
service Sessions {
/* litcli: `sessions add`
AddSession adds and starts a new LNC session.
*/
rpc AddSession (AddSessionRequest) returns (AddSessionResponse);

/* litcli: `sessions list`
ListSessions returns all sessions known to the session store.
*/
rpc ListSessions (ListSessionsRequest) returns (ListSessionsResponse);

/* litcli: `sessions revoke`
RevokeSession revokes a single session and also stops it if it is currently
active.
*/
rpc RevokeSession (RevokeSessionRequest) returns (RevokeSessionResponse);
}

Expand All @@ -24,34 +34,61 @@ enum SessionType {
}

message AddSessionRequest {
/*
A user assigned label for the session.
*/
string label = 1;

/*
The session type. This will be used during macaroon construction to
determine how restrictive to make the macaroon and thus the session access.
*/
SessionType session_type = 2;

/*
The time at which the session should automatically be revoked.
*/
uint64 expiry_timestamp_seconds = 3 [jstype = JS_STRING];

/*
The address of the mailbox server that the LNC connection should use.
*/
string mailbox_server_addr = 4;

/*
If set to true, tls will be skipped when connecting to the mailbox.
*/
bool dev_server = 5;

/*
Any custom permissions to add the session's macaroon.
*/
repeated MacaroonPermission macaroon_custom_permissions = 6;

/*
The ID of the account to associate this session with. This should only be
set if the session_type is TYPE_MACAROON_ACCOUNT.
*/
string account_id = 7;
}

message MacaroonPermission {
// The entity a permission grants access to. If a entity is set to the
// "uri" keyword then the action entry should be one of the special cases
// described in the comment for action.
/*
The entity a permission grants access to. If a entity is set to the
"uri" keyword then the action entry should be one of the special cases
described in the comment for action.
*/
string entity = 1;

// The action that is granted. If entity is set to "uri", then action must
// be set to either:
// - a particular URI to which access should be granted.
// - a URI regex, in which case access will be granted to each URI that
// matches the regex.
// - the "***readonly***" keyword. This will result in the access being
// granted to all read-only endpoints.
/*
The action that is granted. If entity is set to "uri", then action must
be set to either:
- a particular URI to which access should be granted.
- a URI regex, in which case access will be granted to each URI that
matches the regex.
- the "***readonly***" keyword. This will result in the access being
granted to all read-only endpoints.
*/
string action = 2;
}

Expand All @@ -63,38 +100,94 @@ enum SessionState {
}

message AddSessionResponse {
/*
The session of the newly created session.
*/
Session session = 1;
}

message Session {
/*
A unique ID assigned to the session. It is derived from the session
macaroon.
*/
bytes id = 14;

/*
A user assigned label for the session.
*/
string label = 1;

/*
The current state that the session is in. This will give an indication of
if the session is currently usable or not.
*/
SessionState session_state = 2;

/*
The session type. The will given an indication of the restrictions applied
to the macaroon assigned to the session.
*/
SessionType session_type = 3;

/*
The time at which the session will automatically be revoked.
*/
uint64 expiry_timestamp_seconds = 4 [jstype = JS_STRING];

/*
The address of the mailbox server that the LNC connection should use.
*/
string mailbox_server_addr = 5;

/*
If set to true, tls will be skipped when connecting to the mailbox.
*/
bool dev_server = 6;

/*
The LNC pairing phrase in byte form.
*/
bytes pairing_secret = 7;

/*
The LNC pairing phrase in mnemonic form.
*/
string pairing_secret_mnemonic = 8;

/*
The long term, local static public key used by this node for the LNC
connection.
*/
bytes local_public_key = 9;

/*
The long term, remote static public key used by the remote party for the
LNC connection.
*/
bytes remote_public_key = 10;

/*
The time at which the session was created.
*/
uint64 created_at = 11 [jstype = JS_STRING];

/*
The recipe used for creating a macaroon to use with this session. This will
be closely linked to the session type.
*/
MacaroonRecipe macaroon_recipe = 12;

/*
If the session is for a specific account, then this will be the account ID
it is associated with.
*/
string account_id = 13;

/*
If this session is for Autopilot use, then this will be the set of features
that the session can be used for along with the rules for each feature.
*/
map<string, RulesMap> autopilot_feature_info = 15;

/*
Expand All @@ -109,19 +202,32 @@ message Session {
}

message MacaroonRecipe {
/*
A list of permissions that should be included in the macaroon.
*/
repeated MacaroonPermission permissions = 1;

/*
A list of caveats to add to the macaroon.
*/
repeated string caveats = 2;
}

message ListSessionsRequest {
}

message ListSessionsResponse {
/*
A list of sessions.
*/
repeated Session sessions = 1;
}

message RevokeSessionRequest {
/*
The local static key of the session to be revoked.
When using REST, this field must be encoded as base64.
*/
bytes local_public_key = 8;
}

Expand Down Expand Up @@ -230,22 +336,43 @@ message ChannelPolicyBounds {
}

message OffChainBudget {
/*
The maximum amount that can be spent off-chain excluding fees.
*/
uint64 max_amt_msat = 1 [jstype = JS_STRING];

/*
The maximum amount that can be spent off-chain on fees.
*/
uint64 max_fees_msat = 2 [jstype = JS_STRING];
}

message OnChainBudget {
/*
The maximum amount that can be spent on-chain including fees.
*/
uint64 absolute_amt_sats = 1 [jstype = JS_STRING];

/*
The maximum amount that can be spent on-chain in fees.
*/
uint64 max_sat_per_v_byte = 2 [jstype = JS_STRING];
}

message SendToSelf {
}

message ChannelRestrict {
/*
A list of channel IDs that the Autopilot should _not_ perform any actions
on.
*/
repeated uint64 channel_ids = 1 [jstype = JS_STRING];
}

message PeerRestrict {
/*
A list of peer IDs that the Autopilot should _not_ perform any actions on.
*/
repeated string peer_ids = 1;
}
}

0 comments on commit e203fee

Please sign in to comment.