Skip to main content

ListSessions

ListSessions returns all sessions known to the session store.

Source: lit-sessions.proto

gRPC

rpc ListSessions (ListSessionsRequest) returns (ListSessionsResponse);

REST

HTTP MethodPath
GET /v1/sessions

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:8443'
const MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
const TLS_PATH = 'LIT_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('lit-sessions.proto', loaderOptions);
const litrpc = grpc.loadPackageDefinition(packageDefinition).litrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new litrpc.Sessions(GRPC_HOST, creds);
let request = {};
client.listSessions(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "sessions": <Session>,
// }

Messages

litrpc.ListSessionsRequest

Source: lit-sessions.proto

note

This request has no parameters.

litrpc.ListSessionsResponse

Source: lit-sessions.proto

FieldgRPC TypeREST Type
sessions
Session[]array

Nested Messages

litrpc.ChannelConstraint

FieldgRPC TypeREST Type
min_capacity_sat
uint64string
max_capacity_sat
uint64string
max_push_sat
uint64string
private_allowed
boolboolean
public_allowed
boolboolean

litrpc.ChannelPolicyBounds

FieldgRPC TypeREST Type
min_base_msat
uint64string
max_base_msat
uint64string
min_rate_ppm
uint32integer
max_rate_ppm
uint32integer
min_cltv_delta
uint32integer
max_cltv_delta
uint32integer
min_htlc_msat
uint64string
max_htlc_msat
uint64string

litrpc.ChannelRestrict

FieldgRPC TypeREST Type
channel_ids
uint64[]array

litrpc.HistoryLimit

FieldgRPC TypeREST Type
start_time
uint64string
duration
uint64string

litrpc.MacaroonPermission

FieldgRPC TypeREST Type
entity
stringstring
action
stringstring

litrpc.MacaroonRecipe

FieldgRPC TypeREST Type
permissions
MacaroonPermission[]array
caveats
string[]array

litrpc.OffChainBudget

FieldgRPC TypeREST Type
max_amt_msat
uint64string
max_fees_msat
uint64string

litrpc.OnChainBudget

FieldgRPC TypeREST Type
absolute_amt_sats
uint64string
max_sat_per_v_byte
uint64string

litrpc.PeerRestrict

FieldgRPC TypeREST Type
peer_ids
string[]array

litrpc.Rate

FieldgRPC TypeREST Type
iterations
uint32integer
num_hours
uint32integer

litrpc.RateLimit

FieldgRPC TypeREST Type
read_limit
Rateobject
write_limit
Rateobject

litrpc.RulesMap

FieldgRPC TypeREST Type
rules
RulesEntry[]object

litrpc.RulesMap.RulesEntry

FieldgRPC TypeREST Type
key
stringunknown
value
RuleValueunknown

litrpc.RuleValue

FieldgRPC TypeREST Type
rate_limit
RateLimitobject
chan_policy_bounds
ChannelPolicyBoundsobject
history_limit
HistoryLimitobject
off_chain_budget
OffChainBudgetobject
on_chain_budget
OnChainBudgetobject
send_to_self
SendToSelfobject
channel_restrict
ChannelRestrictobject
peer_restrict
PeerRestrictobject
channel_constraint
ChannelConstraintobject

litrpc.SendToSelf

note

This response has no parameters.

litrpc.Session

FieldgRPC TypeREST Type
id
bytesstring
label
stringstring
session_state
SessionStatestring
session_type
SessionTypestring
expiry_timestamp_seconds
uint64string
mailbox_server_addr
stringstring
dev_server
boolboolean
pairing_secret
bytesstring
pairing_secret_mnemonic
stringstring
local_public_key
bytesstring
remote_public_key
bytesstring
created_at
uint64string
macaroon_recipe
MacaroonRecipeobject
account_id
stringstring
autopilot_feature_info
AutopilotFeatureInfoEntry[]object
revoked_at
uint64string
group_id
bytesstring
feature_configs
FeatureConfigsEntry[]object
privacy_flags
uint64string

litrpc.Session.AutopilotFeatureInfoEntry

FieldgRPC TypeREST Type
key
stringunknown
value
RulesMapunknown

litrpc.Session.FeatureConfigsEntry

FieldgRPC TypeREST Type
key
stringunknown
value
stringunknown

Enums

litrpc.SessionState

NameNumber
STATE_CREATED
0
STATE_IN_USE
1
STATE_REVOKED
2
STATE_EXPIRED
3

litrpc.SessionType

NameNumber
TYPE_MACAROON_READONLY
0
TYPE_MACAROON_ADMIN
1
TYPE_MACAROON_CUSTOM
2
TYPE_UI_PASSWORD
3
TYPE_AUTOPILOT
4
TYPE_MACAROON_ACCOUNT
5