Giter Club home page Giter Club logo

deno_aws_sign_v4's Introduction

deno_aws_sign_v4

ci deno doc

Generates AWS Signature V4 for AWS low-level REST APIs.

Example

The below example will generate signed headers based on the region and credentials in following ENV variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN
  • AWS_REGION
import { AWSSignerV4 } from "https://deno.land/x/[email protected]/mod.ts";

const signer = new AWSSignerV4();
const body = new TextEncoder().encode("Hello World!");
const request = new Request("https://test-bucket.s3.amazonaws.com/test", {
  method: "PUT",
  headers: { "content-length": body.length.toString() },
  body,
});
const req = await signer.sign("s3", request);

const response = await fetch(req);

You can also explicitly specify credentials and a region when constructing a new AWSSignerV4:

const signer = new AWSSignerV4("us-east-1", {
  awsAccessKeyId: "accesskey";
  awsSecretKey: "secretkey";
  sessionToken: "sessiontoken";
});

Related projects


The module is licenced under GPL-3.0. For more see the LICENCE file.

This module is forked from @silver-xu's work in [https://github.com/silver-xu/deno-aws-sign-v4]. Many thanks to them. This fork has some large feature improvements and bug fixes, and has tests.

deno_aws_sign_v4's People

Contributors

danopia avatar lucacasonato avatar silver-xu avatar wperron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

deno_aws_sign_v4's Issues

Issues when running in deno deploy

I am getting this error when running deploying to deploy (not present when running locally in deployctl) probably because of the fetch rewrite of 1.9.1:

❗️    TypeError: This property is not implemented.
    at Request.get cache (deno:op_crates/fetch/23_request.js:343:13)
    at AWSSignerV4.sign (https://deno.land/x/[email protected]/mod.ts:86:28)
    at S3Bucket._doRequest (https://deno.land/x/[email protected]/src/bucket.ts:26:50)
    at S3Bucket.getObject (https://deno.land/x/[email protected]/src/bucket.ts:152:32)
    at unknownHandler (https://raw.githubusercontent.com/denosaurs/crux.land/9069446ebf0b9fe1ab17f61e72d595a4e31a64f0/main.ts:40:35)
    at https://raw.githubusercontent.com/denosaurs/crux.land/9069446ebf0b9fe1ab17f61e72d595a4e31a64f0/util/router.ts:7:24
    at https://raw.githubusercontent.com/denosaurs/crux.land/9069446ebf0b9fe1ab17f61e72d595a4e31a64f0/main.ts:82:7
    at innerInvokeEventListeners (deno:op_crates/web/02_event.js:750:27)
    at invokeEventListeners (deno:op_crates/web/02_event.js:785:5)
    at dispatch (deno:op_crates/web/02_event.js:660:11)

This could technically also be an issue with s3.

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.