Implement end-to-end app payload encryption.

This implements end-to-end encryption between the end-device and
end-application. The encrypted AppSKey or SessionKeyID is forwarded to
the end-application which should be able to decrypt or request the
AppSKey to decrypt the uplink payload. As well the end-application will
be able to enqueue encrypted application payloads.

Using this mechanism, ChirpStack will never have access to the uplink
and downlink application-payloads.
This commit is contained in:
Orne Brocaar
2023-10-05 13:05:53 +01:00
parent 503beaa2fd
commit 41d00cb651
49 changed files with 4859 additions and 783 deletions

View File

@ -27,6 +27,7 @@ interface IDeviceServiceService extends grpc.ServiceDefinition<grpc.UntypedServi
enqueue: grpc.MethodDefinition<api_device_pb.EnqueueDeviceQueueItemRequest, api_device_pb.EnqueueDeviceQueueItemResponse>;
flushQueue: grpc.MethodDefinition<api_device_pb.FlushDeviceQueueRequest, google_protobuf_empty_pb.Empty>;
getQueue: grpc.MethodDefinition<api_device_pb.GetDeviceQueueItemsRequest, api_device_pb.GetDeviceQueueItemsResponse>;
getNextFCntDown: grpc.MethodDefinition<api_device_pb.GetDeviceNextFCntDownRequest, api_device_pb.GetDeviceNextFCntDownResponse>;
}
export const DeviceServiceService: IDeviceServiceService;
@ -51,6 +52,7 @@ export interface IDeviceServiceServer extends grpc.UntypedServiceImplementation
enqueue: grpc.handleUnaryCall<api_device_pb.EnqueueDeviceQueueItemRequest, api_device_pb.EnqueueDeviceQueueItemResponse>;
flushQueue: grpc.handleUnaryCall<api_device_pb.FlushDeviceQueueRequest, google_protobuf_empty_pb.Empty>;
getQueue: grpc.handleUnaryCall<api_device_pb.GetDeviceQueueItemsRequest, api_device_pb.GetDeviceQueueItemsResponse>;
getNextFCntDown: grpc.handleUnaryCall<api_device_pb.GetDeviceNextFCntDownRequest, api_device_pb.GetDeviceNextFCntDownResponse>;
}
export class DeviceServiceClient extends grpc.Client {
@ -112,4 +114,7 @@ export class DeviceServiceClient extends grpc.Client {
getQueue(argument: api_device_pb.GetDeviceQueueItemsRequest, callback: grpc.requestCallback<api_device_pb.GetDeviceQueueItemsResponse>): grpc.ClientUnaryCall;
getQueue(argument: api_device_pb.GetDeviceQueueItemsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceQueueItemsResponse>): grpc.ClientUnaryCall;
getQueue(argument: api_device_pb.GetDeviceQueueItemsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceQueueItemsResponse>): grpc.ClientUnaryCall;
getNextFCntDown(argument: api_device_pb.GetDeviceNextFCntDownRequest, callback: grpc.requestCallback<api_device_pb.GetDeviceNextFCntDownResponse>): grpc.ClientUnaryCall;
getNextFCntDown(argument: api_device_pb.GetDeviceNextFCntDownRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceNextFCntDownResponse>): grpc.ClientUnaryCall;
getNextFCntDown(argument: api_device_pb.GetDeviceNextFCntDownRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceNextFCntDownResponse>): grpc.ClientUnaryCall;
}

View File

@ -207,6 +207,28 @@ function deserialize_api_GetDeviceMetricsResponse(buffer_arg) {
return api_device_pb.GetDeviceMetricsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceNextFCntDownRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceNextFCntDownRequest)) {
throw new Error('Expected argument of type api.GetDeviceNextFCntDownRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceNextFCntDownRequest(buffer_arg) {
return api_device_pb.GetDeviceNextFCntDownRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceNextFCntDownResponse(arg) {
if (!(arg instanceof api_device_pb.GetDeviceNextFCntDownResponse)) {
throw new Error('Expected argument of type api.GetDeviceNextFCntDownResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceNextFCntDownResponse(buffer_arg) {
return api_device_pb.GetDeviceNextFCntDownResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceQueueItemsRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceQueueItemsRequest)) {
throw new Error('Expected argument of type api.GetDeviceQueueItemsRequest');
@ -565,6 +587,20 @@ getQueue: {
responseSerialize: serialize_api_GetDeviceQueueItemsResponse,
responseDeserialize: deserialize_api_GetDeviceQueueItemsResponse,
},
// GetNextFCntDown returns the next FCntDown to use for enqueing encrypted
// downlinks. The difference with the DeviceActivation f_cont_down is that
// this method takes potential existing queue-items into account.
getNextFCntDown: {
path: '/api.DeviceService/GetNextFCntDown',
requestStream: false,
responseStream: false,
requestType: api_device_pb.GetDeviceNextFCntDownRequest,
responseType: api_device_pb.GetDeviceNextFCntDownResponse,
requestSerialize: serialize_api_GetDeviceNextFCntDownRequest,
requestDeserialize: deserialize_api_GetDeviceNextFCntDownRequest,
responseSerialize: serialize_api_GetDeviceNextFCntDownResponse,
responseDeserialize: deserialize_api_GetDeviceNextFCntDownResponse,
},
};
exports.DeviceServiceClient = grpc.makeGenericClientConstructor(DeviceServiceService);

View File

@ -867,6 +867,9 @@ export class DeviceQueueItem extends jspb.Message {
getFCntDown(): number;
setFCntDown(value: number): void;
getIsEncrypted(): boolean;
setIsEncrypted(value: boolean): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceQueueItem.AsObject;
static toObject(includeInstance: boolean, msg: DeviceQueueItem): DeviceQueueItem.AsObject;
@ -887,6 +890,7 @@ export namespace DeviceQueueItem {
object?: google_protobuf_struct_pb.Struct.AsObject,
isPending: boolean,
fCntDown: number,
isEncrypted: boolean,
}
}
@ -1022,3 +1026,43 @@ export namespace FlushDevNoncesRequest {
}
}
export class GetDeviceNextFCntDownRequest extends jspb.Message {
getDevEui(): string;
setDevEui(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceNextFCntDownRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceNextFCntDownRequest): GetDeviceNextFCntDownRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceNextFCntDownRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceNextFCntDownRequest;
static deserializeBinaryFromReader(message: GetDeviceNextFCntDownRequest, reader: jspb.BinaryReader): GetDeviceNextFCntDownRequest;
}
export namespace GetDeviceNextFCntDownRequest {
export type AsObject = {
devEui: string,
}
}
export class GetDeviceNextFCntDownResponse extends jspb.Message {
getFCntDown(): number;
setFCntDown(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceNextFCntDownResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceNextFCntDownResponse): GetDeviceNextFCntDownResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceNextFCntDownResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceNextFCntDownResponse;
static deserializeBinaryFromReader(message: GetDeviceNextFCntDownResponse, reader: jspb.BinaryReader): GetDeviceNextFCntDownResponse;
}
export namespace GetDeviceNextFCntDownResponse {
export type AsObject = {
fCntDown: number,
}
}

View File

@ -47,6 +47,8 @@ goog.exportSymbol('proto.api.GetDeviceLinkMetricsRequest', null, global);
goog.exportSymbol('proto.api.GetDeviceLinkMetricsResponse', null, global);
goog.exportSymbol('proto.api.GetDeviceMetricsRequest', null, global);
goog.exportSymbol('proto.api.GetDeviceMetricsResponse', null, global);
goog.exportSymbol('proto.api.GetDeviceNextFCntDownRequest', null, global);
goog.exportSymbol('proto.api.GetDeviceNextFCntDownResponse', null, global);
goog.exportSymbol('proto.api.GetDeviceQueueItemsRequest', null, global);
goog.exportSymbol('proto.api.GetDeviceQueueItemsResponse', null, global);
goog.exportSymbol('proto.api.GetDeviceRequest', null, global);
@ -792,6 +794,48 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.api.FlushDevNoncesRequest.displayName = 'proto.api.FlushDevNoncesRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.api.GetDeviceNextFCntDownRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.GetDeviceNextFCntDownRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.api.GetDeviceNextFCntDownRequest.displayName = 'proto.api.GetDeviceNextFCntDownRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.api.GetDeviceNextFCntDownResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.GetDeviceNextFCntDownResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.api.GetDeviceNextFCntDownResponse.displayName = 'proto.api.GetDeviceNextFCntDownResponse';
}
@ -6721,7 +6765,8 @@ proto.api.DeviceQueueItem.toObject = function(includeInstance, msg) {
data: msg.getData_asB64(),
object: (f = msg.getObject()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
isPending: jspb.Message.getBooleanFieldWithDefault(msg, 7, false),
fCntDown: jspb.Message.getFieldWithDefault(msg, 8, 0)
fCntDown: jspb.Message.getFieldWithDefault(msg, 8, 0),
isEncrypted: jspb.Message.getBooleanFieldWithDefault(msg, 9, false)
};
if (includeInstance) {
@ -6791,6 +6836,10 @@ proto.api.DeviceQueueItem.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {number} */ (reader.readUint32());
msg.setFCntDown(value);
break;
case 9:
var value = /** @type {boolean} */ (reader.readBool());
msg.setIsEncrypted(value);
break;
default:
reader.skipField();
break;
@ -6877,6 +6926,13 @@ proto.api.DeviceQueueItem.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getIsEncrypted();
if (f) {
writer.writeBool(
9,
f
);
}
};
@ -7067,6 +7123,24 @@ proto.api.DeviceQueueItem.prototype.setFCntDown = function(value) {
};
/**
* optional bool is_encrypted = 9;
* @return {boolean}
*/
proto.api.DeviceQueueItem.prototype.getIsEncrypted = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false));
};
/**
* @param {boolean} value
* @return {!proto.api.DeviceQueueItem} returns this
*/
proto.api.DeviceQueueItem.prototype.setIsEncrypted = function(value) {
return jspb.Message.setProto3BooleanField(this, 9, value);
};
@ -7958,4 +8032,264 @@ proto.api.FlushDevNoncesRequest.prototype.setDevEui = function(value) {
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.GetDeviceNextFCntDownRequest.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetDeviceNextFCntDownRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.GetDeviceNextFCntDownRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.GetDeviceNextFCntDownRequest.toObject = function(includeInstance, msg) {
var f, obj = {
devEui: jspb.Message.getFieldWithDefault(msg, 1, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.GetDeviceNextFCntDownRequest}
*/
proto.api.GetDeviceNextFCntDownRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.GetDeviceNextFCntDownRequest;
return proto.api.GetDeviceNextFCntDownRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.GetDeviceNextFCntDownRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.GetDeviceNextFCntDownRequest}
*/
proto.api.GetDeviceNextFCntDownRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setDevEui(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.GetDeviceNextFCntDownRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.api.GetDeviceNextFCntDownRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.api.GetDeviceNextFCntDownRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.GetDeviceNextFCntDownRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getDevEui();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
};
/**
* optional string dev_eui = 1;
* @return {string}
*/
proto.api.GetDeviceNextFCntDownRequest.prototype.getDevEui = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.api.GetDeviceNextFCntDownRequest} returns this
*/
proto.api.GetDeviceNextFCntDownRequest.prototype.setDevEui = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.GetDeviceNextFCntDownResponse.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetDeviceNextFCntDownResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.GetDeviceNextFCntDownResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.GetDeviceNextFCntDownResponse.toObject = function(includeInstance, msg) {
var f, obj = {
fCntDown: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.GetDeviceNextFCntDownResponse}
*/
proto.api.GetDeviceNextFCntDownResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.GetDeviceNextFCntDownResponse;
return proto.api.GetDeviceNextFCntDownResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.GetDeviceNextFCntDownResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.GetDeviceNextFCntDownResponse}
*/
proto.api.GetDeviceNextFCntDownResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint32());
msg.setFCntDown(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.GetDeviceNextFCntDownResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.api.GetDeviceNextFCntDownResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.api.GetDeviceNextFCntDownResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.GetDeviceNextFCntDownResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getFCntDown();
if (f !== 0) {
writer.writeUint32(
1,
f
);
}
};
/**
* optional uint32 f_cnt_down = 1;
* @return {number}
*/
proto.api.GetDeviceNextFCntDownResponse.prototype.getFCntDown = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.api.GetDeviceNextFCntDownResponse} returns this
*/
proto.api.GetDeviceNextFCntDownResponse.prototype.setFCntDown = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
goog.object.extend(exports, proto.api);

