pub struct KalshiCredential { /* private fields */ }Expand description
A validated API identity and parsed RSA or Ed25519 private key.
Explicit credentials take precedence as a complete pair. Environment fallback applies only when both explicit fields are absent. Diagnostics omit the identity and key material.
Implementations§
Source§impl KalshiCredential
impl KalshiCredential
Sourcepub fn resolve(
api_key_id: Option<SecretString>,
private_key: Option<SecretString>,
environment: KalshiEnvironment,
) -> ConfigResult<Self>
pub fn resolve( api_key_id: Option<SecretString>, private_key: Option<SecretString>, environment: KalshiEnvironment, ) -> ConfigResult<Self>
Resolves and validates one complete credential set for the selected environment.
§Errors
Returns an error if credentials are missing, empty, incomplete, or invalid, or the key is not an unencrypted RSA or Ed25519 private key in PEM format.
Sourcepub fn headers(
&self,
timestamp_ms: u64,
method: &str,
path: &str,
) -> ConfigResult<Vec<(String, SecretString)>>
pub fn headers( &self, timestamp_ms: u64, method: &str, path: &str, ) -> ConfigResult<Vec<(String, SecretString)>>
Signs a full API path and returns the three access headers.
timestamp_ms is Unix time in milliseconds. The method is converted to uppercase.
The path starts at /, for example /trade-api/v2/portfolio/balance; any query is excluded.
Hostnames are not accepted.
Header values retain zeroizing, redacted ownership until passed to the transport.
§Errors
Returns an error if the method or path is invalid, or signing fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KalshiCredential
impl RefUnwindSafe for KalshiCredential
impl Send for KalshiCredential
impl Sync for KalshiCredential
impl Unpin for KalshiCredential
impl UnsafeUnpin for KalshiCredential
impl UnwindSafe for KalshiCredential
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more