class AWS::Signer

Overview

A Signer can sign a HTTP request using AWS4-HMAC-SHA256 as outlined by: https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html Signers are generally only used once, and they are scoped to the region, AWS service, AWS credentials, and a point in time.

Defined in:

aws/signer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(region : String, service : String, creds : Credentials, time : Time = Time.utc) #

Creates a new AWS V4 signer for the given region and service with the given credentials, valid at the given time.


[View source]
def self.new(region : String, service : String, key : String, secret : String, token : Nil | String = nil, time : Time = Time.utc) #

Creates a new AWS V4 signer for the given region and service with the given AWS AccessKeyId and SecretAccessKey, valid at the given time.


[View source]

Instance Method Detail

def sign(payload : String) : String #

Gets a signature for the given payload, as per


[View source]
def sign(request : HTTP::Request) : String #

Gets a signature for a payload extracted from the given request, as per docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html


[View source]
def sign!(request : HTTP::Request) #

Signs the given request - if it's a GET request, then it will add the signature as a query parameter; if it's a POST request, it will add the signature to the Authorization header.


[View source]