class AWSSignerV4
implements Signer
import { AWSSignerV4 } from "https://deno.land/x/s3@0.5.0/deps.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)If no region or credentials are specified, they will automatically be aquired from environment variables.
Region is aquired from AWS_REGION
. The credentials
are acquired from AWS_ACCESS_KEY_ID
,
AWS_SECRET_ACCESS_KEY
and AWS_SESSION_TOKEN
.
Properties
private
credentials: Credentials