mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
multi: add litrpc package
This commit is contained in:
parent
fda99a862f
commit
81e893f7b5
14 changed files with 3462 additions and 8 deletions
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
|
@ -168,3 +168,6 @@ jobs:
|
|||
|
||||
- name: run check
|
||||
run: make protos-check
|
||||
|
||||
- name: compile rpc for golang
|
||||
run: make rpc
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -193,6 +193,10 @@ list:
|
|||
grep -v Makefile | \
|
||||
sort
|
||||
|
||||
rpc:
|
||||
@$(call print, "Compiling protos.")
|
||||
cd ./litrpc; ./gen_protos_docker.sh
|
||||
|
||||
protos:
|
||||
@$(call print, "Compiling protos.")
|
||||
cd proto; ./gen_protos_docker.sh
|
||||
|
|
|
|||
|
|
@ -50,11 +50,30 @@ const protoSources = async () => {
|
|||
|
||||
/** list of proto files and patches to apply */
|
||||
const filePatches = {
|
||||
lnd: 'lnrpc: {}',
|
||||
loop: 'looprpc: {}',
|
||||
common: 'looprpc: {}',
|
||||
trader: 'poolrpc: {}',
|
||||
'auctioneerrpc/auctioneer': 'poolrpc: {}',
|
||||
lnd: {
|
||||
patch: 'lnrpc: {}',
|
||||
folder: 'proto'
|
||||
},
|
||||
loop: {
|
||||
patch: 'looprpc: {}',
|
||||
folder: 'proto'
|
||||
},
|
||||
common: {
|
||||
patch: 'looprpc: {}',
|
||||
folder: 'proto'
|
||||
},
|
||||
trader: {
|
||||
patch: 'poolrpc: {}',
|
||||
folder: 'proto'
|
||||
},
|
||||
'auctioneerrpc/auctioneer': {
|
||||
patch: 'poolrpc: {}',
|
||||
folder: 'proto'
|
||||
},
|
||||
'lit-sessions': {
|
||||
patch: 'litrpc: {}',
|
||||
folder: 'litrpc'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +105,7 @@ const download = async () => {
|
|||
*/
|
||||
const sanitize = async () => {
|
||||
const filePaths = Object.keys(filePatches).map(name =>
|
||||
join(appPath, '..', 'proto', `${name}.proto`),
|
||||
join(appPath, '..', filePatches[name].folder, `${name}.proto`),
|
||||
);
|
||||
for (path of filePaths) {
|
||||
let content = (await fs.readFile(path)).toString();
|
||||
|
|
@ -113,14 +132,18 @@ const generate = async () => {
|
|||
'.bin',
|
||||
platform() === 'win32' ? 'protoc-gen-ts.cmd' : 'protoc-gen-ts',
|
||||
);
|
||||
const files = Object
|
||||
.keys(filePatches)
|
||||
.map(name => `../${filePatches[name].folder}/${name}.proto`);
|
||||
const protocCmd = [
|
||||
'protoc',
|
||||
`-I../proto`,
|
||||
`-I../litrpc`,
|
||||
`--plugin=protoc-gen-ts=${protocGen}`,
|
||||
'--proto_path=../proto',
|
||||
'--js_out=import_style=commonjs,binary:./src/types/generated',
|
||||
'--ts_out=service=grpc-web:./src/types/generated',
|
||||
...Object.keys(filePatches).map(file => `../proto/${file}.proto`),
|
||||
...files,
|
||||
].join(' ');
|
||||
|
||||
console.log(protocCmd);
|
||||
|
|
@ -153,7 +176,7 @@ const patch = async () => {
|
|||
// apply the webpack patch
|
||||
const patch = [
|
||||
'/* eslint-disable */',
|
||||
`var proto = { ${filePatches[filename]} };`,
|
||||
`var proto = { ${filePatches[filename].patch} };`,
|
||||
'',
|
||||
].join('\n');
|
||||
content = `${patch}\n${content}`;
|
||||
|
|
|
|||
249
app/src/types/generated/lit-sessions_pb.d.ts
generated
vendored
Normal file
249
app/src/types/generated/lit-sessions_pb.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
// package: litrpc
|
||||
// file: lit-sessions.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
|
||||
export class AddSessionRequest extends jspb.Message {
|
||||
getLabel(): string;
|
||||
setLabel(value: string): void;
|
||||
|
||||
getSessionType(): SessionTypeMap[keyof SessionTypeMap];
|
||||
setSessionType(value: SessionTypeMap[keyof SessionTypeMap]): void;
|
||||
|
||||
getExpiryTimestampSeconds(): string;
|
||||
setExpiryTimestampSeconds(value: string): void;
|
||||
|
||||
getMailboxServerAddr(): string;
|
||||
setMailboxServerAddr(value: string): void;
|
||||
|
||||
getDevServer(): boolean;
|
||||
setDevServer(value: boolean): void;
|
||||
|
||||
clearMacaroonCustomPermissionsList(): void;
|
||||
getMacaroonCustomPermissionsList(): Array<MacaroonPermission>;
|
||||
setMacaroonCustomPermissionsList(value: Array<MacaroonPermission>): void;
|
||||
addMacaroonCustomPermissions(value?: MacaroonPermission, index?: number): MacaroonPermission;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): AddSessionRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: AddSessionRequest): AddSessionRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: AddSessionRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): AddSessionRequest;
|
||||
static deserializeBinaryFromReader(message: AddSessionRequest, reader: jspb.BinaryReader): AddSessionRequest;
|
||||
}
|
||||
|
||||
export namespace AddSessionRequest {
|
||||
export type AsObject = {
|
||||
label: string,
|
||||
sessionType: SessionTypeMap[keyof SessionTypeMap],
|
||||
expiryTimestampSeconds: string,
|
||||
mailboxServerAddr: string,
|
||||
devServer: boolean,
|
||||
macaroonCustomPermissionsList: Array<MacaroonPermission.AsObject>,
|
||||
}
|
||||
}
|
||||
|
||||
export class MacaroonPermission extends jspb.Message {
|
||||
getEntity(): string;
|
||||
setEntity(value: string): void;
|
||||
|
||||
getAction(): string;
|
||||
setAction(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): MacaroonPermission.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: MacaroonPermission): MacaroonPermission.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: MacaroonPermission, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): MacaroonPermission;
|
||||
static deserializeBinaryFromReader(message: MacaroonPermission, reader: jspb.BinaryReader): MacaroonPermission;
|
||||
}
|
||||
|
||||
export namespace MacaroonPermission {
|
||||
export type AsObject = {
|
||||
entity: string,
|
||||
action: string,
|
||||
}
|
||||
}
|
||||
|
||||
export class AddSessionResponse extends jspb.Message {
|
||||
hasSession(): boolean;
|
||||
clearSession(): void;
|
||||
getSession(): Session | undefined;
|
||||
setSession(value?: Session): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): AddSessionResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: AddSessionResponse): AddSessionResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: AddSessionResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): AddSessionResponse;
|
||||
static deserializeBinaryFromReader(message: AddSessionResponse, reader: jspb.BinaryReader): AddSessionResponse;
|
||||
}
|
||||
|
||||
export namespace AddSessionResponse {
|
||||
export type AsObject = {
|
||||
session?: Session.AsObject,
|
||||
}
|
||||
}
|
||||
|
||||
export class Session extends jspb.Message {
|
||||
getLabel(): string;
|
||||
setLabel(value: string): void;
|
||||
|
||||
getSessionState(): SessionStateMap[keyof SessionStateMap];
|
||||
setSessionState(value: SessionStateMap[keyof SessionStateMap]): void;
|
||||
|
||||
getSessionType(): SessionTypeMap[keyof SessionTypeMap];
|
||||
setSessionType(value: SessionTypeMap[keyof SessionTypeMap]): void;
|
||||
|
||||
getExpiryTimestampSeconds(): string;
|
||||
setExpiryTimestampSeconds(value: string): void;
|
||||
|
||||
getMailboxServerAddr(): string;
|
||||
setMailboxServerAddr(value: string): void;
|
||||
|
||||
getDevServer(): boolean;
|
||||
setDevServer(value: boolean): void;
|
||||
|
||||
getPairingSecret(): Uint8Array | string;
|
||||
getPairingSecret_asU8(): Uint8Array;
|
||||
getPairingSecret_asB64(): string;
|
||||
setPairingSecret(value: Uint8Array | string): void;
|
||||
|
||||
getPairingSecretMnemonic(): string;
|
||||
setPairingSecretMnemonic(value: string): void;
|
||||
|
||||
getLocalPublicKey(): Uint8Array | string;
|
||||
getLocalPublicKey_asU8(): Uint8Array;
|
||||
getLocalPublicKey_asB64(): string;
|
||||
setLocalPublicKey(value: Uint8Array | string): void;
|
||||
|
||||
getRemotePublicKey(): Uint8Array | string;
|
||||
getRemotePublicKey_asU8(): Uint8Array;
|
||||
getRemotePublicKey_asB64(): string;
|
||||
setRemotePublicKey(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): Session.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: Session): Session.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: Session, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): Session;
|
||||
static deserializeBinaryFromReader(message: Session, reader: jspb.BinaryReader): Session;
|
||||
}
|
||||
|
||||
export namespace Session {
|
||||
export type AsObject = {
|
||||
label: string,
|
||||
sessionState: SessionStateMap[keyof SessionStateMap],
|
||||
sessionType: SessionTypeMap[keyof SessionTypeMap],
|
||||
expiryTimestampSeconds: string,
|
||||
mailboxServerAddr: string,
|
||||
devServer: boolean,
|
||||
pairingSecret: Uint8Array | string,
|
||||
pairingSecretMnemonic: string,
|
||||
localPublicKey: Uint8Array | string,
|
||||
remotePublicKey: Uint8Array | string,
|
||||
}
|
||||
}
|
||||
|
||||
export class ListSessionsRequest extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ListSessionsRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ListSessionsRequest): ListSessionsRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ListSessionsRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ListSessionsRequest;
|
||||
static deserializeBinaryFromReader(message: ListSessionsRequest, reader: jspb.BinaryReader): ListSessionsRequest;
|
||||
}
|
||||
|
||||
export namespace ListSessionsRequest {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export class ListSessionsResponse extends jspb.Message {
|
||||
clearSessionsList(): void;
|
||||
getSessionsList(): Array<Session>;
|
||||
setSessionsList(value: Array<Session>): void;
|
||||
addSessions(value?: Session, index?: number): Session;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ListSessionsResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ListSessionsResponse): ListSessionsResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ListSessionsResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ListSessionsResponse;
|
||||
static deserializeBinaryFromReader(message: ListSessionsResponse, reader: jspb.BinaryReader): ListSessionsResponse;
|
||||
}
|
||||
|
||||
export namespace ListSessionsResponse {
|
||||
export type AsObject = {
|
||||
sessionsList: Array<Session.AsObject>,
|
||||
}
|
||||
}
|
||||
|
||||
export class RevokeSessionRequest extends jspb.Message {
|
||||
getLocalPublicKey(): Uint8Array | string;
|
||||
getLocalPublicKey_asU8(): Uint8Array;
|
||||
getLocalPublicKey_asB64(): string;
|
||||
setLocalPublicKey(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): RevokeSessionRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: RevokeSessionRequest): RevokeSessionRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: RevokeSessionRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): RevokeSessionRequest;
|
||||
static deserializeBinaryFromReader(message: RevokeSessionRequest, reader: jspb.BinaryReader): RevokeSessionRequest;
|
||||
}
|
||||
|
||||
export namespace RevokeSessionRequest {
|
||||
export type AsObject = {
|
||||
localPublicKey: Uint8Array | string,
|
||||
}
|
||||
}
|
||||
|
||||
export class RevokeSessionResponse extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): RevokeSessionResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: RevokeSessionResponse): RevokeSessionResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: RevokeSessionResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): RevokeSessionResponse;
|
||||
static deserializeBinaryFromReader(message: RevokeSessionResponse, reader: jspb.BinaryReader): RevokeSessionResponse;
|
||||
}
|
||||
|
||||
export namespace RevokeSessionResponse {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface SessionTypeMap {
|
||||
TYPE_MACAROON_READONLY: 0;
|
||||
TYPE_MACAROON_ADMIN: 1;
|
||||
TYPE_MACAROON_CUSTOM: 2;
|
||||
TYPE_UI_PASSWORD: 3;
|
||||
}
|
||||
|
||||
export const SessionType: SessionTypeMap;
|
||||
|
||||
export interface SessionStateMap {
|
||||
STATE_CREATED: 0;
|
||||
STATE_IN_USE: 1;
|
||||
STATE_REVOKED: 2;
|
||||
STATE_EXPIRED: 3;
|
||||
}
|
||||
|
||||
export const SessionState: SessionStateMap;
|
||||
|
||||
1705
app/src/types/generated/lit-sessions_pb.js
generated
Normal file
1705
app/src/types/generated/lit-sessions_pb.js
generated
Normal file
File diff suppressed because it is too large
Load diff
101
app/src/types/generated/lit-sessions_pb_service.d.ts
generated
vendored
Normal file
101
app/src/types/generated/lit-sessions_pb_service.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// package: litrpc
|
||||
// file: lit-sessions.proto
|
||||
|
||||
import * as lit_sessions_pb from "./lit-sessions_pb";
|
||||
import {grpc} from "@improbable-eng/grpc-web";
|
||||
|
||||
type SessionsAddSession = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof Sessions;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof lit_sessions_pb.AddSessionRequest;
|
||||
readonly responseType: typeof lit_sessions_pb.AddSessionResponse;
|
||||
};
|
||||
|
||||
type SessionsListSessions = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof Sessions;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof lit_sessions_pb.ListSessionsRequest;
|
||||
readonly responseType: typeof lit_sessions_pb.ListSessionsResponse;
|
||||
};
|
||||
|
||||
type SessionsRevokeSession = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof Sessions;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof lit_sessions_pb.RevokeSessionRequest;
|
||||
readonly responseType: typeof lit_sessions_pb.RevokeSessionResponse;
|
||||
};
|
||||
|
||||
export class Sessions {
|
||||
static readonly serviceName: string;
|
||||
static readonly AddSession: SessionsAddSession;
|
||||
static readonly ListSessions: SessionsListSessions;
|
||||
static readonly RevokeSession: SessionsRevokeSession;
|
||||
}
|
||||
|
||||
export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
|
||||
export type Status = { details: string, code: number; metadata: grpc.Metadata }
|
||||
|
||||
interface UnaryResponse {
|
||||
cancel(): void;
|
||||
}
|
||||
interface ResponseStream<T> {
|
||||
cancel(): void;
|
||||
on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
|
||||
on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
|
||||
on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
|
||||
}
|
||||
interface RequestStream<T> {
|
||||
write(message: T): RequestStream<T>;
|
||||
end(): void;
|
||||
cancel(): void;
|
||||
on(type: 'end', handler: (status?: Status) => void): RequestStream<T>;
|
||||
on(type: 'status', handler: (status: Status) => void): RequestStream<T>;
|
||||
}
|
||||
interface BidirectionalStream<ReqT, ResT> {
|
||||
write(message: ReqT): BidirectionalStream<ReqT, ResT>;
|
||||
end(): void;
|
||||
cancel(): void;
|
||||
on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
|
||||
on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
|
||||
on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
|
||||
}
|
||||
|
||||
export class SessionsClient {
|
||||
readonly serviceHost: string;
|
||||
|
||||
constructor(serviceHost: string, options?: grpc.RpcOptions);
|
||||
addSession(
|
||||
requestMessage: lit_sessions_pb.AddSessionRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.AddSessionResponse|null) => void
|
||||
): UnaryResponse;
|
||||
addSession(
|
||||
requestMessage: lit_sessions_pb.AddSessionRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.AddSessionResponse|null) => void
|
||||
): UnaryResponse;
|
||||
listSessions(
|
||||
requestMessage: lit_sessions_pb.ListSessionsRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.ListSessionsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
listSessions(
|
||||
requestMessage: lit_sessions_pb.ListSessionsRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.ListSessionsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
revokeSession(
|
||||
requestMessage: lit_sessions_pb.RevokeSessionRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.RevokeSessionResponse|null) => void
|
||||
): UnaryResponse;
|
||||
revokeSession(
|
||||
requestMessage: lit_sessions_pb.RevokeSessionRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: lit_sessions_pb.RevokeSessionResponse|null) => void
|
||||
): UnaryResponse;
|
||||
}
|
||||
|
||||
141
app/src/types/generated/lit-sessions_pb_service.js
generated
Normal file
141
app/src/types/generated/lit-sessions_pb_service.js
generated
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// package: litrpc
|
||||
// file: lit-sessions.proto
|
||||
|
||||
var lit_sessions_pb = require("./lit-sessions_pb");
|
||||
var grpc = require("@improbable-eng/grpc-web").grpc;
|
||||
|
||||
var Sessions = (function () {
|
||||
function Sessions() {}
|
||||
Sessions.serviceName = "litrpc.Sessions";
|
||||
return Sessions;
|
||||
}());
|
||||
|
||||
Sessions.AddSession = {
|
||||
methodName: "AddSession",
|
||||
service: Sessions,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: lit_sessions_pb.AddSessionRequest,
|
||||
responseType: lit_sessions_pb.AddSessionResponse
|
||||
};
|
||||
|
||||
Sessions.ListSessions = {
|
||||
methodName: "ListSessions",
|
||||
service: Sessions,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: lit_sessions_pb.ListSessionsRequest,
|
||||
responseType: lit_sessions_pb.ListSessionsResponse
|
||||
};
|
||||
|
||||
Sessions.RevokeSession = {
|
||||
methodName: "RevokeSession",
|
||||
service: Sessions,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: lit_sessions_pb.RevokeSessionRequest,
|
||||
responseType: lit_sessions_pb.RevokeSessionResponse
|
||||
};
|
||||
|
||||
exports.Sessions = Sessions;
|
||||
|
||||
function SessionsClient(serviceHost, options) {
|
||||
this.serviceHost = serviceHost;
|
||||
this.options = options || {};
|
||||
}
|
||||
|
||||
SessionsClient.prototype.addSession = function addSession(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(Sessions.AddSession, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SessionsClient.prototype.listSessions = function listSessions(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(Sessions.ListSessions, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SessionsClient.prototype.revokeSession = function revokeSession(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(Sessions.RevokeSession, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.SessionsClient = SessionsClient;
|
||||
|
||||
7
litrpc/.clang-format
Normal file
7
litrpc/.clang-format
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
Language: Proto
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
SpaceBeforeParens: Always
|
||||
CompactNamespaces: false
|
||||
25
litrpc/Dockerfile
Normal file
25
litrpc/Dockerfile
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
FROM golang:1.16.3-buster
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
protobuf-compiler='3.6*' \
|
||||
clang-format='1:7.0*'
|
||||
|
||||
# We don't want any default values for these variables to make sure they're
|
||||
# explicitly provided by parsing the go.mod file. Otherwise we might forget to
|
||||
# update them here if we bump the versions.
|
||||
ARG PROTOBUF_VERSION
|
||||
ARG GRPC_GATEWAY_VERSION
|
||||
|
||||
ENV PROTOC_GEN_GO_GRPC_VERSION="v1.1.0"
|
||||
|
||||
RUN cd /tmp \
|
||||
&& export GO111MODULE=on \
|
||||
&& go get google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \
|
||||
&& go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} \
|
||||
&& go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \
|
||||
&& go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${GRPC_GATEWAY_VERSION}
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
CMD ["/bin/bash", "/build/litrpc/gen_protos.sh"]
|
||||
25
litrpc/gen_protos.sh
Executable file
25
litrpc/gen_protos.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# generate compiles the *.pb.go stubs from the *.proto files.
|
||||
function generate() {
|
||||
# Generate the gRPC bindings for all proto files.
|
||||
for file in ./*.proto; do
|
||||
protoc -I/usr/local/include -I. -I.. \
|
||||
--go_out . --go_opt paths=source_relative \
|
||||
--go-grpc_out . --go-grpc_opt paths=source_relative \
|
||||
"${file}"
|
||||
done
|
||||
}
|
||||
|
||||
# format formats the *.proto files with the clang-format utility.
|
||||
function format() {
|
||||
find . -name "*.proto" -print0 | xargs -0 clang-format --style=file -i
|
||||
}
|
||||
|
||||
# Compile and format the litrpc package.
|
||||
pushd litrpc
|
||||
format
|
||||
generate
|
||||
popd
|
||||
23
litrpc/gen_protos_docker.sh
Executable file
23
litrpc/gen_protos_docker.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Directory of the script file, independent of where it's called from.
|
||||
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
||||
|
||||
PROTOBUF_VERSION=$(go list -f '{{.Version}}' -m google.golang.org/protobuf)
|
||||
GRPC_GATEWAY_VERSION=$(go list -f '{{.Version}}' -m github.com/grpc-ecosystem/grpc-gateway/v2)
|
||||
|
||||
echo "Building protobuf compiler docker image..."
|
||||
docker build -t lit-protobuf-builder \
|
||||
--build-arg PROTOBUF_VERSION="$PROTOBUF_VERSION" \
|
||||
--build-arg GRPC_GATEWAY_VERSION="$GRPC_GATEWAY_VERSION" \
|
||||
.
|
||||
|
||||
echo "Compiling and formatting *.proto files..."
|
||||
docker run \
|
||||
--rm \
|
||||
--user $UID:$UID \
|
||||
-e UID=$UID \
|
||||
-v "$DIR/../:/build" \
|
||||
lit-protobuf-builder
|
||||
884
litrpc/lit-sessions.pb.go
Normal file
884
litrpc/lit-sessions.pb.go
Normal file
|
|
@ -0,0 +1,884 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.6.1
|
||||
// source: lit-sessions.proto
|
||||
|
||||
package litrpc
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type SessionType int32
|
||||
|
||||
const (
|
||||
SessionType_TYPE_MACAROON_READONLY SessionType = 0
|
||||
SessionType_TYPE_MACAROON_ADMIN SessionType = 1
|
||||
SessionType_TYPE_MACAROON_CUSTOM SessionType = 2
|
||||
SessionType_TYPE_UI_PASSWORD SessionType = 3
|
||||
)
|
||||
|
||||
// Enum value maps for SessionType.
|
||||
var (
|
||||
SessionType_name = map[int32]string{
|
||||
0: "TYPE_MACAROON_READONLY",
|
||||
1: "TYPE_MACAROON_ADMIN",
|
||||
2: "TYPE_MACAROON_CUSTOM",
|
||||
3: "TYPE_UI_PASSWORD",
|
||||
}
|
||||
SessionType_value = map[string]int32{
|
||||
"TYPE_MACAROON_READONLY": 0,
|
||||
"TYPE_MACAROON_ADMIN": 1,
|
||||
"TYPE_MACAROON_CUSTOM": 2,
|
||||
"TYPE_UI_PASSWORD": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x SessionType) Enum() *SessionType {
|
||||
p := new(SessionType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x SessionType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (SessionType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_lit_sessions_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (SessionType) Type() protoreflect.EnumType {
|
||||
return &file_lit_sessions_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x SessionType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SessionType.Descriptor instead.
|
||||
func (SessionType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type SessionState int32
|
||||
|
||||
const (
|
||||
SessionState_STATE_CREATED SessionState = 0
|
||||
SessionState_STATE_IN_USE SessionState = 1
|
||||
SessionState_STATE_REVOKED SessionState = 2
|
||||
SessionState_STATE_EXPIRED SessionState = 3
|
||||
)
|
||||
|
||||
// Enum value maps for SessionState.
|
||||
var (
|
||||
SessionState_name = map[int32]string{
|
||||
0: "STATE_CREATED",
|
||||
1: "STATE_IN_USE",
|
||||
2: "STATE_REVOKED",
|
||||
3: "STATE_EXPIRED",
|
||||
}
|
||||
SessionState_value = map[string]int32{
|
||||
"STATE_CREATED": 0,
|
||||
"STATE_IN_USE": 1,
|
||||
"STATE_REVOKED": 2,
|
||||
"STATE_EXPIRED": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x SessionState) Enum() *SessionState {
|
||||
p := new(SessionState)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x SessionState) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (SessionState) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_lit_sessions_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (SessionState) Type() protoreflect.EnumType {
|
||||
return &file_lit_sessions_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x SessionState) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SessionState.Descriptor instead.
|
||||
func (SessionState) EnumDescriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type AddSessionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
|
||||
SessionType SessionType `protobuf:"varint,2,opt,name=session_type,json=sessionType,proto3,enum=litrpc.SessionType" json:"session_type,omitempty"`
|
||||
ExpiryTimestampSeconds uint64 `protobuf:"varint,3,opt,name=expiry_timestamp_seconds,json=expiryTimestampSeconds,proto3" json:"expiry_timestamp_seconds,omitempty"`
|
||||
MailboxServerAddr string `protobuf:"bytes,4,opt,name=mailbox_server_addr,json=mailboxServerAddr,proto3" json:"mailbox_server_addr,omitempty"`
|
||||
DevServer bool `protobuf:"varint,5,opt,name=dev_server,json=devServer,proto3" json:"dev_server,omitempty"`
|
||||
MacaroonCustomPermissions []*MacaroonPermission `protobuf:"bytes,6,rep,name=macaroon_custom_permissions,json=macaroonCustomPermissions,proto3" json:"macaroon_custom_permissions,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) Reset() {
|
||||
*x = AddSessionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddSessionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AddSessionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddSessionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AddSessionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetLabel() string {
|
||||
if x != nil {
|
||||
return x.Label
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetSessionType() SessionType {
|
||||
if x != nil {
|
||||
return x.SessionType
|
||||
}
|
||||
return SessionType_TYPE_MACAROON_READONLY
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetExpiryTimestampSeconds() uint64 {
|
||||
if x != nil {
|
||||
return x.ExpiryTimestampSeconds
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetMailboxServerAddr() string {
|
||||
if x != nil {
|
||||
return x.MailboxServerAddr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetDevServer() bool {
|
||||
if x != nil {
|
||||
return x.DevServer
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AddSessionRequest) GetMacaroonCustomPermissions() []*MacaroonPermission {
|
||||
if x != nil {
|
||||
return x.MacaroonCustomPermissions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MacaroonPermission struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The entity a permission grants access to.
|
||||
Entity string `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
|
||||
// The action that is granted.
|
||||
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MacaroonPermission) Reset() {
|
||||
*x = MacaroonPermission{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MacaroonPermission) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MacaroonPermission) ProtoMessage() {}
|
||||
|
||||
func (x *MacaroonPermission) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MacaroonPermission.ProtoReflect.Descriptor instead.
|
||||
func (*MacaroonPermission) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *MacaroonPermission) GetEntity() string {
|
||||
if x != nil {
|
||||
return x.Entity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MacaroonPermission) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AddSessionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AddSessionResponse) Reset() {
|
||||
*x = AddSessionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AddSessionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddSessionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AddSessionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddSessionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AddSessionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *AddSessionResponse) GetSession() *Session {
|
||||
if x != nil {
|
||||
return x.Session
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
|
||||
SessionState SessionState `protobuf:"varint,2,opt,name=session_state,json=sessionState,proto3,enum=litrpc.SessionState" json:"session_state,omitempty"`
|
||||
SessionType SessionType `protobuf:"varint,3,opt,name=session_type,json=sessionType,proto3,enum=litrpc.SessionType" json:"session_type,omitempty"`
|
||||
ExpiryTimestampSeconds uint64 `protobuf:"varint,4,opt,name=expiry_timestamp_seconds,json=expiryTimestampSeconds,proto3" json:"expiry_timestamp_seconds,omitempty"`
|
||||
MailboxServerAddr string `protobuf:"bytes,5,opt,name=mailbox_server_addr,json=mailboxServerAddr,proto3" json:"mailbox_server_addr,omitempty"`
|
||||
DevServer bool `protobuf:"varint,6,opt,name=dev_server,json=devServer,proto3" json:"dev_server,omitempty"`
|
||||
PairingSecret []byte `protobuf:"bytes,7,opt,name=pairing_secret,json=pairingSecret,proto3" json:"pairing_secret,omitempty"`
|
||||
PairingSecretMnemonic string `protobuf:"bytes,8,opt,name=pairing_secret_mnemonic,json=pairingSecretMnemonic,proto3" json:"pairing_secret_mnemonic,omitempty"`
|
||||
LocalPublicKey []byte `protobuf:"bytes,9,opt,name=local_public_key,json=localPublicKey,proto3" json:"local_public_key,omitempty"`
|
||||
RemotePublicKey []byte `protobuf:"bytes,10,opt,name=remote_public_key,json=remotePublicKey,proto3" json:"remote_public_key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Session) Reset() {
|
||||
*x = Session{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Session) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Session) ProtoMessage() {}
|
||||
|
||||
func (x *Session) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Session.ProtoReflect.Descriptor instead.
|
||||
func (*Session) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *Session) GetLabel() string {
|
||||
if x != nil {
|
||||
return x.Label
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Session) GetSessionState() SessionState {
|
||||
if x != nil {
|
||||
return x.SessionState
|
||||
}
|
||||
return SessionState_STATE_CREATED
|
||||
}
|
||||
|
||||
func (x *Session) GetSessionType() SessionType {
|
||||
if x != nil {
|
||||
return x.SessionType
|
||||
}
|
||||
return SessionType_TYPE_MACAROON_READONLY
|
||||
}
|
||||
|
||||
func (x *Session) GetExpiryTimestampSeconds() uint64 {
|
||||
if x != nil {
|
||||
return x.ExpiryTimestampSeconds
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Session) GetMailboxServerAddr() string {
|
||||
if x != nil {
|
||||
return x.MailboxServerAddr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Session) GetDevServer() bool {
|
||||
if x != nil {
|
||||
return x.DevServer
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Session) GetPairingSecret() []byte {
|
||||
if x != nil {
|
||||
return x.PairingSecret
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Session) GetPairingSecretMnemonic() string {
|
||||
if x != nil {
|
||||
return x.PairingSecretMnemonic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Session) GetLocalPublicKey() []byte {
|
||||
if x != nil {
|
||||
return x.LocalPublicKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Session) GetRemotePublicKey() []byte {
|
||||
if x != nil {
|
||||
return x.RemotePublicKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListSessionsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ListSessionsRequest) Reset() {
|
||||
*x = ListSessionsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListSessionsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListSessionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListSessionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListSessionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListSessionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type ListSessionsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sessions []*Session `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListSessionsResponse) Reset() {
|
||||
*x = ListSessionsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListSessionsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListSessionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListSessionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListSessionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListSessionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *ListSessionsResponse) GetSessions() []*Session {
|
||||
if x != nil {
|
||||
return x.Sessions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RevokeSessionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
LocalPublicKey []byte `protobuf:"bytes,8,opt,name=local_public_key,json=localPublicKey,proto3" json:"local_public_key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RevokeSessionRequest) Reset() {
|
||||
*x = RevokeSessionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RevokeSessionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RevokeSessionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RevokeSessionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RevokeSessionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RevokeSessionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *RevokeSessionRequest) GetLocalPublicKey() []byte {
|
||||
if x != nil {
|
||||
return x.LocalPublicKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RevokeSessionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *RevokeSessionResponse) Reset() {
|
||||
*x = RevokeSessionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_lit_sessions_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RevokeSessionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RevokeSessionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RevokeSessionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_lit_sessions_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RevokeSessionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RevokeSessionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_lit_sessions_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
var File_lit_sessions_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_lit_sessions_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x6c, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x22, 0xca, 0x02, 0x0a,
|
||||
0x11, 0x41, 0x64, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x0c, 0x73, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13,
|
||||
0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54,
|
||||
0x79, 0x70, 0x65, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65,
|
||||
0x12, 0x3c, 0x0a, 0x18, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73,
|
||||
0x74, 0x61, 0x6d, 0x70, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x04, 0x42, 0x02, 0x30, 0x01, 0x52, 0x16, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2e,
|
||||
0x0a, 0x13, 0x6d, 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x69,
|
||||
0x6c, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d,
|
||||
0x0a, 0x0a, 0x64, 0x65, 0x76, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x09, 0x64, 0x65, 0x76, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x5a, 0x0a,
|
||||
0x1b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
|
||||
0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x61, 0x63, 0x61,
|
||||
0x72, 0x6f, 0x6f, 0x6e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x19,
|
||||
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x65,
|
||||
0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x44, 0x0a, 0x12, 0x4d, 0x61, 0x63,
|
||||
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
|
||||
0x3f, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x22, 0xd4, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62,
|
||||
0x65, 0x6c, 0x12, 0x39, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6c, 0x69, 0x74, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
|
||||
0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x36, 0x0a,
|
||||
0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x3c, 0x0a, 0x18, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64,
|
||||
0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x02, 0x30, 0x01, 0x52, 0x16, 0x65, 0x78, 0x70,
|
||||
0x69, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x53, 0x65, 0x63, 0x6f,
|
||||
0x6e, 0x64, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x11, 0x6d, 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41,
|
||||
0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x64, 0x65, 0x76, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65,
|
||||
0x63, 0x72, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x69, 0x72,
|
||||
0x69, 0x6e, 0x67, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x36, 0x0a, 0x17, 0x70, 0x61, 0x69,
|
||||
0x72, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6d, 0x6e, 0x65, 0x6d,
|
||||
0x6f, 0x6e, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x70, 0x61, 0x69, 0x72,
|
||||
0x69, 0x6e, 0x67, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4d, 0x6e, 0x65, 0x6d, 0x6f, 0x6e, 0x69,
|
||||
0x63, 0x12, 0x28, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x72,
|
||||
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79,
|
||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x43,
|
||||
0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x22, 0x40, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x6c,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x72,
|
||||
0x0a, 0x0b, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x16, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x41, 0x52, 0x4f, 0x4f, 0x4e, 0x5f, 0x52,
|
||||
0x45, 0x41, 0x44, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x59, 0x50,
|
||||
0x45, 0x5f, 0x4d, 0x41, 0x43, 0x41, 0x52, 0x4f, 0x4f, 0x4e, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e,
|
||||
0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x41, 0x52,
|
||||
0x4f, 0x4f, 0x4e, 0x5f, 0x43, 0x55, 0x53, 0x54, 0x4f, 0x4d, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10,
|
||||
0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x57, 0x4f, 0x52, 0x44,
|
||||
0x10, 0x03, 0x2a, 0x59, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x43, 0x52, 0x45, 0x41,
|
||||
0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x49,
|
||||
0x4e, 0x5f, 0x55, 0x53, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45,
|
||||
0x5f, 0x52, 0x45, 0x56, 0x4f, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54,
|
||||
0x41, 0x54, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x32, 0xe8, 0x01,
|
||||
0x0a, 0x08, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x41, 0x64,
|
||||
0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x49, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12,
|
||||
0x1b, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c,
|
||||
0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65,
|
||||
0x76, 0x6f, 0x6b, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x6c, 0x69,
|
||||
0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67,
|
||||
0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2d, 0x74,
|
||||
0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_lit_sessions_proto_rawDescOnce sync.Once
|
||||
file_lit_sessions_proto_rawDescData = file_lit_sessions_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_lit_sessions_proto_rawDescGZIP() []byte {
|
||||
file_lit_sessions_proto_rawDescOnce.Do(func() {
|
||||
file_lit_sessions_proto_rawDescData = protoimpl.X.CompressGZIP(file_lit_sessions_proto_rawDescData)
|
||||
})
|
||||
return file_lit_sessions_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_lit_sessions_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_lit_sessions_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_lit_sessions_proto_goTypes = []interface{}{
|
||||
(SessionType)(0), // 0: litrpc.SessionType
|
||||
(SessionState)(0), // 1: litrpc.SessionState
|
||||
(*AddSessionRequest)(nil), // 2: litrpc.AddSessionRequest
|
||||
(*MacaroonPermission)(nil), // 3: litrpc.MacaroonPermission
|
||||
(*AddSessionResponse)(nil), // 4: litrpc.AddSessionResponse
|
||||
(*Session)(nil), // 5: litrpc.Session
|
||||
(*ListSessionsRequest)(nil), // 6: litrpc.ListSessionsRequest
|
||||
(*ListSessionsResponse)(nil), // 7: litrpc.ListSessionsResponse
|
||||
(*RevokeSessionRequest)(nil), // 8: litrpc.RevokeSessionRequest
|
||||
(*RevokeSessionResponse)(nil), // 9: litrpc.RevokeSessionResponse
|
||||
}
|
||||
var file_lit_sessions_proto_depIdxs = []int32{
|
||||
0, // 0: litrpc.AddSessionRequest.session_type:type_name -> litrpc.SessionType
|
||||
3, // 1: litrpc.AddSessionRequest.macaroon_custom_permissions:type_name -> litrpc.MacaroonPermission
|
||||
5, // 2: litrpc.AddSessionResponse.session:type_name -> litrpc.Session
|
||||
1, // 3: litrpc.Session.session_state:type_name -> litrpc.SessionState
|
||||
0, // 4: litrpc.Session.session_type:type_name -> litrpc.SessionType
|
||||
5, // 5: litrpc.ListSessionsResponse.sessions:type_name -> litrpc.Session
|
||||
2, // 6: litrpc.Sessions.AddSession:input_type -> litrpc.AddSessionRequest
|
||||
6, // 7: litrpc.Sessions.ListSessions:input_type -> litrpc.ListSessionsRequest
|
||||
8, // 8: litrpc.Sessions.RevokeSession:input_type -> litrpc.RevokeSessionRequest
|
||||
4, // 9: litrpc.Sessions.AddSession:output_type -> litrpc.AddSessionResponse
|
||||
7, // 10: litrpc.Sessions.ListSessions:output_type -> litrpc.ListSessionsResponse
|
||||
9, // 11: litrpc.Sessions.RevokeSession:output_type -> litrpc.RevokeSessionResponse
|
||||
9, // [9:12] is the sub-list for method output_type
|
||||
6, // [6:9] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_lit_sessions_proto_init() }
|
||||
func file_lit_sessions_proto_init() {
|
||||
if File_lit_sessions_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_lit_sessions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AddSessionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MacaroonPermission); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AddSessionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Session); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListSessionsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListSessionsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RevokeSessionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_lit_sessions_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RevokeSessionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_lit_sessions_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_lit_sessions_proto_goTypes,
|
||||
DependencyIndexes: file_lit_sessions_proto_depIdxs,
|
||||
EnumInfos: file_lit_sessions_proto_enumTypes,
|
||||
MessageInfos: file_lit_sessions_proto_msgTypes,
|
||||
}.Build()
|
||||
File_lit_sessions_proto = out.File
|
||||
file_lit_sessions_proto_rawDesc = nil
|
||||
file_lit_sessions_proto_goTypes = nil
|
||||
file_lit_sessions_proto_depIdxs = nil
|
||||
}
|
||||
91
litrpc/lit-sessions.proto
Normal file
91
litrpc/lit-sessions.proto
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package litrpc;
|
||||
|
||||
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 {
|
||||
rpc AddSession (AddSessionRequest) returns (AddSessionResponse);
|
||||
|
||||
rpc ListSessions (ListSessionsRequest) returns (ListSessionsResponse);
|
||||
|
||||
rpc RevokeSession (RevokeSessionRequest) returns (RevokeSessionResponse);
|
||||
}
|
||||
|
||||
enum SessionType {
|
||||
TYPE_MACAROON_READONLY = 0;
|
||||
TYPE_MACAROON_ADMIN = 1;
|
||||
TYPE_MACAROON_CUSTOM = 2;
|
||||
TYPE_UI_PASSWORD = 3;
|
||||
}
|
||||
|
||||
message AddSessionRequest {
|
||||
string label = 1;
|
||||
|
||||
SessionType session_type = 2;
|
||||
|
||||
uint64 expiry_timestamp_seconds = 3 [jstype = JS_STRING];
|
||||
|
||||
string mailbox_server_addr = 4;
|
||||
|
||||
bool dev_server = 5;
|
||||
|
||||
repeated MacaroonPermission macaroon_custom_permissions = 6;
|
||||
}
|
||||
|
||||
message MacaroonPermission {
|
||||
// The entity a permission grants access to.
|
||||
string entity = 1;
|
||||
|
||||
// The action that is granted.
|
||||
string action = 2;
|
||||
}
|
||||
|
||||
enum SessionState {
|
||||
STATE_CREATED = 0;
|
||||
STATE_IN_USE = 1;
|
||||
STATE_REVOKED = 2;
|
||||
STATE_EXPIRED = 3;
|
||||
}
|
||||
|
||||
message AddSessionResponse {
|
||||
Session session = 1;
|
||||
}
|
||||
|
||||
message Session {
|
||||
string label = 1;
|
||||
|
||||
SessionState session_state = 2;
|
||||
|
||||
SessionType session_type = 3;
|
||||
|
||||
uint64 expiry_timestamp_seconds = 4 [jstype = JS_STRING];
|
||||
|
||||
string mailbox_server_addr = 5;
|
||||
|
||||
bool dev_server = 6;
|
||||
|
||||
bytes pairing_secret = 7;
|
||||
|
||||
string pairing_secret_mnemonic = 8;
|
||||
|
||||
bytes local_public_key = 9;
|
||||
|
||||
bytes remote_public_key = 10;
|
||||
}
|
||||
|
||||
message ListSessionsRequest {
|
||||
}
|
||||
|
||||
message ListSessionsResponse {
|
||||
repeated Session sessions = 1;
|
||||
}
|
||||
|
||||
message RevokeSessionRequest {
|
||||
bytes local_public_key = 8;
|
||||
}
|
||||
|
||||
message RevokeSessionResponse {
|
||||
}
|
||||
173
litrpc/lit-sessions_grpc.pb.go
Normal file
173
litrpc/lit-sessions_grpc.pb.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package litrpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// SessionsClient is the client API for Sessions service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type SessionsClient interface {
|
||||
AddSession(ctx context.Context, in *AddSessionRequest, opts ...grpc.CallOption) (*AddSessionResponse, error)
|
||||
ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
|
||||
RevokeSession(ctx context.Context, in *RevokeSessionRequest, opts ...grpc.CallOption) (*RevokeSessionResponse, error)
|
||||
}
|
||||
|
||||
type sessionsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSessionsClient(cc grpc.ClientConnInterface) SessionsClient {
|
||||
return &sessionsClient{cc}
|
||||
}
|
||||
|
||||
func (c *sessionsClient) AddSession(ctx context.Context, in *AddSessionRequest, opts ...grpc.CallOption) (*AddSessionResponse, error) {
|
||||
out := new(AddSessionResponse)
|
||||
err := c.cc.Invoke(ctx, "/litrpc.Sessions/AddSession", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sessionsClient) ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error) {
|
||||
out := new(ListSessionsResponse)
|
||||
err := c.cc.Invoke(ctx, "/litrpc.Sessions/ListSessions", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sessionsClient) RevokeSession(ctx context.Context, in *RevokeSessionRequest, opts ...grpc.CallOption) (*RevokeSessionResponse, error) {
|
||||
out := new(RevokeSessionResponse)
|
||||
err := c.cc.Invoke(ctx, "/litrpc.Sessions/RevokeSession", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SessionsServer is the server API for Sessions service.
|
||||
// All implementations must embed UnimplementedSessionsServer
|
||||
// for forward compatibility
|
||||
type SessionsServer interface {
|
||||
AddSession(context.Context, *AddSessionRequest) (*AddSessionResponse, error)
|
||||
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
|
||||
RevokeSession(context.Context, *RevokeSessionRequest) (*RevokeSessionResponse, error)
|
||||
mustEmbedUnimplementedSessionsServer()
|
||||
}
|
||||
|
||||
// UnimplementedSessionsServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedSessionsServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedSessionsServer) AddSession(context.Context, *AddSessionRequest) (*AddSessionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddSession not implemented")
|
||||
}
|
||||
func (UnimplementedSessionsServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListSessions not implemented")
|
||||
}
|
||||
func (UnimplementedSessionsServer) RevokeSession(context.Context, *RevokeSessionRequest) (*RevokeSessionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RevokeSession not implemented")
|
||||
}
|
||||
func (UnimplementedSessionsServer) mustEmbedUnimplementedSessionsServer() {}
|
||||
|
||||
// UnsafeSessionsServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to SessionsServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeSessionsServer interface {
|
||||
mustEmbedUnimplementedSessionsServer()
|
||||
}
|
||||
|
||||
func RegisterSessionsServer(s grpc.ServiceRegistrar, srv SessionsServer) {
|
||||
s.RegisterService(&Sessions_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Sessions_AddSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SessionsServer).AddSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/litrpc.Sessions/AddSession",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SessionsServer).AddSession(ctx, req.(*AddSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Sessions_ListSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListSessionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SessionsServer).ListSessions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/litrpc.Sessions/ListSessions",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SessionsServer).ListSessions(ctx, req.(*ListSessionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Sessions_RevokeSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RevokeSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SessionsServer).RevokeSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/litrpc.Sessions/RevokeSession",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SessionsServer).RevokeSession(ctx, req.(*RevokeSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Sessions_ServiceDesc is the grpc.ServiceDesc for Sessions service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Sessions_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "litrpc.Sessions",
|
||||
HandlerType: (*SessionsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "AddSession",
|
||||
Handler: _Sessions_AddSession_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListSessions",
|
||||
Handler: _Sessions_ListSessions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RevokeSession",
|
||||
Handler: _Sessions_RevokeSession_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "lit-sessions.proto",
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue