syntax = "proto3";

package litrpc;

option go_package = "github.com/lightninglabs/lightning-terminal/litrpc";

service Proxy {
    /* litcli: `getinfo`
    GetInfo returns general information concerning the LiTd node.
    */
    rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);

    /* litcli: `stop`
    StopDaemon will send a shutdown request to the interrupt handler,
    triggering a graceful shutdown of the daemon.
    */
    rpc StopDaemon (StopDaemonRequest) returns (StopDaemonResponse);

    /* litcli: `bakesupermacaroon`
    BakeSuperMacaroon bakes a new macaroon that includes permissions for
    all the active daemons that LiT is connected to.
    */
    rpc BakeSuperMacaroon (BakeSuperMacaroonRequest)
        returns (BakeSuperMacaroonResponse);
}

message BakeSuperMacaroonRequest {
    /*
    The root key ID suffix is the 4-byte suffix of the root key ID that will
    be used to create the macaroon.
    */
    uint32 root_key_id_suffix = 1;

    /*
    Whether the macaroon should only contain read permissions.
    */
    bool read_only = 2;
}

message BakeSuperMacaroonResponse {
    // The hex encoded macaroon.
    string macaroon = 1;
}

message StopDaemonRequest {
}

message StopDaemonResponse {
}

message GetInfoRequest {
}

message GetInfoResponse {
    // The application version of the LiTd software running on the node,
    // following the Semantic Versioning 2.0.0 specification
    // (http://semver.org/).
    string version = 1;

    // The Git commit hash the LiTd binary build was based on. If the build had
    // uncommited changes, this field will contain the most recent commit hash,
    // suffixed by "-dirty".
    string commit_hash = 2;
}