Skip to content

Commit

Permalink
Use Oak labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetr0v committed Jun 8, 2020
1 parent f661f80 commit 3c216f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ futures-core = "*"
futures-util = "*"
log = "*"
oak = "=0.1.0"
oak_abi = "=0.1.0"
prost = "*"
structopt = "*"
tokio = { version = "*", features = ["fs", "macros", "sync", "stream"] }
Expand Down
17 changes: 16 additions & 1 deletion examples/trusted_information_retrieval/client/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub mod proto {

use anyhow::anyhow;
use log::info;
use oak_abi::label::Label;
use prost::Message;
use proto::{
trusted_information_retrieval_client::TrustedInformationRetrievalClient,
ListPointsOfInterestRequest, Location,
Expand Down Expand Up @@ -78,7 +80,20 @@ async fn main() -> anyhow::Result<()> {
.await
.expect("Could not connect to Oak Application");

let mut client = TrustedInformationRetrievalClient::new(channel);
let mut label = Vec::new();
Label::public_untrusted()
.encode(&mut label)
.expect("Error encoding label");
let mut client = TrustedInformationRetrievalClient::with_interceptor(
channel,
move |mut request: tonic::Request<()>| {
request.metadata_mut().insert_bin(
"x-oak-label-bin",
tonic::metadata::MetadataValue::from_bytes(label.as_ref()),
);
Ok(request)
},
);

let request = tonic::Request::new(ListPointsOfInterestRequest {
location: Some(Location {
Expand Down

0 comments on commit 3c216f0

Please sign in to comment.