View File

@ -102,6 +102,32 @@ export namespace UplinkRelayRxInfo {
}
}
export class JoinServerContext extends jspb.Message {
getSessionKeyId(): string;
setSessionKeyId(value: string): void;
hasAppSKey(): boolean;
clearAppSKey(): void;
getAppSKey(): common_common_pb.KeyEnvelope | undefined;
setAppSKey(value?: common_common_pb.KeyEnvelope): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): JoinServerContext.AsObject;
static toObject(includeInstance: boolean, msg: JoinServerContext): JoinServerContext.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: JoinServerContext, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): JoinServerContext;
static deserializeBinaryFromReader(message: JoinServerContext, reader: jspb.BinaryReader): JoinServerContext;
}
export namespace JoinServerContext {
export type AsObject = {
sessionKeyId: string,
appSKey?: common_common_pb.KeyEnvelope.AsObject,
}
}
export class UplinkEvent extends jspb.Message {
getDeduplicationId(): string;
setDeduplicationId(value: string): void;
@ -159,6 +185,11 @@ export class UplinkEvent extends jspb.Message {
getRelayRxInfo(): UplinkRelayRxInfo | undefined;
setRelayRxInfo(value?: UplinkRelayRxInfo): void;
hasJoinServerContext(): boolean;
clearJoinServerContext(): void;
getJoinServerContext(): JoinServerContext | undefined;
setJoinServerContext(value?: JoinServerContext): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkEvent.AsObject;
static toObject(includeInstance: boolean, msg: UplinkEvent): UplinkEvent.AsObject;
@ -185,6 +216,7 @@ export namespace UplinkEvent {
rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
relayRxInfo?: UplinkRelayRxInfo.AsObject,
joinServerContext?: JoinServerContext.AsObject,
}
}
@ -210,6 +242,11 @@ export class JoinEvent extends jspb.Message {
getRelayRxInfo(): UplinkRelayRxInfo | undefined;
setRelayRxInfo(value?: UplinkRelayRxInfo): void;
hasJoinServerContext(): boolean;
clearJoinServerContext(): void;
getJoinServerContext(): JoinServerContext | undefined;
setJoinServerContext(value?: JoinServerContext): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): JoinEvent.AsObject;
static toObject(includeInstance: boolean, msg: JoinEvent): JoinEvent.AsObject;
@ -227,6 +264,7 @@ export namespace JoinEvent {
deviceInfo?: DeviceInfo.AsObject,
devAddr: string,
relayRxInfo?: UplinkRelayRxInfo.AsObject,
joinServerContext?: JoinServerContext.AsObject,
}
}
@ -562,6 +600,7 @@ export interface LogCodeMap {
UPLINK_F_CNT_RETRANSMISSION: 7;
DOWNLINK_GATEWAY: 8;
RELAY_NEW_END_DEVICE: 9;
F_CNT_DOWN: 10;
}
export const LogCode: LogCodeMap;

