pub struct Signer<'a> { /* private fields */ }
Expand description

Builder to generate a Tl-Signature header value using a private key.

See crate::sign_with_pem for examples.

Implementations

Add the full request body.

Note: This must be identical to what is sent with the request.

Example
truelayer_signing::sign_with_pem(kid, key)
    .body(b"{...}");

Add the request method, defaults to "POST" if unspecified.

Example
truelayer_signing::sign_with_pem(kid, key)
    .method("POST");

Add the request absolute path starting with a leading / and without any trailing slashes.

Panics

If path does not start with a ‘/’ char.

Example
truelayer_signing::sign_with_pem(kid, key)
    .path("/payouts");

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.

Example
truelayer_signing::sign_with_pem(kid, key)
    .header("Idempotency-Key", b"60df4d00-9778-4297-be6d-817d7a6d27bb");

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.

Example
signer.add_header("Idempotency-Key", b"60df4d00-9778-4297-be6d-817d7a6d27bb");

Appends multiple header names & values.

Warning: Only a single value per header name is supported.

Example
truelayer_signing::sign_with_pem(kid, key)
    .headers([("X-Head-A", "123".as_bytes()), ("X-Head-B", "345".as_bytes())]);

Sets the jws header jku JSON Web Key URL.

Note: This is not generally required when calling APIs, but is set on webhook signatures.

Produce a JWS Tl-Signature v1 header value, signing just the request body.

Any specified method, path & headers will be ignored.

In general full request signing should be preferred, see Signer::sign.

Produce a JWS Tl-Signature v2 header value.

Trait Implementations

Debug does not display key info.

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.