Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trivikr-test/middleware-signing

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trivikr-test/middleware-signing - npm Package Compare versions

Comparing version 3.170.0-es2016 to 3.170.0-es2017

17

dist-es/configurations.js

@@ -1,2 +0,1 @@

import { __awaiter } from "tslib";
import { memoize } from "@trivikr-test/property-provider";

@@ -16,11 +15,9 @@ import { SignatureV4 } from "@trivikr-test/signature-v4";

signer = () => normalizeProvider(input.region)()
.then((region) => __awaiter(void 0, void 0, void 0, function* () {
return [
(yield input.regionInfoProvider(region, {
useFipsEndpoint: yield input.useFipsEndpoint(),
useDualstackEndpoint: yield input.useDualstackEndpoint(),
})) || {},
region,
];
}))
.then(async (region) => [
(await input.regionInfoProvider(region, {
useFipsEndpoint: await input.useFipsEndpoint(),
useDualstackEndpoint: await input.useDualstackEndpoint(),
})) || {},
region,
])
.then(([regionInfo, region]) => {

@@ -27,0 +24,0 @@ const { signingRegion, signingService } = regionInfo;

@@ -1,28 +0,25 @@

import { __awaiter } from "tslib";
import { HttpRequest, HttpResponse } from "@trivikr-test/protocol-http";
import { getSkewCorrectedDate } from "./utils/getSkewCorrectedDate";
import { getUpdatedSystemClockOffset } from "./utils/getUpdatedSystemClockOffset";
export const awsAuthMiddleware = (options) => (next, context) => function (args) {
return __awaiter(this, void 0, void 0, function* () {
if (!HttpRequest.isInstance(args.request))
return next(args);
const signer = yield options.signer();
const output = yield next(Object.assign(Object.assign({}, args), { request: yield signer.sign(args.request, {
signingDate: getSkewCorrectedDate(options.systemClockOffset),
signingRegion: context["signing_region"],
signingService: context["signing_service"],
}) })).catch((error) => {
var _a;
const serverTime = (_a = error.ServerTime) !== null && _a !== void 0 ? _a : getDateHeader(error.$response);
if (serverTime) {
options.systemClockOffset = getUpdatedSystemClockOffset(serverTime, options.systemClockOffset);
}
throw error;
});
const dateHeader = getDateHeader(output.response);
if (dateHeader) {
options.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, options.systemClockOffset);
export const awsAuthMiddleware = (options) => (next, context) => async function (args) {
if (!HttpRequest.isInstance(args.request))
return next(args);
const signer = await options.signer();
const output = await next(Object.assign(Object.assign({}, args), { request: await signer.sign(args.request, {
signingDate: getSkewCorrectedDate(options.systemClockOffset),
signingRegion: context["signing_region"],
signingService: context["signing_service"],
}) })).catch((error) => {
var _a;
const serverTime = (_a = error.ServerTime) !== null && _a !== void 0 ? _a : getDateHeader(error.$response);
if (serverTime) {
options.systemClockOffset = getUpdatedSystemClockOffset(serverTime, options.systemClockOffset);
}
return output;
throw error;
});
const dateHeader = getDateHeader(output.response);
if (dateHeader) {
options.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, options.systemClockOffset);
}
return output;
};

@@ -29,0 +26,0 @@ const getDateHeader = (response) => { var _a, _b, _c; return HttpResponse.isInstance(response) ? (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : (_c = response.headers) === null || _c === void 0 ? void 0 : _c.Date : undefined; };

{
"name": "@trivikr-test/middleware-signing",
"version": "3.170.0-es2016",
"version": "3.170.0-es2017",
"scripts": {

@@ -23,6 +23,6 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@trivikr-test/property-provider": "3.170.0-es2016",
"@trivikr-test/protocol-http": "3.170.0-es2016",
"@trivikr-test/signature-v4": "3.170.0-es2016",
"@trivikr-test/types": "3.170.0-es2016",
"@trivikr-test/property-provider": "3.170.0-es2017",
"@trivikr-test/protocol-http": "3.170.0-es2017",
"@trivikr-test/signature-v4": "3.170.0-es2017",
"@trivikr-test/types": "3.170.0-es2017",
"tslib": "^2.3.1"

@@ -29,0 +29,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc