diff --git a/types/vault-auth-aws/index.d.ts b/types/vault-auth-aws/index.d.ts new file mode 100644 index 0000000000..f5f378122a --- /dev/null +++ b/types/vault-auth-aws/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for vault-auth-aws 0.1 +// Project: https://github.com/abdullahshahin/vault-auth-aws +// Definitions by: Nathan McGinn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.7 +/// + +declare class vaultAuthAws { + constructor(config?: vaultAuthAws.Config); + authenticate(): Promise; + getOptions(creds: vaultAuthAws.Creds): vaultAuthAws.Options; +} + +declare namespace vaultAuthAws { + interface Config { + ssl?: boolean; + host?: string; + port?: number; + apiVersion?: string; + vaultLoginUrl?: string; + vaultAppName?: string; + followAllRedirects?: boolean; + certFilePath?: string; + sslRejectUnAuthorized?: boolean; + } + + interface Creds { + accessKeyId?: string; + secretAccessKey?: string; + sessionToken?: string; + } + + interface Options { + url: string; + followAllRedirects: boolean; + body: string; + cert?: Buffer; + } +} + +export = vaultAuthAws; diff --git a/types/vault-auth-aws/tsconfig.json b/types/vault-auth-aws/tsconfig.json new file mode 100644 index 0000000000..e362f48737 --- /dev/null +++ b/types/vault-auth-aws/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vault-auth-aws-tests.ts" + ] +} \ No newline at end of file diff --git a/types/vault-auth-aws/tslint.json b/types/vault-auth-aws/tslint.json new file mode 100644 index 0000000000..160645963f --- /dev/null +++ b/types/vault-auth-aws/tslint.json @@ -0,0 +1 @@ +{"extends":"dtslint/dt.json"} \ No newline at end of file diff --git a/types/vault-auth-aws/vault-auth-aws-tests.ts b/types/vault-auth-aws/vault-auth-aws-tests.ts new file mode 100644 index 0000000000..b42d29cdc8 --- /dev/null +++ b/types/vault-auth-aws/vault-auth-aws-tests.ts @@ -0,0 +1,24 @@ +import vaultAuthAws = require('vault-auth-aws'); + +const config: vaultAuthAws.Config = { + ssl: false, + host: 'localhost', + port: 3000, + apiVersion: 'v1', + vaultLoginUrl: 'auth/aws/login', + vaultAppName: '', + followAllRedirects: true, + certFilePath: undefined, + sslRejectUnAuthorized: true +}; + +const creds: vaultAuthAws.Creds = { + accessKeyId: '', + secretAccessKey: '', + sessionToken: '' +}; + +const vault = new vaultAuthAws(config); + +vault.getOptions(creds); +Promise.resolve(vault.authenticate());