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

@trivikr-test/signature-v4

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/signature-v4 - npm Package Compare versions

Comparing version 3.170.0-es2019 to 3.170.0-es2020

2

dist-es/getCanonicalHeaders.js

@@ -10,3 +10,3 @@ import { ALWAYS_UNSIGNABLE_HEADERS, PROXY_HEADER_PATTERN, SEC_HEADER_PATTERN } from "./constants";

if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||
(unsignableHeaders === null || unsignableHeaders === void 0 ? void 0 : unsignableHeaders.has(canonicalHeaderName)) ||
unsignableHeaders?.has(canonicalHeaderName) ||
PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||

@@ -13,0 +13,0 @@ SEC_HEADER_PATTERN.test(canonicalHeaderName)) {

import { cloneRequest } from "./cloneRequest";
export const moveHeadersToQuery = (request, options = {}) => {
var _a;
const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : cloneRequest(request);
for (const name of Object.keys(headers)) {
const lname = name.toLowerCase();
if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) === null || _a === void 0 ? void 0 : _a.has(lname))) {
if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname)) {
query[name] = headers[name];

@@ -9,0 +8,0 @@ delete headers[name];

@@ -25,3 +25,3 @@ import { toHex } from "@trivikr-test/util-hex-encoding";

this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());
const region = signingRegion ?? (await this.regionProvider());
const { longDate, shortDate } = formatDate(signingDate);

@@ -31,3 +31,3 @@ if (expiresIn > MAX_PRESIGNED_TTL) {

}
const scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);
const scope = createScope(shortDate, region, signingService ?? this.service);
const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders });

@@ -58,5 +58,5 @@ if (credentials.sessionToken) {

async signEvent({ headers, payload }, { signingDate = new Date(), priorSignature, signingRegion, signingService }) {
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());
const region = signingRegion ?? (await this.regionProvider());
const { shortDate, longDate } = formatDate(signingDate);
const scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);
const scope = createScope(shortDate, region, signingService ?? this.service);
const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);

@@ -79,3 +79,3 @@ const hash = new this.sha256();

this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());
const region = signingRegion ?? (await this.regionProvider());
const { shortDate } = formatDate(signingDate);

@@ -89,6 +89,6 @@ const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));

this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());
const region = signingRegion ?? (await this.regionProvider());
const request = prepareRequest(requestToSign);
const { longDate, shortDate } = formatDate(signingDate);
const scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);
const scope = createScope(shortDate, region, signingService ?? this.service);
request.headers[AMZ_DATE_HEADER] = longDate;

@@ -134,3 +134,3 @@ if (credentials.sessionToken) {

for (const pathSegment of path.split("/")) {
if ((pathSegment === null || pathSegment === void 0 ? void 0 : pathSegment.length) === 0)
if (pathSegment?.length === 0)
continue;

@@ -146,3 +146,3 @@ if (pathSegment === ".")

}
const normalizedPath = `${(path === null || path === void 0 ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path === null || path === void 0 ? void 0 : path.endsWith("/")) ? "/" : ""}`;
const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
const doubleEncoded = encodeURIComponent(normalizedPath);

@@ -149,0 +149,0 @@ return doubleEncoded.replace(/%2F/g, "/");

{
"name": "@trivikr-test/signature-v4",
"version": "3.170.0-es2019",
"version": "3.170.0-es2020",
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm",

@@ -24,7 +24,7 @@ "main": "./dist-cjs/index.js",

"dependencies": {
"@trivikr-test/is-array-buffer": "3.170.0-es2019",
"@trivikr-test/types": "3.170.0-es2019",
"@trivikr-test/util-hex-encoding": "3.170.0-es2019",
"@trivikr-test/util-middleware": "3.170.0-es2019",
"@trivikr-test/util-uri-escape": "3.170.0-es2019",
"@trivikr-test/is-array-buffer": "3.170.0-es2020",
"@trivikr-test/types": "3.170.0-es2020",
"@trivikr-test/util-hex-encoding": "3.170.0-es2020",
"@trivikr-test/util-middleware": "3.170.0-es2020",
"@trivikr-test/util-uri-escape": "3.170.0-es2020",
"tslib": "^2.3.1"

@@ -34,4 +34,4 @@ },

"@aws-crypto/sha256-js": "2.0.0",
"@trivikr-test/protocol-http": "3.170.0-es2019",
"@trivikr-test/util-buffer-from": "3.170.0-es2019",
"@trivikr-test/protocol-http": "3.170.0-es2020",
"@trivikr-test/util-buffer-from": "3.170.0-es2020",
"@tsconfig/recommended": "1.0.1",

@@ -38,0 +38,0 @@ "concurrently": "7.0.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