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.58.0 to 3.170.0

2

dist-cjs/credentialDerivation.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearCredentialCache = exports.getSigningKey = exports.createScope = void 0;
const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
const util_hex_encoding_1 = require("@trivikr-test/util-hex-encoding");
const constants_1 = require("./constants");

@@ -6,0 +6,0 @@ const signingKeyCache = {};

@@ -8,2 +8,5 @@ "use strict";

for (const headerName of Object.keys(headers).sort()) {
if (headers[headerName] == undefined) {
continue;
}
const canonicalHeaderName = headerName.toLowerCase();

@@ -10,0 +13,0 @@ if (canonicalHeaderName in constants_1.ALWAYS_UNSIGNABLE_HEADERS ||

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCanonicalQuery = void 0;
const util_uri_escape_1 = require("@aws-sdk/util-uri-escape");
const util_uri_escape_1 = require("@trivikr-test/util-uri-escape");
const constants_1 = require("./constants");

@@ -6,0 +6,0 @@ const getCanonicalQuery = ({ query = {} }) => {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPayloadHash = void 0;
const is_array_buffer_1 = require("@aws-sdk/is-array-buffer");
const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
const is_array_buffer_1 = require("@trivikr-test/is-array-buffer");
const util_hex_encoding_1 = require("@trivikr-test/util-hex-encoding");
const constants_1 = require("./constants");

@@ -7,0 +7,0 @@ const getPayloadHash = async ({ headers, body }, hashConstructor) => {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignatureV4 = void 0;
const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
const util_middleware_1 = require("@aws-sdk/util-middleware");
const util_hex_encoding_1 = require("@trivikr-test/util-hex-encoding");
const util_middleware_1 = require("@trivikr-test/util-middleware");
const constants_1 = require("./constants");

@@ -27,2 +27,3 @@ const credentialDerivation_1 = require("./credentialDerivation");

const credentials = await this.credentialProvider();
this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());

@@ -78,2 +79,3 @@ const { longDate, shortDate } = formatDate(signingDate);

const credentials = await this.credentialProvider();
this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());

@@ -87,2 +89,3 @@ const { shortDate } = formatDate(signingDate);

const credentials = await this.credentialProvider();
this.validateResolvedCredentials(credentials);
const region = signingRegion !== null && signingRegion !== void 0 ? signingRegion : (await this.regionProvider());

@@ -158,2 +161,9 @@ const request = (0, prepareRequest_1.prepareRequest)(requestToSign);

}
validateResolvedCredentials(credentials) {
if (typeof credentials !== "object" ||
typeof credentials.accessKeyId !== "string" ||
typeof credentials.secretAccessKey !== "string") {
throw new Error("Resolved credential object is not valid");
}
}
}

@@ -160,0 +170,0 @@ exports.SignatureV4 = SignatureV4;

import { __awaiter, __generator, __values } from "tslib";
import { toHex } from "@aws-sdk/util-hex-encoding";
import { toHex } from "@trivikr-test/util-hex-encoding";
import { KEY_TYPE_IDENTIFIER, MAX_CACHE_SIZE } from "./constants";

@@ -4,0 +4,0 @@ var signingKeyCache = {};

@@ -10,2 +10,5 @@ import { __values } from "tslib";

var headerName = _d.value;
if (headers[headerName] == undefined) {
continue;
}
var canonicalHeaderName = headerName.toLowerCase();

@@ -12,0 +15,0 @@ if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||

import { __values } from "tslib";
import { escapeUri } from "@aws-sdk/util-uri-escape";
import { escapeUri } from "@trivikr-test/util-uri-escape";
import { SIGNATURE_HEADER } from "./constants";

@@ -4,0 +4,0 @@ export var getCanonicalQuery = function (_a) {

import { __awaiter, __generator, __values } from "tslib";
import { isArrayBuffer } from "@aws-sdk/is-array-buffer";
import { toHex } from "@aws-sdk/util-hex-encoding";
import { isArrayBuffer } from "@trivikr-test/is-array-buffer";
import { toHex } from "@trivikr-test/util-hex-encoding";
import { SHA256_HEADER, UNSIGNED_PAYLOAD } from "./constants";

@@ -5,0 +5,0 @@ export var getPayloadHash = function (_a, hashConstructor) {

@@ -10,7 +10,7 @@ import { __assign, __values } from "tslib";

for (var _e = __values(Object.keys(headers)), _f = _e.next(); !_f.done; _f = _e.next()) {
var name = _f.value;
var lname = name.toLowerCase();
var name_1 = _f.value;
var lname = name_1.toLowerCase();
if (lname.slice(0, 6) === "x-amz-" && !((_b = options.unhoistableHeaders) === null || _b === void 0 ? void 0 : _b.has(lname))) {
query[name] = headers[name];
delete headers[name];
query[name_1] = headers[name_1];
delete headers[name_1];
}

@@ -17,0 +17,0 @@ }

import { __awaiter, __generator, __values } from "tslib";
import { toHex } from "@aws-sdk/util-hex-encoding";
import { normalizeProvider } from "@aws-sdk/util-middleware";
import { toHex } from "@trivikr-test/util-hex-encoding";
import { normalizeProvider } from "@trivikr-test/util-middleware";
import { ALGORITHM_IDENTIFIER, ALGORITHM_QUERY_PARAM, AMZ_DATE_HEADER, AMZ_DATE_QUERY_PARAM, AUTH_HEADER, CREDENTIAL_QUERY_PARAM, EVENT_ALGORITHM_IDENTIFIER, EXPIRES_QUERY_PARAM, MAX_PRESIGNED_TTL, SHA256_HEADER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_HEADER, TOKEN_QUERY_PARAM, } from "./constants";

@@ -34,2 +34,3 @@ import { createScope, getSigningKey } from "./credentialDerivation";

credentials = _l.sent();
this.validateResolvedCredentials(credentials);
if (!(signingRegion !== null && signingRegion !== void 0)) return [3, 2];

@@ -142,2 +143,3 @@ _c = signingRegion;

credentials = _h.sent();
this.validateResolvedCredentials(credentials);
if (!(signingRegion !== null && signingRegion !== void 0)) return [3, 2];

@@ -174,2 +176,3 @@ _d = signingRegion;

credentials = _f.sent();
this.validateResolvedCredentials(credentials);
if (!(signingRegion !== null && signingRegion !== void 0)) return [3, 2];

@@ -287,2 +290,9 @@ _d = signingRegion;

};
SignatureV4.prototype.validateResolvedCredentials = function (credentials) {
if (typeof credentials !== "object" ||
typeof credentials.accessKeyId !== "string" ||
typeof credentials.secretAccessKey !== "string") {
throw new Error("Resolved credential object is not valid");
}
};
return SignatureV4;

@@ -289,0 +299,0 @@ }());

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

import { HttpRequest, QueryParameterBag } from "@aws-sdk/types";
import { HttpRequest, QueryParameterBag } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @internal

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

import { Credentials, HashConstructor } from "@aws-sdk/types";
import { Credentials, HashConstructor } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * Create a string describing the scope of credentials used to sign a request.

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

import { HeaderBag, HttpRequest } from "@aws-sdk/types";
import { HeaderBag, HttpRequest } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @private

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

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @private

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

import { HashConstructor, HttpRequest } from "@aws-sdk/types";
import { HashConstructor, HttpRequest } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @private

@@ -1,4 +0,4 @@

import { HeaderBag } from "@aws-sdk/types";
import { HeaderBag } from "@trivikr-test/types";
export declare const hasHeader: (soughtHeader: string, headers: HeaderBag) => boolean;
export declare const getHeaderValue: (soughtHeader: string, headers: HeaderBag) => string | undefined;
export declare const deleteHeader: (soughtHeader: string, headers: HeaderBag) => void;

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

import { HttpRequest, QueryParameterBag } from "@aws-sdk/types";
import { HttpRequest, QueryParameterBag } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @private

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

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
/**

@@ -3,0 +3,0 @@ * @private

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

import { Credentials, EventSigner, EventSigningArguments, FormattedEvent, HashConstructor, HttpRequest, Provider, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SigningArguments, StringSigner } from "@aws-sdk/types";
import { Credentials, EventSigner, EventSigningArguments, FormattedEvent, HashConstructor, HttpRequest, Provider, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SigningArguments, StringSigner } from "@trivikr-test/types";
export interface SignatureV4Init {

@@ -63,2 +63,3 @@ /**

private getSigningKey;
private validateResolvedCredentials;
}

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

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
export interface TestCase {

@@ -3,0 +3,0 @@ name: string;

@@ -1,4 +0,10 @@

import { HttpRequest, QueryParameterBag } from "@aws-sdk/types";
import { HttpRequest, QueryParameterBag } from "@trivikr-test/types";
export declare const cloneRequest: ({ headers, query, ...rest }: HttpRequest) => HttpRequest;
export declare const cloneQuery: (query: QueryParameterBag) => QueryParameterBag;
export declare const cloneRequest: ({
headers,
query,
...rest
}: HttpRequest) => HttpRequest;
export declare const cloneQuery: (
query: QueryParameterBag
) => QueryParameterBag;

@@ -18,17 +18,17 @@ export declare const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";

export declare const ALWAYS_UNSIGNABLE_HEADERS: {
authorization: boolean;
"cache-control": boolean;
connection: boolean;
expect: boolean;
from: boolean;
"keep-alive": boolean;
"max-forwards": boolean;
pragma: boolean;
referer: boolean;
te: boolean;
trailer: boolean;
"transfer-encoding": boolean;
upgrade: boolean;
"user-agent": boolean;
"x-amzn-trace-id": boolean;
authorization: boolean;
"cache-control": boolean;
connection: boolean;
expect: boolean;
from: boolean;
"keep-alive": boolean;
"max-forwards": boolean;
pragma: boolean;
referer: boolean;
te: boolean;
trailer: boolean;
"transfer-encoding": boolean;
upgrade: boolean;
"user-agent": boolean;
"x-amzn-trace-id": boolean;
};

@@ -35,0 +35,0 @@ export declare const PROXY_HEADER_PATTERN: RegExp;

@@ -1,7 +0,17 @@

import { Credentials, HashConstructor } from "@aws-sdk/types";
import { Credentials, HashConstructor } from "@trivikr-test/types";
export declare const createScope: (shortDate: string, region: string, service: string) => string;
export declare const createScope: (
shortDate: string,
region: string,
service: string
) => string;
export declare const getSigningKey: (sha256Constructor: HashConstructor, credentials: Credentials, shortDate: string, region: string, service: string) => Promise<Uint8Array>;
export declare const getSigningKey: (
sha256Constructor: HashConstructor,
credentials: Credentials,
shortDate: string,
region: string,
service: string
) => Promise<Uint8Array>;
export declare const clearCredentialCache: () => void;

@@ -1,3 +0,7 @@

import { HeaderBag, HttpRequest } from "@aws-sdk/types";
import { HeaderBag, HttpRequest } from "@trivikr-test/types";
export declare const getCanonicalHeaders: ({ headers }: HttpRequest, unsignableHeaders?: Set<string> | undefined, signableHeaders?: Set<string> | undefined) => HeaderBag;
export declare const getCanonicalHeaders: (
{ headers }: HttpRequest,
unsignableHeaders?: Set<string> | undefined,
signableHeaders?: Set<string> | undefined
) => HeaderBag;

@@ -1,3 +0,3 @@

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
export declare const getCanonicalQuery: ({ query }: HttpRequest) => string;

@@ -1,3 +0,6 @@

import { HashConstructor, HttpRequest } from "@aws-sdk/types";
import { HashConstructor, HttpRequest } from "@trivikr-test/types";
export declare const getPayloadHash: ({ headers, body }: HttpRequest, hashConstructor: HashConstructor) => Promise<string>;
export declare const getPayloadHash: (
{ headers, body }: HttpRequest,
hashConstructor: HashConstructor
) => Promise<string>;

@@ -1,4 +0,13 @@

import { HeaderBag } from "@aws-sdk/types";
export declare const hasHeader: (soughtHeader: string, headers: HeaderBag) => boolean;
export declare const getHeaderValue: (soughtHeader: string, headers: HeaderBag) => string | undefined;
export declare const deleteHeader: (soughtHeader: string, headers: HeaderBag) => void;
import { HeaderBag } from "@trivikr-test/types";
export declare const hasHeader: (
soughtHeader: string,
headers: HeaderBag
) => boolean;
export declare const getHeaderValue: (
soughtHeader: string,
headers: HeaderBag
) => string | undefined;
export declare const deleteHeader: (
soughtHeader: string,
headers: HeaderBag
) => void;

@@ -0,0 +0,0 @@ export * from "./SignatureV4";

@@ -1,7 +0,10 @@

import { HttpRequest, QueryParameterBag } from "@aws-sdk/types";
import { HttpRequest, QueryParameterBag } from "@trivikr-test/types";
export declare const moveHeadersToQuery: (request: HttpRequest, options?: {
export declare const moveHeadersToQuery: (
request: HttpRequest,
options?: {
unhoistableHeaders?: Set<string>;
}) => HttpRequest & {
query: QueryParameterBag;
}
) => HttpRequest & {
query: QueryParameterBag;
};

@@ -1,3 +0,3 @@

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
export declare const prepareRequest: (request: HttpRequest) => HttpRequest;

@@ -1,39 +0,68 @@

import { Credentials, EventSigner, EventSigningArguments, FormattedEvent, HashConstructor, HttpRequest, Provider, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SigningArguments, StringSigner } from "@aws-sdk/types";
import {
Credentials,
EventSigner,
EventSigningArguments,
FormattedEvent,
HashConstructor,
HttpRequest,
Provider,
RequestPresigner,
RequestPresigningArguments,
RequestSigner,
RequestSigningArguments,
SigningArguments,
StringSigner,
} from "@trivikr-test/types";
export interface SignatureV4Init {
service: string;
region: string | Provider<string>;
credentials: Credentials | Provider<Credentials>;
sha256?: HashConstructor;
uriEscapePath?: boolean;
applyChecksum?: boolean;
service: string;
region: string | Provider<string>;
credentials: Credentials | Provider<Credentials>;
sha256?: HashConstructor;
uriEscapePath?: boolean;
applyChecksum?: boolean;
}
export interface SignatureV4CryptoInit {
sha256: HashConstructor;
sha256: HashConstructor;
}
export declare class SignatureV4 implements RequestPresigner, RequestSigner, StringSigner, EventSigner {
private readonly service;
private readonly regionProvider;
private readonly credentialProvider;
private readonly sha256;
private readonly uriEscapePath;
private readonly applyChecksum;
constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath, }: SignatureV4Init & SignatureV4CryptoInit);
presign(originalRequest: HttpRequest, options?: RequestPresigningArguments): Promise<HttpRequest>;
sign(stringToSign: string, options?: SigningArguments): Promise<string>;
sign(event: FormattedEvent, options: EventSigningArguments): Promise<string>;
sign(requestToSign: HttpRequest, options?: RequestSigningArguments): Promise<HttpRequest>;
private signEvent;
private signString;
private signRequest;
private createCanonicalRequest;
private createStringToSign;
private getCanonicalPath;
private getSignature;
private getSigningKey;
export declare class SignatureV4
implements RequestPresigner, RequestSigner, StringSigner, EventSigner
{
private readonly service;
private readonly regionProvider;
private readonly credentialProvider;
private readonly sha256;
private readonly uriEscapePath;
private readonly applyChecksum;
constructor({
applyChecksum,
credentials,
region,
service,
sha256,
uriEscapePath,
}: SignatureV4Init & SignatureV4CryptoInit);
presign(
originalRequest: HttpRequest,
options?: RequestPresigningArguments
): Promise<HttpRequest>;
sign(stringToSign: string, options?: SigningArguments): Promise<string>;
sign(event: FormattedEvent, options: EventSigningArguments): Promise<string>;
sign(
requestToSign: HttpRequest,
options?: RequestSigningArguments
): Promise<HttpRequest>;
private signEvent;
private signString;
private signRequest;
private createCanonicalRequest;
private createStringToSign;
private getCanonicalPath;
private getSignature;
private getSigningKey;
private validateResolvedCredentials;
}

@@ -1,6 +0,6 @@

import { HttpRequest } from "@aws-sdk/types";
import { HttpRequest } from "@trivikr-test/types";
export interface TestCase {
name: string;
request: HttpRequest;
authorization: string;
name: string;
request: HttpRequest;
authorization: string;
}

@@ -10,6 +10,6 @@ export declare const region = "us-east-1";

export declare const credentials: {
accessKeyId: string;
secretAccessKey: string;
accessKeyId: string;
secretAccessKey: string;
};
export declare const signingDate: Date;
export declare const requests: Array<TestCase>;
export declare const iso8601: (time: number | string | Date) => string;
export declare const toDate: (time: number | string | Date) => Date;
{
"name": "@trivikr-test/signature-v4",
"version": "3.58.0",
"version": "3.170.0",
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm",

@@ -12,2 +12,3 @@ "main": "./dist-cjs/index.js",

"build:es": "tsc -p tsconfig.es.json",
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
"build:types": "tsc -p tsconfig.types.json",

@@ -24,7 +25,7 @@ "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",

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

@@ -34,7 +35,7 @@ },

"@aws-crypto/sha256-js": "2.0.0",
"@trivikr-test/protocol-http": "3.58.0",
"@trivikr-test/util-buffer-from": "3.55.0",
"@trivikr-test/protocol-http": "3.170.0",
"@trivikr-test/util-buffer-from": "3.170.0",
"@tsconfig/recommended": "1.0.1",
"concurrently": "7.0.0",
"downlevel-dts": "0.7.0",
"downlevel-dts": "0.10.1",
"rimraf": "3.0.2",

@@ -41,0 +42,0 @@ "typedoc": "0.19.2",

@@ -1,4 +0,1 @@

# @aws-sdk/signature-v4
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/signature-v4/latest.svg)](https://www.npmjs.com/package/@aws-sdk/signature-v4)
[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/signature-v4.svg)](https://www.npmjs.com/package/@aws-sdk/signature-v4)
Please refer [README.md](https://github.com/aws/aws-sdk-js-v3/blob/v3.170.0/packages/signature-v4/README.md) for v3.170.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