Skip to content

Feat/675 on chain ouis devaddrs #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 94 additions & 10 deletions src/service/iot_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ import "region.proto";
// are signed by the config service to allow the recipient to validate
// the authenticity of the data returned.
//
// - Every key called `owner`, `payer` and `delegate_keys` are binary
// - org_v1 Every key called `owner`, `payer` and `delegate_keys` are binary
// encoded public keys, Rust encoding example here:
// https://github.com/helium/helium-crypto-rs/blob/main/src/public_key.rs#L347-L354
//
// - org_v2 Every key called `owner`, and `delegate_keys` are solana pubkeys
// https://docs.rs/solana-sdk/1.18.0/solana_sdk/pubkey/struct.Pubkey.html
//
// == DevAddrs ==
//
// - `devaddr_range` and `devaddr_constraints` are inclusive on both sides,
Expand All @@ -40,8 +43,11 @@ enum action_v1 {
remove = 1;
}

// Define an organisation
// Define an organization
// Deprecated: Use org_v2 instead
message org_v1 {
option deprecated = true;

uint64 oui = 1;
// Org admin key
bytes owner = 2;
Expand All @@ -53,6 +59,22 @@ message org_v1 {
bool locked = 5;
}

message org_v2 {
uint64 oui = 1;
// On chain address
bytes address = 2;
// Org admin key
bytes owner = 3;
// Used to infer escrow address for DC payments
string escrow_key = 4;
// List of keys allowed some specific actions, see services.
repeated bytes delegate_keys = 5;
// Is org approved on chain
bool approved = 6;
// Is org locked because of no payment
bool locked = 7;
}

// Device address range, ex: 16#00000001 to 16#0000000A
message devaddr_range_v1 {
string route_id = 1;
Expand Down Expand Up @@ -136,9 +158,11 @@ message route_v1 {
// Service Message Definitions
// ------------------------------------------------------------------

message org_list_req_v1 {}
message org_list_req_v1 { option deprecated = true; }

message org_list_res_v1 {
option deprecated = true;

repeated org_v1 orgs = 1;
// in seconds since unix epoch
uint64 timestamp = 2;
Expand All @@ -148,9 +172,31 @@ message org_list_res_v1 {
bytes signature = 4;
}

message org_get_req_v1 { uint64 oui = 1; }
message org_list_req_v2 {}

message org_list_res_v2 {
repeated org_v2 orgs = 1;
// in seconds since unix epoch
uint64 timestamp = 2;
// pubkey binary of the signing keypair
bytes signer = 3;
// Signature over the response by the config service
bytes signature = 4;
}

message org_get_req_v1 {
option deprecated = true;

uint64 oui = 1;
}

message org_get_req_v2 { uint64 oui = 1; }

// moved on chain and managed by
// pure solana instructions/transactions
message org_create_helium_req_v1 {
option deprecated = true;

enum helium_net_id {
type0_0x00003c = 0;
type3_0x60002d = 1;
Expand All @@ -171,7 +217,11 @@ message org_create_helium_req_v1 {
helium_net_id net_id = 8;
}

// moved on chain and managed by
// pure solana instructions/transactions
message org_create_roamer_req_v1 {
option deprecated = true;

bytes owner = 1;
bytes payer = 2;
uint32 net_id = 3;
Expand All @@ -183,18 +233,28 @@ message org_create_roamer_req_v1 {
bytes signer = 7;
}

// moved on chain and managed by
// pure solana instructions/transactions
message org_update_req_v1 {
option deprecated = true;

message delegate_key_update_v1 {
option deprecated = true;

bytes delegate_key = 1;
action_v1 action = 2;
}

message devaddr_constraint_update_v1 {
option deprecated = true;

devaddr_constraint_v1 constraint = 1;
action_v1 action = 2;
}

message update_v1 {
option deprecated = true;

oneof update {
bytes owner = 1;
bytes payer = 2;
Expand All @@ -214,6 +274,8 @@ message org_update_req_v1 {
}

message org_res_v1 {
option deprecated = true;

org_v1 org = 1;
uint32 net_id = 2;
repeated devaddr_constraint_v1 devaddr_constraints = 3;
Expand All @@ -225,6 +287,18 @@ message org_res_v1 {
bytes signature = 6;
}

message org_res_v2 {
org_v2 org = 1;
uint32 net_id = 2;
repeated devaddr_constraint_v1 devaddr_constraints = 3;
// in seconds since unix epoch
uint64 timestamp = 4;
// pubkey binary of the signing keypair
bytes signer = 5;
// Signature over the response by the config service
bytes signature = 6;
}

message org_disable_req_v1 {
uint64 oui = 1;
// in milliseconds since unix epoch
Expand Down Expand Up @@ -646,17 +720,27 @@ message region_params_res_v1 {

service org {
// List Org (no auth)
rpc list(org_list_req_v1) returns (org_list_res_v1);
rpc list(org_list_req_v1) returns (org_list_res_v1) {
option deprecated = true;
}
rpc list_v2(org_list_req_v2) returns (org_list_res_v2);
// Get Org (no auth)
rpc get(org_get_req_v1) returns (org_res_v1);
rpc get(org_get_req_v1) returns (org_res_v1) { option deprecated = true; }
rpc get_v2(org_get_req_v2) returns (org_res_v2);
// Create Org on Helium Network (auth admin only)
rpc create_helium(org_create_helium_req_v1) returns (org_res_v1);
rpc create_helium(org_create_helium_req_v1) returns (org_res_v1) {
option deprecated = true;
}
// Create Org on any network (auth admin only)
rpc create_roamer(org_create_roamer_req_v1) returns (org_res_v1);
rpc create_roamer(org_create_roamer_req_v1) returns (org_res_v1) {
option deprecated = true;
}
// Update any Org (Helium or Roaming)
// Modify payer and add/remove delegate keys (owner/admin)
// Modify owner and add/remove devaddr constraints (auth admin only)
rpc update(org_update_req_v1) returns (org_res_v1);
rpc update(org_update_req_v1) returns (org_res_v1) {
option deprecated = true;
}
// Disable an org, this sends a stream route delete update to HPR
// for all associated routes (auth admin only)
rpc disable(org_disable_req_v1) returns (org_disable_res_v1);
Expand Down Expand Up @@ -702,7 +786,7 @@ service route {

// List Filters for a Route (auth delegate_keys/owner/admin)
rpc list_skfs(route_skf_list_req_v1) returns (stream skf_v1);
// List Filters for a DevAddr (auth delegate_keys/owner/admin
// List Filters for a DevAddr (auth delegate_keys/owner/admin)
rpc get_skfs(route_skf_get_req_v1) returns (stream skf_v1);
// Update Filters for an Org (auth delegate_keys/owner/admin)
rpc update_skfs(route_skf_update_req_v1) returns (route_skf_update_res_v1);
Expand Down