This commit is contained in:
hatim boufnichel 2022-11-04 21:22:18 +01:00
parent c5fd454089
commit 4f550a937f
69 changed files with 8098 additions and 23341 deletions

View file

@ -10,15 +10,15 @@ option (file_options) = {
supported_http_methods:["post", "get"];
supported_auths:[
{
id: "no_auth"
name: "NoAuth"
id: "guest"
name: "Guest"
context:[]
},
{
id: "guest"
name: "Guest",
id: "user"
name: "User",
context:{
key:"token",
key:"user_id",
value:"string"
}
},
@ -27,7 +27,7 @@ option (file_options) = {
name: "Admin",
encrypted:true,
context:{
key:"pub",
key:"admin_id",
value:"string"
}
}
@ -63,18 +63,60 @@ extend google.protobuf.FileOptions {
service LightningPub {
rpc Health(structs.Empty) returns (structs.Empty){
option (auth_type) = "NoAuth";
option (auth_type) = "Guest";
option (http_method) = "get";
option (http_route) = "/health";
option (http_route) = "/api/health";
};
rpc EncryptionExchange(structs.EncryptionExchangeRequest) returns (structs.Empty){
option (auth_type) = "NoAuth";
option (auth_type) = "Guest";
option (http_method) = "post";
option (http_route) = "/api/encryption/exchange";
};
rpc LndGetInfo(structs.Empty) returns (structs.LndGetInfoResponse){
option (auth_type) = "NoAuth";
option (http_method) = "get";
rpc LndGetInfo(structs.LndGetInfoRequest) returns (structs.LndGetInfoResponse){
option (auth_type) = "Admin";
option (http_method) = "post";
option (http_route) = "/api/lnd/getinfo";
};
rpc AddUser(structs.AddUserRequest)returns (structs.AddUserResponse){
option (auth_type) = "Guest";
option (http_method) = "post";
option (http_route) = "/api/user/add";
}
rpc AuthUser(structs.AuthUserRequest)returns (structs.AuthUserResponse){
option (auth_type) = "Guest";
option (http_method) = "post";
option (http_route) = "/api/user/auth";
}
// USER
rpc NewAddress(structs.Empty) returns (structs.NewAddressResponse) {
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/chain/new";
}
rpc PayAddress(structs.PayAddressRequest) returns (structs.PayAddressResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/chain/pay";
}
rpc NewInvoice(structs.NewInvoiceRequest) returns (structs.NewInvoiceResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/invoice/new";
}
rpc PayInvoice(structs.PayInvoiceRequest) returns (structs.PayInvoiceResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/invoice/pay";
}
rpc OpenChannel(structs.OpenChannelRequest) returns (structs.OpenChannelResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/open/channel";
}
rpc GetOpenChannelLNURL(structs.Empty) returns (structs.GetOpenChannelLNURLResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/lnurl_channel";
}
}

View file

@ -12,6 +12,73 @@ message EncryptionExchangeRequest {
string device_id = 2;
}
message LndGetInfoRequest {
int64 node_id = 1;
}
message LndGetInfoResponse {
string alias = 1;
}
message NewAddressResponse{
string address = 1;
}
message PayAddressRequest{
string address = 1;
int64 amout_sats = 2;
}
message PayAddressResponse{
string tx_id = 1;
}
message NewInvoiceRequest{
int64 amount_sats = 1;
}
message NewInvoiceResponse{
string invoice = 1;
}
message PayInvoiceRequest{
string invoce = 1;
}
message PayInvoiceResponse{
string preimage = 1;
}
message OpenChannelRequest{
string destination = 1;
int64 channel_balance = 2;
int64 push_amount = 3;
}
message OpenChannelResponse{
string channel_id = 1;
}
message GetOpenChannelLNURLResponse{
string lnurl = 1;
}
message AddUserRequest{
string callback_url = 1;
string name = 2;
string secret = 3;
}
message AddUserResponse{
string user_id = 1;
string auth_token = 2;
}
message AuthUserRequest{
string name = 2;
string secret = 3;
}
message AuthUserResponse{
string user_id = 1;
string auth_token = 2;
}