From 9bd46111d65f3ffcf0ae22cfd6d928e1ad2cc9d0 Mon Sep 17 00:00:00 2001 From: Andrew Crites Date: Thu, 10 Nov 2016 19:54:21 -0500 Subject: [PATCH] Add aws4 type definitions --- aws4/aws4-tests.ts | 24 ++++++++++++++++++++++++ aws4/index.d.ts | 33 +++++++++++++++++++++++++++++++++ aws4/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 aws4/aws4-tests.ts create mode 100644 aws4/index.d.ts create mode 100644 aws4/tsconfig.json diff --git a/aws4/aws4-tests.ts b/aws4/aws4-tests.ts new file mode 100644 index 0000000000..b611951e45 --- /dev/null +++ b/aws4/aws4-tests.ts @@ -0,0 +1,24 @@ +/// + +import * as aws4 from "."; + +let requestSigner = new aws4.RequestSigner({}, {}); +requestSigner.matchHost(""); +requestSigner.isSingleRegion(); +requestSigner.createHost(); +requestSigner.prepareRequest(); +requestSigner.sign(); +requestSigner.getDateTime(); +requestSigner.getDate(); +requestSigner.authHeader(); +requestSigner.signature(); +requestSigner.stringToSign(); +requestSigner.canonicalString(); +requestSigner.canonicalHeaders(); +requestSigner.signedHeaders(); +requestSigner.credentialString(); +requestSigner.defaultCredentials(); +requestSigner.parsePath(); +requestSigner.formatPath(); + +aws4.sign({}, {}); diff --git a/aws4/index.d.ts b/aws4/index.d.ts new file mode 100644 index 0000000000..88f54f2a3f --- /dev/null +++ b/aws4/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for aws4 1.5.0 +// Project: https://github.com/mhart/aws4 +// Definitions by: Andrew Crites +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class RequestSigner { + constructor(request?: any, credentials?: any); + request: any; + credentials: any; + service: any; + region: any; + isCodeCommitGit: any; + + matchHost(host?: string): string; + isSingleRegion(): boolean; + createHost(): string; + prepareRequest(): void; + sign(): any; + getDateTime(): string; + getDate(): string; + authHeader(): string; + signature(): string; + stringToSign(): string; + canonicalString(): string; + canonicalHeaders(): string; + signedHeaders(): string; + credentialString(): string; + defaultCredentials(): any; + parsePath(): any; + formatPath(): string; +} + +export function sign(options?: any, credentials?: any): RequestSigner; diff --git a/aws4/tsconfig.json b/aws4/tsconfig.json new file mode 100644 index 0000000000..fb9528a526 --- /dev/null +++ b/aws4/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aws4-tests.ts" + ] +}