Skip to content
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

feat: EI-3417 - Data/meta per-twin allowlist check RPCs #39

Merged
merged 1 commit into from
Oct 28, 2024
Merged
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
70 changes: 68 additions & 2 deletions proto/iotics/api/host.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@ option php_namespace = "Iotics\\Api";
service HostAPI {
// GetHostID gets the ID of the host twin.
rpc GetHostID(GetHostIDRequest) returns (GetHostIDResponse) {}

// IsHostDataAllowed determines whether a remote host is allowed to perform data requests against the given twin.
// An example of a data request is interest.SendInputMessage
rpc IsHostDataAllowed(IsHostDataAllowedRequest) returns (IsHostDataAllowedResponse) {}
Copy link
Contributor Author

@vtermanis vtermanis Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The slight change suggestion to the RPC naming compared to what's in the ticket is intentional: I thought since the ontological terms talk about e.g. pub:hostMetadataAllowList, it might be more consistent to call it IsHost<Type>Allowed()


// IsHostMetaAllowed determines whether a remote host is allowed to perform meta requests against the given twin.
// An example of a meta(data) request is twin.DescribeTwin
rpc IsHostMetaAllowed(IsHostMetaAllowedRequest) returns (IsHostMetaAllowedResponse) {}
}

// GetHostIDRequest: gets the local host twin's ID
// GetHostIDRequest gets the local host twin's ID
message GetHostIDRequest {
Headers headers = 1;
}

// GetHostIDResponse: response containing the local host twin's ID
// GetHostIDResponse is the response containing the local host twin's ID
message GetHostIDResponse {
message Payload {
string hostId = 1;
Expand All @@ -39,3 +47,61 @@ message GetHostIDResponse {

Payload payload = 2;
}


// HostAllowedArguments are the arguments determining which host and twin the allow list check applies to.
message HostAllowedArguments {
// Remote Host Id
string remoteHostId = 1;

// TwinDID of the twin to which the request applies
TwinID twinId = 2;
}

// HostAllowedResponsePayload contans response details to a data/meta allow list check.
message HostAllowedResponsePayload {
// Remote Host Id
string remoteHostId = 1;

// TwinDID of the twin to which the request applies
TwinID twinId = 2;

// Whether the twin allows the remote host to perform meta or data actions
bool allowed = 3;
}

// IsHostDataAllowedRequest determines whether a remote host is allowed to perform data requests against the given twin.
message IsHostDataAllowedRequest {
// IsHostDataAllowedRequest headers
Headers headers = 1;

// IsHostDataAllowedRequest mandatory arguments
HostAllowedArguments args = 2;
}

// IsHostDataAllowedResponse is the response to for an IsHostDataAllowed call
message IsHostDataAllowedResponse {
// IsHostDataAllowedResponse headers
Headers headers = 1;

// IsHostDataAllowedResponse payload
HostAllowedResponsePayload payload = 2;
}

// IsHostMetaAllowedRequest determines whether a remote host is allowed to perform meta requests against the given twin.
message IsHostMetaAllowedRequest {
// IsHostMetaAllowedRequest headers
Headers headers = 1;

// IsHostMetaAllowedRequest mandatory arguments
HostAllowedArguments args = 2;
}

// IsHostDataAllowedResponse is the response to for an IsHostMetaAllowed call
message IsHostMetaAllowedResponse {
// IsHostMetaAllowedResponse headers
Headers headers = 1;

// IsHostMetaAllowedResponse payload
HostAllowedResponsePayload payload = 2;
}
Loading