Module

x/aws_api/client/signing.ts>AWSSignerV4

From-scratch Typescript client for accessing AWS APIs
Extremely Popular
Go to Latest
class AWSSignerV4
implements Signer
import { AWSSignerV4 } from "https://dotland.deno.dev/x/aws_api@v0.5.0/client/signing.ts";

This class can be used to create AWS Signature V4 for low-level AWS REST APIs. You can either provide credentials for this API using the options in the constructor, or let them be aquired automatically through environment variables.

Example usage:

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);

Constructors

new
AWSSignerV4(region: string, credentials: Credentials)

Properties

private
credentials: Credentials
private
region: string

Methods

sign(
service: string,
url: URL,
request: Request,
): Promise<Request>

Use this to create the signed headers required to make a call to an AWS API.