@sp-api-sdk/auth
Advanced tools
Comparing version 1.8.1 to 1.8.2
@@ -5,2 +5,1 @@ "use strict"; | ||
tslib_1.__exportStar(require("./src"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.7.4", | ||
"version": "1.8.1", | ||
"main": "dist/cjs/index.js", | ||
@@ -8,0 +8,0 @@ "module": "dist/es/index.js", |
@@ -12,2 +12,1 @@ "use strict"; | ||
exports.AccessTokenError = AccessTokenError; | ||
//# sourceMappingURL=error.js.map |
@@ -55,2 +55,1 @@ "use strict"; | ||
exports.AccessToken = AccessToken; | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,1 @@ "use strict"; | ||
exports.SellingPartnerApiAuthError = SellingPartnerApiAuthError; | ||
//# sourceMappingURL=error.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./security-token-service"), exports); | ||
tslib_1.__exportStar(require("./access-token"), exports); | ||
tslib_1.__exportStar(require("./selling-partner-api-auth"), exports); | ||
tslib_1.__exportStar(require("./error"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,1 @@ "use strict"; | ||
exports.SecurityTokenServiceError = SecurityTokenServiceError; | ||
//# sourceMappingURL=error.js.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
this.secretAccessKey = parameters.secretAccessKey; | ||
this.sessionToken = parameters.sessionToken; | ||
this.role = parameters.role; | ||
@@ -33,3 +34,4 @@ this.region = parameters.region; | ||
accessKeyId: this.accessKeyId, | ||
secretAccessKey: this.secretAccessKey | ||
secretAccessKey: this.secretAccessKey, | ||
sessionToken: this.sessionToken | ||
} | ||
@@ -52,2 +54,1 @@ }; | ||
exports.SecurityTokenService = SecurityTokenService; | ||
//# sourceMappingURL=index.js.map |
@@ -19,10 +19,11 @@ "use strict"; | ||
const secretAccessKey = parameters.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY; | ||
const sessionToken = parameters.sessionToken || process.env.AWS_SESSION_TOKEN; | ||
const region = parameters.region || process.env.AWS_DEFAULT_REGION; | ||
const arn = parameters.role?.arn || process.env.AWS_ROLE_ARN; | ||
const sessionName = parameters.role?.sessionName || process.env.AWS_ROLE_SESSION_NAME || `${package_json_1.default.name.replace('/', '-')}@${package_json_1.default.version}`; | ||
const roleArn = parameters.role?.arn || process.env.AWS_ROLE_ARN; | ||
const roleSessionName = parameters.role?.sessionName || process.env.AWS_ROLE_SESSION_NAME || `${package_json_1.default.name.replace('/', '-')}@${package_json_1.default.version}`; | ||
let role = null; | ||
if (arn) { | ||
if (roleArn) { | ||
role = { | ||
arn, | ||
sessionName | ||
arn: roleArn, | ||
sessionName: roleSessionName | ||
}; | ||
@@ -44,2 +45,3 @@ } | ||
this._secretAccessKey = secretAccessKey; | ||
this._sessionToken = sessionToken; | ||
if (parameters.refreshToken) { | ||
@@ -63,5 +65,6 @@ this.accessToken = new access_token_1.AccessToken({ | ||
if (role) { | ||
this.sts = new security_token_service_1.SecurityTokenService({ | ||
this._sts = new security_token_service_1.SecurityTokenService({ | ||
accessKeyId, | ||
secretAccessKey, | ||
sessionToken, | ||
region, | ||
@@ -76,8 +79,9 @@ role | ||
async getCredentials() { | ||
if (this.sts) { | ||
return this.sts.getCredentials(); | ||
if (this._sts) { | ||
return this._sts.getCredentials(); | ||
} | ||
return { | ||
AccessKeyId: this._accessKeyId, | ||
SecretAccessKey: this._secretAccessKey | ||
SecretAccessKey: this._secretAccessKey, | ||
SessionToken: this._sessionToken | ||
}; | ||
@@ -87,2 +91,1 @@ } | ||
exports.SellingPartnerApiAuth = SellingPartnerApiAuth; | ||
//# sourceMappingURL=selling-partner-api-auth.js.map |
export * from './src'; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.7.4", | ||
"version": "1.8.1", | ||
"main": "dist/cjs/index.js", | ||
@@ -8,0 +8,0 @@ "module": "dist/es/index.js", |
@@ -8,2 +8,1 @@ export class AccessTokenError extends Error { | ||
} | ||
//# sourceMappingURL=error.js.map |
@@ -50,2 +50,1 @@ import got from 'got'; | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,1 @@ export class SellingPartnerApiAuthError extends Error { | ||
} | ||
//# sourceMappingURL=error.js.map |
@@ -1,5 +0,3 @@ | ||
export * from './security-token-service'; | ||
export * from './access-token'; | ||
export * from './selling-partner-api-auth'; | ||
export * from './error'; | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,1 @@ export class SecurityTokenServiceError extends Error { | ||
} | ||
//# sourceMappingURL=error.js.map |
@@ -8,2 +8,3 @@ import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts'; | ||
this.secretAccessKey = parameters.secretAccessKey; | ||
this.sessionToken = parameters.sessionToken; | ||
this.role = parameters.role; | ||
@@ -29,3 +30,4 @@ this.region = parameters.region; | ||
accessKeyId: this.accessKeyId, | ||
secretAccessKey: this.secretAccessKey | ||
secretAccessKey: this.secretAccessKey, | ||
sessionToken: this.sessionToken | ||
} | ||
@@ -47,2 +49,1 @@ }; | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -15,10 +15,11 @@ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ | ||
const secretAccessKey = parameters.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY; | ||
const sessionToken = parameters.sessionToken || process.env.AWS_SESSION_TOKEN; | ||
const region = parameters.region || process.env.AWS_DEFAULT_REGION; | ||
const arn = parameters.role?.arn || process.env.AWS_ROLE_ARN; | ||
const sessionName = parameters.role?.sessionName || process.env.AWS_ROLE_SESSION_NAME || `${pkg.name.replace('/', '-')}@${pkg.version}`; | ||
const roleArn = parameters.role?.arn || process.env.AWS_ROLE_ARN; | ||
const roleSessionName = parameters.role?.sessionName || process.env.AWS_ROLE_SESSION_NAME || `${pkg.name.replace('/', '-')}@${pkg.version}`; | ||
let role = null; | ||
if (arn) { | ||
if (roleArn) { | ||
role = { | ||
arn, | ||
sessionName | ||
arn: roleArn, | ||
sessionName: roleSessionName | ||
}; | ||
@@ -40,2 +41,3 @@ } | ||
this._secretAccessKey = secretAccessKey; | ||
this._sessionToken = sessionToken; | ||
if (parameters.refreshToken) { | ||
@@ -59,5 +61,6 @@ this.accessToken = new AccessToken({ | ||
if (role) { | ||
this.sts = new SecurityTokenService({ | ||
this._sts = new SecurityTokenService({ | ||
accessKeyId, | ||
secretAccessKey, | ||
sessionToken, | ||
region, | ||
@@ -72,11 +75,11 @@ role | ||
async getCredentials() { | ||
if (this.sts) { | ||
return this.sts.getCredentials(); | ||
if (this._sts) { | ||
return this._sts.getCredentials(); | ||
} | ||
return { | ||
AccessKeyId: this._accessKeyId, | ||
SecretAccessKey: this._secretAccessKey | ||
SecretAccessKey: this._secretAccessKey, | ||
SessionToken: this._sessionToken | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=selling-partner-api-auth.js.map |
@@ -1,4 +0,3 @@ | ||
export * from './security-token-service'; | ||
export * from './access-token'; | ||
export * from './selling-partner-api-auth'; | ||
export * from './error'; |
@@ -10,2 +10,3 @@ import { Credentials } from '@aws-sdk/client-sts'; | ||
secretAccessKey: string; | ||
sessionToken?: string; | ||
role: Role; | ||
@@ -17,2 +18,3 @@ region?: string; | ||
readonly secretAccessKey: string; | ||
readonly sessionToken?: string; | ||
readonly role: Role; | ||
@@ -19,0 +21,0 @@ readonly region?: string; |
import { Credentials } from '@aws-sdk/client-sts'; | ||
import { RequireExactlyOne, SetOptional } from 'type-fest'; | ||
import { AccessToken, AuthorizationScope } from './access-token'; | ||
import { SecurityTokenService } from './security-token-service'; | ||
export interface SellingPartnerAuthParameters { | ||
@@ -12,2 +11,3 @@ clientId?: string; | ||
secretAccessKey?: string; | ||
sessionToken?: string; | ||
region?: string; | ||
@@ -24,5 +24,6 @@ role?: { | ||
readonly accessToken: AccessToken; | ||
readonly sts?: SecurityTokenService; | ||
private readonly _sts?; | ||
private readonly _accessKeyId; | ||
private readonly _secretAccessKey; | ||
private readonly _sessionToken?; | ||
constructor(parameters: RequireExactlyOne<SellingPartnerAuthParameters, 'refreshToken' | 'scopes'>); | ||
@@ -29,0 +30,0 @@ /** |
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"main": "dist/cjs/index.js", | ||
@@ -52,3 +52,3 @@ "module": "dist/es/index.js", | ||
], | ||
"gitHead": "79a5c1796b6db99dda7406568eeea7dfd0b6061c" | ||
"gitHead": "b8208eb5ff84ae955289210a7d5e405eb57c6a38" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
529
126376
31
16