pub struct Credentials {
pub key_id: String,
/* private fields */
}Expand description
API-key authentication material.
Credentials with the same key id share timestamp allocation within this process. The signing protocol has no cross-process nonce, so use one API key per process to avoid duplicate tuples across independent processes.
Fields§
§key_id: StringImplementations§
Source§impl Credentials
impl Credentials
pub fn new(key_id: impl Into<String>, private_key_hex: &str) -> Result<Self>
Sourcepub fn load(
api_key_id: Option<&str>,
api_private_key: Option<&str>,
from_env: bool,
) -> Result<Option<Self>>
pub fn load( api_key_id: Option<&str>, api_private_key: Option<&str>, from_env: bool, ) -> Result<Option<Self>>
Load credentials from explicit values and/or environment.
pub fn sign_request( &self, method: &str, raw_url: &str, body: &[u8], timestamp_ms: Option<&str>, ) -> Result<BTreeMap<String, String>>
Sourcepub fn sign_payload(&self, payload: &[u8]) -> Vec<u8> ⓘ
pub fn sign_payload(&self, payload: &[u8]) -> Vec<u8> ⓘ
Sign exact business-payload bytes with this API key’s Ed25519 key.
This is distinct from HTTP request authentication. Callers must use a protocol-defined deterministic encoding and submit the same bytes’ logical message unchanged.
Sourcepub async fn sign_request_async(
&self,
method: &str,
raw_url: &str,
body: &[u8],
timestamp_ms: Option<&str>,
) -> Result<BTreeMap<String, String>>
pub async fn sign_request_async( &self, method: &str, raw_url: &str, body: &[u8], timestamp_ms: Option<&str>, ) -> Result<BTreeMap<String, String>>
Sign a request without blocking an async executor when the timestamp uniqueness window is temporarily full.
All SDK network paths use this method. Callers using Self::sign_request
directly receive a retryable capacity error instead of a blocking sleep.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more