Giter Club home page Giter Club logo

aws-signer.cr's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working at Heroku, rebooting databases.
  • ๐Ÿ’ฌ Ask me about ruby, postgres and travelling.
  • ๐Ÿ“ซ How to reach me: [email protected]

aws-signer.cr's People

Contributors

beanieboi avatar gdotdesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aws-signer.cr's Issues

SES SendEmail endpoint failing

I'm trying to make an SES SendEmail request, and it is failing with SignatureDoesNotMatch error. I believe all of my headers and params to be correct. I'm not sure if I'm doing something wrong or if I've encountered a bug.

Here is my script:

SES_HOST = "email.us-west-2.amazonaws.com"

AwsSigner.configure do |config|
  config.access_key = ENV["AWS_ACCESS_KEY"]
  config.secret_key = ENV["AWS_SECRET_KEY"]
  config.region = "us-west-2"
end

params = String.build do |io|
  HTTP::Params.from_hash({
    "Action"                           => "SendEmail",
    "Source"                           => "[email protected]",
    "Destination.ToAddresses.member.1" => "[email protected]",
    "Message.Subject.Data"             => "test",
    "Message.Body.Text.Data"           => "test",
  }).to_s(io)
end

url = "https://#{SES_HOST}?#{params}"
uri = URI.parse(url)
headers = {
  "Host" => SES_HOST,
  "Date" => Time.utc_now.to_s("%Y%m%dT%H%M%SZ"),
}
body = ""

signed = AwsSigner.sign("ses", "GET", uri, headers, body)

headers = HTTP::Headers.new
signed.each do |k, v|
  headers[k] = v
end

resp = HTTP::Client.get(uri, headers, body)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.