Module aws_sigv4::event_stream
source · Available on crate feature
sign-eventstream
only.Expand description
Utilities to sign Event Stream messages.
§Example: Signing an event stream message
use aws_sigv4::event_stream::sign_message;
use aws_smithy_types::event_stream::{Header, HeaderValue, Message};
use std::time::SystemTime;
use aws_credential_types::Credentials;
use aws_smithy_runtime_api::client::identity::Identity;
use aws_sigv4::sign::v4;
// The `last_signature` argument is the previous message's signature, or
// the signature of the initial HTTP request if a message hasn't been signed yet.
let last_signature = "example298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
let message_to_sign = Message::new(&b"example"[..]).add_header(Header::new(
"some-header",
HeaderValue::String("value".into()),
));
let identity = Credentials::new(
"AKIDEXAMPLE",
"wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
None,
None,
"hardcoded-credentials"
).into();
let params = v4::SigningParams::builder()
.identity(&identity)
.region("us-east-1")
.name("exampleservice")
.time(SystemTime::now())
.settings(())
.build()
.unwrap();
// Use the returned `signature` to sign the next message.
let (signed, signature) = sign_message(&message_to_sign, &last_signature, ¶ms)
.expect("signing should succeed")
.into_parts();
Functions§
- Returns a signed empty message
- Signs an Event Stream message with the given
credentials
.
Type Aliases§
- Event stream signing parameters