Skip to main content

mountpoint_s3_crt/
auth.rs

1//! Rust bindings for the AWS Common Runtime authentication library.
2
3use std::sync::Once;
4
5use mountpoint_s3_crt_sys::aws_auth_library_init;
6
7pub use mountpoint_s3_crt_sys::aws_auth_errors as ErrorCode;
8
9use crate::common::allocator::Allocator;
10
11pub mod credentials;
12pub mod imds_client;
13pub mod signing_config;
14
15static AUTH_LIBRARY_INIT: Once = Once::new();
16
17/// Set up the aws-c-auth library using the given allocator.
18fn auth_library_init(allocator: &Allocator) {
19    AUTH_LIBRARY_INIT.call_once(|| {
20        // Safety: the CRT ensures this call happens only once.
21        unsafe {
22            aws_auth_library_init(allocator.inner.as_ptr());
23        }
24    });
25}