diff --git a/client.go b/client.go index 85e4932..9dee609 100644 --- a/client.go +++ b/client.go @@ -62,11 +62,18 @@ func (c *Client) V0() *client.TurnkeyAPI { type Authenticator struct { // Key optionally overrides the globally-parsed APIKeypair with a custom key. Key *apikey.Key + + // Optionally add headers to each request + Headers map[string]string } // AuthenticateRequest implements runtime.ClientAuthInfoWriter. // It adds the X-Stamp header to the request based by generating the Stamp with the request body and API key. func (auth *Authenticator) AuthenticateRequest(req runtime.ClientRequest, reg strfmt.Registry) (err error) { //nolint: revive + for k, v := range auth.Headers { + req.SetHeaderParam(k, v) + } + stamp, err := apikey.Stamp(req.GetBody(), auth.Key) if err != nil { return errors.Wrap(err, "failed to generate API stamp")