View File

@ -25,6 +25,7 @@ goog.exportSymbol('proto.integration.DeviceInfo', null, global);
goog.exportSymbol('proto.integration.DownlinkCommand', null, global);
goog.exportSymbol('proto.integration.IntegrationEvent', null, global);
goog.exportSymbol('proto.integration.JoinEvent', null, global);
goog.exportSymbol('proto.integration.JoinServerContext', null, global);
goog.exportSymbol('proto.integration.LocationEvent', null, global);
goog.exportSymbol('proto.integration.LogCode', null, global);
goog.exportSymbol('proto.integration.LogEvent', null, global);
@ -75,6 +76,27 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.integration.UplinkRelayRxInfo.displayName = 'proto.integration.UplinkRelayRxInfo';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.integration.JoinServerContext = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.integration.JoinServerContext, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.integration.JoinServerContext.displayName = 'proto.integration.JoinServerContext';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
@ -948,6 +970,187 @@ proto.integration.UplinkRelayRxInfo.prototype.setWorChannel = function(value) {
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.integration.JoinServerContext.prototype.toObject = function(opt_includeInstance) {
return proto.integration.JoinServerContext.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.integration.JoinServerContext} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.integration.JoinServerContext.toObject = function(includeInstance, msg) {
var f, obj = {
sessionKeyId: jspb.Message.getFieldWithDefault(msg, 1, ""),
appSKey: (f = msg.getAppSKey()) && common_common_pb.KeyEnvelope.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.integration.JoinServerContext}
*/
proto.integration.JoinServerContext.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.integration.JoinServerContext;
return proto.integration.JoinServerContext.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.integration.JoinServerContext} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.integration.JoinServerContext}
*/
proto.integration.JoinServerContext.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setSessionKeyId(value);
break;
case 2:
var value = new common_common_pb.KeyEnvelope;
reader.readMessage(value,common_common_pb.KeyEnvelope.deserializeBinaryFromReader);
msg.setAppSKey(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.integration.JoinServerContext.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.integration.JoinServerContext.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.integration.JoinServerContext} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.integration.JoinServerContext.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getSessionKeyId();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getAppSKey();
if (f != null) {
writer.writeMessage(
2,
f,
common_common_pb.KeyEnvelope.serializeBinaryToWriter
);
}
};
/**
* optional string session_key_id = 1;
* @return {string}
*/
proto.integration.JoinServerContext.prototype.getSessionKeyId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.integration.JoinServerContext} returns this
*/
proto.integration.JoinServerContext.prototype.setSessionKeyId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional common.KeyEnvelope app_s_key = 2;
* @return {?proto.common.KeyEnvelope}
*/
proto.integration.JoinServerContext.prototype.getAppSKey = function() {
return /** @type{?proto.common.KeyEnvelope} */ (
jspb.Message.getWrapperField(this, common_common_pb.KeyEnvelope, 2));
};
/**
* @param {?proto.common.KeyEnvelope|undefined} value
* @return {!proto.integration.JoinServerContext} returns this
*/
proto.integration.JoinServerContext.prototype.setAppSKey = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.integration.JoinServerContext} returns this
*/
proto.integration.JoinServerContext.prototype.clearAppSKey = function() {
return this.setAppSKey(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.integration.JoinServerContext.prototype.hasAppSKey = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
@ -1000,7 +1203,8 @@ proto.integration.UplinkEvent.toObject = function(includeInstance, msg) {
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f),
relayRxInfo: (f = msg.getRelayRxInfo()) && proto.integration.UplinkRelayRxInfo.toObject(includeInstance, f)
relayRxInfo: (f = msg.getRelayRxInfo()) && proto.integration.UplinkRelayRxInfo.toObject(includeInstance, f),
joinServerContext: (f = msg.getJoinServerContext()) && proto.integration.JoinServerContext.toObject(includeInstance, f)
};
if (includeInstance) {
@ -1099,6 +1303,11 @@ proto.integration.UplinkEvent.deserializeBinaryFromReader = function(msg, reader
reader.readMessage(value,proto.integration.UplinkRelayRxInfo.deserializeBinaryFromReader);
msg.setRelayRxInfo(value);
break;
case 15:
var value = new proto.integration.JoinServerContext;
reader.readMessage(value,proto.integration.JoinServerContext.deserializeBinaryFromReader);
msg.setJoinServerContext(value);
break;
default:
reader.skipField();
break;
@ -1232,6 +1441,14 @@ proto.integration.UplinkEvent.serializeBinaryToWriter = function(message, writer
proto.integration.UplinkRelayRxInfo.serializeBinaryToWriter
);
}
f = message.getJoinServerContext();
if (f != null) {
writer.writeMessage(
15,
f,
proto.integration.JoinServerContext.serializeBinaryToWriter
);
}
};
@ -1626,6 +1843,43 @@ proto.integration.UplinkEvent.prototype.hasRelayRxInfo = function() {
};
/**
* optional JoinServerContext join_server_context = 15;
* @return {?proto.integration.JoinServerContext}
*/
proto.integration.UplinkEvent.prototype.getJoinServerContext = function() {
return /** @type{?proto.integration.JoinServerContext} */ (
jspb.Message.getWrapperField(this, proto.integration.JoinServerContext, 15));
};
/**
* @param {?proto.integration.JoinServerContext|undefined} value
* @return {!proto.integration.UplinkEvent} returns this
*/
proto.integration.UplinkEvent.prototype.setJoinServerContext = function(value) {
return jspb.Message.setWrapperField(this, 15, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.integration.UplinkEvent} returns this
*/
proto.integration.UplinkEvent.prototype.clearJoinServerContext = function() {
return this.setJoinServerContext(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.integration.UplinkEvent.prototype.hasJoinServerContext = function() {
return jspb.Message.getField(this, 15) != null;
};
@ -1662,7 +1916,8 @@ proto.integration.JoinEvent.toObject = function(includeInstance, msg) {
time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
deviceInfo: (f = msg.getDeviceInfo()) && proto.integration.DeviceInfo.toObject(includeInstance, f),
devAddr: jspb.Message.getFieldWithDefault(msg, 4, ""),
relayRxInfo: (f = msg.getRelayRxInfo()) && proto.integration.UplinkRelayRxInfo.toObject(includeInstance, f)
relayRxInfo: (f = msg.getRelayRxInfo()) && proto.integration.UplinkRelayRxInfo.toObject(includeInstance, f),
joinServerContext: (f = msg.getJoinServerContext()) && proto.integration.JoinServerContext.toObject(includeInstance, f)
};
if (includeInstance) {
@ -1722,6 +1977,11 @@ proto.integration.JoinEvent.deserializeBinaryFromReader = function(msg, reader)
reader.readMessage(value,proto.integration.UplinkRelayRxInfo.deserializeBinaryFromReader);
msg.setRelayRxInfo(value);
break;
case 6:
var value = new proto.integration.JoinServerContext;
reader.readMessage(value,proto.integration.JoinServerContext.deserializeBinaryFromReader);
msg.setJoinServerContext(value);
break;
default:
reader.skipField();
break;
@ -1789,6 +2049,14 @@ proto.integration.JoinEvent.serializeBinaryToWriter = function(message, writer)
proto.integration.UplinkRelayRxInfo.serializeBinaryToWriter
);
}
f = message.getJoinServerContext();
if (f != null) {
writer.writeMessage(
6,
f,
proto.integration.JoinServerContext.serializeBinaryToWriter
);
}
};
@ -1939,6 +2207,43 @@ proto.integration.JoinEvent.prototype.hasRelayRxInfo = function() {
};
/**
* optional JoinServerContext join_server_context = 6;
* @return {?proto.integration.JoinServerContext}
*/
proto.integration.JoinEvent.prototype.getJoinServerContext = function() {
return /** @type{?proto.integration.JoinServerContext} */ (
jspb.Message.getWrapperField(this, proto.integration.JoinServerContext, 6));
};
/**
* @param {?proto.integration.JoinServerContext|undefined} value
* @return {!proto.integration.JoinEvent} returns this
*/
proto.integration.JoinEvent.prototype.setJoinServerContext = function(value) {
return jspb.Message.setWrapperField(this, 6, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.integration.JoinEvent} returns this
*/
proto.integration.JoinEvent.prototype.clearJoinServerContext = function() {
return this.setJoinServerContext(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.integration.JoinEvent.prototype.hasJoinServerContext = function() {
return jspb.Message.getField(this, 6) != null;
};
@ -4284,7 +4589,8 @@ proto.integration.LogCode = {
UPLINK_MIC: 6,
UPLINK_F_CNT_RETRANSMISSION: 7,
DOWNLINK_GATEWAY: 8,
RELAY_NEW_END_DEVICE: 9
RELAY_NEW_END_DEVICE: 9,
F_CNT_DOWN: 10
};
goog.object.extend(exports, proto.integration);