Skip to content

Commit f279152

Browse files
authored
chore: add generic interface for signer class (#6)
will make it easier to implement the s3 signer in the s3 lib
1 parent 1e2217f commit f279152

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mod.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import { sha256Hex } from "./deps.ts";
22
import { toAmz, toDateStamp } from "./src/date.ts";
3+
export { toAmz, toDateStamp };
34
import { getSignatureKey, signAwsV4 } from "./src/signing.ts";
45

6+
/**
7+
* Generic AWS Signer interface
8+
*/
9+
export interface Signer {
10+
sign: (service: string, request: Request) => Promise<Request>;
11+
}
12+
513
/**
614
* The AWS credentials to use for signing.
715
*/
@@ -32,7 +40,7 @@ export interface Credentials {
3240
* const response = await fetch(req);
3341
* ```
3442
*/
35-
export class AWSSignerV4 {
43+
export class AWSSignerV4 implements Signer {
3644
private region: string;
3745
private credentials: Credentials;
3846

0 commit comments

Comments
 (0)