Struct truelayer_signing::SignerBuilder
source · pub struct SignerBuilder<'a, Kid, Pk, Body, Method, Path> { /* private fields */ }
Expand description
Builder to generate a Tl-Signature
header value.
§Example
let tl_signature = truelayer_signing::SignerBuilder::build_with_pem(kid, private_key)
.method(truelayer_signing::Method::Post)
.path("/payouts")
.header("Idempotency-Key", idempotency_key)
.body(body)
.build_signer()
.sign()?;
Implementations§
source§impl<'a> SignerBuilder<'a, Unset, Unset, Unset, Unset, Unset>
impl<'a> SignerBuilder<'a, Unset, Unset, Unset, Unset, Unset>
source§impl<'a> SignerBuilder<'a, &'a str, &'a [u8], Unset, Unset, Unset>
impl<'a> SignerBuilder<'a, &'a str, &'a [u8], Unset, Unset, Unset>
pub fn build_with_pem(kid: &'a str, private_key: &'a [u8]) -> Self
source§impl<'a, Pk, Body, Method, Path> SignerBuilder<'a, Unset, Pk, Body, Method, Path>
impl<'a, Pk, Body, Method, Path> SignerBuilder<'a, Unset, Pk, Body, Method, Path>
sourcepub fn kid(self, kid: &str) -> SignerBuilder<'a, &str, Pk, Body, Method, Path>
pub fn kid(self, kid: &str) -> SignerBuilder<'a, &str, Pk, Body, Method, Path>
Add the private key kid.
source§impl<'a, K, Body, Method, Path> SignerBuilder<'a, K, Unset, Body, Method, Path>
impl<'a, K, Body, Method, Path> SignerBuilder<'a, K, Unset, Body, Method, Path>
sourcepub fn private_key(
self,
private_key: &[u8]
) -> SignerBuilder<'a, K, &[u8], Body, Method, Path>
pub fn private_key( self, private_key: &[u8] ) -> SignerBuilder<'a, K, &[u8], Body, Method, Path>
Add the private key.
source§impl<'a, K, Pk, Method, Path> SignerBuilder<'a, K, Pk, Unset, Method, Path>
impl<'a, K, Pk, Method, Path> SignerBuilder<'a, K, Pk, Unset, Method, Path>
sourcepub fn body(self, body: &[u8]) -> SignerBuilder<'a, K, Pk, &[u8], Method, Path>
pub fn body(self, body: &[u8]) -> SignerBuilder<'a, K, Pk, &[u8], Method, Path>
Add the full request body.
Note: This must be identical to what is sent with the request.
source§impl<'a, K, Pk, Body, Path> SignerBuilder<'a, K, Pk, Body, Unset, Path>
impl<'a, K, Pk, Body, Path> SignerBuilder<'a, K, Pk, Body, Unset, Path>
sourcepub fn method(
self,
method: Method
) -> SignerBuilder<'a, K, Pk, Body, Method, Path>
pub fn method( self, method: Method ) -> SignerBuilder<'a, K, Pk, Body, Method, Path>
Add the request method.
source§impl<'a, K, Pk, Body, Method> SignerBuilder<'a, K, Pk, Body, Method, Unset>
impl<'a, K, Pk, Body, Method> SignerBuilder<'a, K, Pk, Body, Method, Unset>
sourcepub fn path(self, path: &str) -> SignerBuilder<'a, K, Pk, Body, Method, &str>
pub fn path(self, path: &str) -> SignerBuilder<'a, K, Pk, Body, Method, &str>
Add the request absolute path starting with a leading /
and without
any trailing slashes.
source§impl<'a, K, Pk, Body, Method, Path> SignerBuilder<'a, K, Pk, Body, Method, Path>
impl<'a, K, Pk, Body, Method, Path> SignerBuilder<'a, K, Pk, Body, Method, Path>
sourcepub fn header(self, key: &'a str, value: &'a [u8]) -> Self
pub fn header(self, key: &'a str, value: &'a [u8]) -> Self
Add a header name & value. May be called multiple times to add multiple different headers.
Warning: Only a single value per header name is supported.
sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (&'a str, &'a [u8])>
) -> Self
pub fn headers( self, headers: impl IntoIterator<Item = (&'a str, &'a [u8])> ) -> Self
Appends multiple header names & values.
Warning: Only a single value per header name is supported.
source§impl<'a> SignerBuilder<'a, &'a str, Unset, &'a [u8], Method, &'a str>
impl<'a> SignerBuilder<'a, &'a str, Unset, &'a [u8], Method, &'a str>
sourcepub fn build_custom_signer(self) -> CustomSigner<'a>
pub fn build_custom_signer(self) -> CustomSigner<'a>
Builds a CustomSigner
requires the kid, body, method, and path to be set to call this function. if the private key is set this function will not be available.
source§impl<'a> SignerBuilder<'a, &'a str, &'a [u8], &'a [u8], Unset, Unset>
impl<'a> SignerBuilder<'a, &'a str, &'a [u8], &'a [u8], Unset, Unset>
sourcepub fn build_v1_signer(self) -> SignerV1<'a>
pub fn build_v1_signer(self) -> SignerV1<'a>
Build a V1 Signer see [SignerV1
].
requires the private key, kid, and body to be set to call this function. if the method of path is set this function will not be available.
In general full request signing should be preferred, see Signer
.