forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeviceclaimingserver.proto
More file actions
92 lines (81 loc) · 5.24 KB
/
deviceclaimingserver.proto
File metadata and controls
92 lines (81 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "github.com/envoyproxy/protoc-gen-validate/validate/validate.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "lorawan-stack/api/identifiers.proto";
package ttn.lorawan.v3;
option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";
message ClaimEndDeviceRequest {
message AuthenticatedIdentifiers {
bytes join_eui = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/v3/pkg/types.EUI64", (gogoproto.customname) = "JoinEUI"];
bytes dev_eui = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/v3/pkg/types.EUI64", (gogoproto.customname) = "DevEUI"];
string authentication_code = 3 [(validate.rules).string.pattern = "^[A-Z0-9]{1,32}$"];
}
oneof source_device {
option (validate.required) = true;
AuthenticatedIdentifiers authenticated_identifiers = 1 [(gogoproto.customname) = "AuthenticatedIdentifiers"];
bytes qr_code = 2 [(validate.rules).bytes = {min_len: 0, max_len: 1024}, (gogoproto.customname) = "QRCode"];
}
// Application identifiers of the target end device.
ApplicationIdentifiers target_application_ids = 3 [(gogoproto.nullable) = false, (validate.rules).message.required = true, (gogoproto.customname) = "TargetApplicationIDs"];
// End device ID of the target end device. If empty, use the source device ID.
string target_device_id = 4 [(gogoproto.customname) = "TargetDeviceID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$" , max_len: 36}];
reserved 6; // target_join_eui
// The address of the Network Server where the device will be registered.
// If set and if the source device is currently registered on a Network Server, settings will be transferred.
// If not set, the device shall not be registered on a Network Server.
string target_network_server_address = 7 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];
// The KEK label of the Network Server to use for wrapping network session keys.
string target_network_server_kek_label = 8 [(gogoproto.customname) = "TargetNetworkServerKEKLabel", (validate.rules).string.max_len = 2048];
// The address of the Application Server where the device will be registered.
// If set and if the source device is currently registered on an Application Server, settings will be transferred.
// If not set, the device shall not be registered on an Application Server.
string target_application_server_address = 9 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];
// The KEK label of the Application Server to use for wrapping the application session key.
string target_application_server_kek_label = 10 [(gogoproto.customname) = "TargetApplicationServerKEKLabel", (validate.rules).string.max_len = 2048];
// The AS-ID of the Application Server to use.
string target_application_server_id = 11 [(gogoproto.customname) = "TargetApplicationServerID", (validate.rules).string.max_len = 100];
reserved 12; // target_join_server_address
// Home NetID.
bytes target_net_id = 13 [(gogoproto.customtype) = "go.thethings.network/lorawan-stack/v3/pkg/types.NetID", (gogoproto.customname) = "TargetNetID"];
// If set, invalidate the authentication code with which the device gets claimed. This prohibits subsequent claiming requests.
bool invalidate_authentication_code = 5;
}
message AuthorizeApplicationRequest {
ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
string api_key = 2 [(gogoproto.customname) = "APIKey", (validate.rules).string.min_len = 1];
}
service EndDeviceClaimingServer {
// Claims the end device by claim authentication code or QR code and transfers the device to the target application.
rpc Claim(ClaimEndDeviceRequest) returns (EndDeviceIdentifiers) {
option (google.api.http) = {
post: "/edcs/claim",
body: "*"
};
};
rpc AuthorizeApplication(AuthorizeApplicationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/edcs/applications/{application_ids.application_id}/authorize",
body: "*"
};
};
rpc UnauthorizeApplication(ApplicationIdentifiers) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/edcs/applications/{application_id}/authorize"
};
};
}