Skip to content

Commit

Permalink
chore: add generic interface for signer class (#6)
Browse files Browse the repository at this point in the history
will make it easier to implement the s3 signer in the s3 lib
  • Loading branch information
wperron authored Sep 29, 2020
1 parent 1e2217f commit f279152
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { sha256Hex } from "./deps.ts";
import { toAmz, toDateStamp } from "./src/date.ts";
export { toAmz, toDateStamp };
import { getSignatureKey, signAwsV4 } from "./src/signing.ts";

/**
* Generic AWS Signer interface
*/
export interface Signer {
sign: (service: string, request: Request) => Promise<Request>;
}

/**
* The AWS credentials to use for signing.
*/
Expand Down Expand Up @@ -32,7 +40,7 @@ export interface Credentials {
* const response = await fetch(req);
* ```
*/
export class AWSSignerV4 {
export class AWSSignerV4 implements Signer {
private region: string;
private credentials: Credentials;

Expand Down

0 comments on commit f279152

Please sign in to comment.