mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
litrpc: add macaroon_identifier to Action message
We add a new macaroon_identifier field to the Action proto message an populate it in the rpc server.
This commit is contained in:
parent
3e963c04b4
commit
f6e66db7ab
7 changed files with 115 additions and 24 deletions
6
app/src/types/generated/firewall_pb.d.ts
generated
vendored
6
app/src/types/generated/firewall_pb.d.ts
generated
vendored
|
|
@ -193,6 +193,11 @@ export class Action extends jspb.Message {
|
|||
getSessionId_asB64(): string;
|
||||
setSessionId(value: Uint8Array | string): void;
|
||||
|
||||
getMacaroonIdentifier(): Uint8Array | string;
|
||||
getMacaroonIdentifier_asU8(): Uint8Array;
|
||||
getMacaroonIdentifier_asB64(): string;
|
||||
setMacaroonIdentifier(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): Action.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: Action): Action.AsObject;
|
||||
|
|
@ -216,6 +221,7 @@ export namespace Action {
|
|||
state: ActionStateMap[keyof ActionStateMap],
|
||||
errorReason: string,
|
||||
sessionId: Uint8Array | string,
|
||||
macaroonIdentifier: Uint8Array | string,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
56
app/src/types/generated/firewall_pb.js
generated
56
app/src/types/generated/firewall_pb.js
generated
|
|
@ -1303,7 +1303,8 @@ proto.litrpc.Action.toObject = function(includeInstance, msg) {
|
|||
timestamp: jspb.Message.getFieldWithDefault(msg, 8, "0"),
|
||||
state: jspb.Message.getFieldWithDefault(msg, 9, 0),
|
||||
errorReason: jspb.Message.getFieldWithDefault(msg, 10, ""),
|
||||
sessionId: msg.getSessionId_asB64()
|
||||
sessionId: msg.getSessionId_asB64(),
|
||||
macaroonIdentifier: msg.getMacaroonIdentifier_asB64()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
|
|
@ -1384,6 +1385,10 @@ proto.litrpc.Action.deserializeBinaryFromReader = function(msg, reader) {
|
|||
var value = /** @type {!Uint8Array} */ (reader.readBytes());
|
||||
msg.setSessionId(value);
|
||||
break;
|
||||
case 12:
|
||||
var value = /** @type {!Uint8Array} */ (reader.readBytes());
|
||||
msg.setMacaroonIdentifier(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
|
|
@ -1490,6 +1495,13 @@ proto.litrpc.Action.serializeBinaryToWriter = function(message, writer) {
|
|||
f
|
||||
);
|
||||
}
|
||||
f = message.getMacaroonIdentifier_asU8();
|
||||
if (f.length > 0) {
|
||||
writer.writeBytes(
|
||||
12,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1715,6 +1727,48 @@ proto.litrpc.Action.prototype.setSessionId = function(value) {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional bytes macaroon_identifier = 12;
|
||||
* @return {!(string|Uint8Array)}
|
||||
*/
|
||||
proto.litrpc.Action.prototype.getMacaroonIdentifier = function() {
|
||||
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 12, ""));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional bytes macaroon_identifier = 12;
|
||||
* This is a type-conversion wrapper around `getMacaroonIdentifier()`
|
||||
* @return {string}
|
||||
*/
|
||||
proto.litrpc.Action.prototype.getMacaroonIdentifier_asB64 = function() {
|
||||
return /** @type {string} */ (jspb.Message.bytesAsB64(
|
||||
this.getMacaroonIdentifier()));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional bytes macaroon_identifier = 12;
|
||||
* Note that Uint8Array is not supported on all browsers.
|
||||
* @see http://caniuse.com/Uint8Array
|
||||
* This is a type-conversion wrapper around `getMacaroonIdentifier()`
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.litrpc.Action.prototype.getMacaroonIdentifier_asU8 = function() {
|
||||
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
|
||||
this.getMacaroonIdentifier()));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {!(string|Uint8Array)} value
|
||||
* @return {!proto.litrpc.Action} returns this
|
||||
*/
|
||||
proto.litrpc.Action.prototype.setMacaroonIdentifier = function(value) {
|
||||
return jspb.Message.setProto3BytesField(this, 12, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -464,6 +464,9 @@ type Action struct {
|
|||
ErrorReason string `protobuf:"bytes,10,opt,name=error_reason,json=errorReason,proto3" json:"error_reason,omitempty"`
|
||||
// The ID of the session under which the action was performed.
|
||||
SessionId []byte `protobuf:"bytes,11,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
|
||||
// The 4 byte identifier of the macaroon that was used to perform the action.
|
||||
// This is derived from the last 4 bytes of the macaroon's root key ID.
|
||||
MacaroonIdentifier []byte `protobuf:"bytes,12,opt,name=macaroon_identifier,json=macaroonIdentifier,proto3" json:"macaroon_identifier,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Action) Reset() {
|
||||
|
|
@ -575,6 +578,13 @@ func (x *Action) GetSessionId() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *Action) GetMacaroonIdentifier() []byte {
|
||||
if x != nil {
|
||||
return x.MacaroonIdentifier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_firewall_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_firewall_proto_rawDesc = []byte{
|
||||
|
|
@ -629,7 +639,7 @@ var file_firewall_proto_rawDesc = []byte{
|
|||
0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f,
|
||||
0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61,
|
||||
0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x84, 0x03, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb5, 0x03, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x21, 0x0a, 0x0c, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
|
||||
|
|
@ -653,28 +663,31 @@ var file_firewall_proto_rawDesc = []byte{
|
|||
0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x1d,
|
||||
0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x2a, 0x54, 0x0a,
|
||||
0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
|
||||
0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47,
|
||||
0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x4e, 0x45,
|
||||
0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f,
|
||||
0x52, 0x10, 0x03, 0x32, 0xb5, 0x01, 0x0a, 0x08, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c,
|
||||
0x12, 0x46, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
|
||||
0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69,
|
||||
0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76,
|
||||
0x61, 0x63, 0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x23, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63,
|
||||
0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x50,
|
||||
0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 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,
|
||||
0x28, 0x0c, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2f, 0x0a,
|
||||
0x13, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x66, 0x69, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x6d, 0x61, 0x63, 0x61,
|
||||
0x72, 0x6f, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2a, 0x54,
|
||||
0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00,
|
||||
0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e,
|
||||
0x47, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x4e,
|
||||
0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x52, 0x52,
|
||||
0x4f, 0x52, 0x10, 0x03, 0x32, 0xb5, 0x01, 0x0a, 0x08, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c,
|
||||
0x6c, 0x12, 0x46, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c,
|
||||
0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x14, 0x50, 0x72, 0x69,
|
||||
0x76, 0x61, 0x63, 0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61,
|
||||
0x63, 0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
|
||||
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 (
|
||||
|
|
|
|||
|
|
@ -209,6 +209,12 @@ message Action {
|
|||
The ID of the session under which the action was performed.
|
||||
*/
|
||||
bytes session_id = 11;
|
||||
|
||||
/*
|
||||
The 4 byte identifier of the macaroon that was used to perform the action.
|
||||
This is derived from the last 4 bytes of the macaroon's root key ID.
|
||||
*/
|
||||
bytes macaroon_identifier = 12;
|
||||
}
|
||||
|
||||
enum ActionState {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@
|
|||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The ID of the session under which the action was performed."
|
||||
},
|
||||
"macaroon_identifier": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The 4 byte identifier of the macaroon that was used to perform the action.\nThis is derived from the last 4 bytes of the macaroon's root key ID."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -209,6 +209,12 @@ message Action {
|
|||
The ID of the session under which the action was performed.
|
||||
*/
|
||||
bytes session_id = 11;
|
||||
|
||||
/*
|
||||
The 4 byte identifier of the macaroon that was used to perform the action.
|
||||
This is derived from the last 4 bytes of the macaroon's root key ID.
|
||||
*/
|
||||
bytes macaroon_identifier = 12;
|
||||
}
|
||||
|
||||
enum ActionState {
|
||||
|
|
|
|||
|
|
@ -738,6 +738,7 @@ func (s *sessionRpcServer) ListActions(ctx context.Context,
|
|||
|
||||
resp[i] = &litrpc.Action{
|
||||
SessionId: sessionID[:],
|
||||
MacaroonIdentifier: a.MacaroonIdentifier[:],
|
||||
ActorName: a.ActorName,
|
||||
FeatureName: a.FeatureName,
|
||||
Trigger: a.Trigger,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue