Skip to main content

AddAutopilotSession

AddAutopilotSession creates a new LNC session and attempts to register it with the Autopilot server.

Source: lit-autopilot.proto

gRPC

rpc AddAutopilotSession (AddAutopilotSessionRequest) returns (AddAutopilotSessionResponse);

REST

HTTP MethodPath
POST /v1/autopilot/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-autopilot.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.Autopilot(GRPC_HOST, creds);
let request = {
label: <string>,
expiry_timestamp_seconds: <uint64>,
mailbox_server_addr: <string>,
dev_server: <bool>,
features: <FeaturesEntry>,
session_rules: <RulesMap>,
no_privacy_mapper: <bool>,
linked_group_id: <bytes>,
privacy_flags: <uint64>,
privacy_flags_set: <bool>,
};
client.addAutopilotSession(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "session": <Session>,
// }

Messages

litrpc.AddAutopilotSessionRequest

Source: lit-autopilot.proto

FieldgRPC TypeREST TypeREST Placement
label
stringstringbody
expiry_timestamp_seconds
uint64stringbody
mailbox_server_addr
stringstringbody
dev_server
boolbooleanbody
features
FeaturesEntry[]objectbody
session_rules
RulesMapobjectbody
no_privacy_mapper
boolbooleanbody
linked_group_id
bytesstringbody
privacy_flags
uint64stringbody
privacy_flags_set
boolbooleanbody

litrpc.AddAutopilotSessionResponse

Source: lit-autopilot.proto

FieldgRPC TypeREST Type
session
Sessionobject

Nested Messages

litrpc.AddAutopilotSessionRequest.FeaturesEntry

FieldgRPC TypeREST Type
key
stringunknown
value
FeatureConfigunknown

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.FeatureConfig

FieldgRPC TypeREST Type
rules
RulesMapobject
config
bytesstring

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