@smithy/signature-v4
Advanced tools
Comparing version 4.2.4 to 5.0.0
@@ -124,3 +124,3 @@ var __defProp = Object.defineProperty; | ||
const canonicalHeaderName = headerName.toLowerCase(); | ||
if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { | ||
if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || unsignableHeaders?.has(canonicalHeaderName) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { | ||
if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { | ||
@@ -179,3 +179,6 @@ continue; | ||
var import_util_utf83 = require("@smithy/util-utf8"); | ||
var _HeaderFormatter = class _HeaderFormatter { | ||
var HeaderFormatter = class { | ||
static { | ||
__name(this, "HeaderFormatter"); | ||
} | ||
format(headers) { | ||
@@ -247,6 +250,4 @@ const chunks = []; | ||
}; | ||
__name(_HeaderFormatter, "HeaderFormatter"); | ||
var HeaderFormatter = _HeaderFormatter; | ||
var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; | ||
var _Int64 = class _Int64 { | ||
var Int64 = class _Int64 { | ||
constructor(bytes) { | ||
@@ -258,2 +259,5 @@ this.bytes = bytes; | ||
} | ||
static { | ||
__name(this, "Int64"); | ||
} | ||
static fromNumber(number) { | ||
@@ -287,4 +291,2 @@ if (number > 9223372036854776e3 || number < -9223372036854776e3) { | ||
}; | ||
__name(_Int64, "Int64"); | ||
var Int64 = _Int64; | ||
function negate(bytes) { | ||
@@ -316,7 +318,6 @@ for (let i = 0; i < 8; i++) { | ||
var moveHeadersToQuery = /* @__PURE__ */ __name((request, options = {}) => { | ||
var _a, _b; | ||
const { headers, query = {} } = import_protocol_http.HttpRequest.clone(request); | ||
for (const name of Object.keys(headers)) { | ||
const lname = name.toLowerCase(); | ||
if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname)) || ((_b = options.hoistableHeaders) == null ? void 0 : _b.has(lname))) { | ||
if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) { | ||
query[name] = headers[name]; | ||
@@ -361,3 +362,3 @@ delete headers[name]; | ||
// src/SignatureV4.ts | ||
var _SignatureV4 = class _SignatureV4 { | ||
var SignatureV4 = class { | ||
constructor({ | ||
@@ -379,2 +380,5 @@ applyChecksum, | ||
} | ||
static { | ||
__name(this, "SignatureV4"); | ||
} | ||
async presign(originalRequest, options = {}) { | ||
@@ -528,3 +532,3 @@ const { | ||
for (const pathSegment of path.split("/")) { | ||
if ((pathSegment == null ? void 0 : pathSegment.length) === 0) | ||
if (pathSegment?.length === 0) | ||
continue; | ||
@@ -539,3 +543,3 @@ if (pathSegment === ".") | ||
} | ||
const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; | ||
const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`; | ||
const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath); | ||
@@ -563,4 +567,2 @@ return doubleEncoded.replace(/%2F/g, "/"); | ||
}; | ||
__name(_SignatureV4, "SignatureV4"); | ||
var SignatureV4 = _SignatureV4; | ||
var formatDate = /* @__PURE__ */ __name((now) => { | ||
@@ -567,0 +569,0 @@ const longDate = iso8601(now).replace(/[\-:]/g, ""); |
@@ -5,17 +5,21 @@ import { AwsCredentialIdentity, ChecksumConstructor, HashConstructor } from "@smithy/types"; | ||
* | ||
* @param shortDate The current calendar date in the form YYYYMMDD. | ||
* @param region The AWS region in which the service resides. | ||
* @param service The service to which the signed request is being sent. | ||
* @internal | ||
* | ||
* @param shortDate - the current calendar date in the form YYYYMMDD. | ||
* @param region - the AWS region in which the service resides. | ||
* @param service - the service to which the signed request is being sent. | ||
*/ | ||
export declare const createScope: (shortDate: string, region: string, service: string) => string; | ||
/** | ||
* Derive a signing key from its composite parts | ||
* Derive a signing key from its composite parts. | ||
* | ||
* @param sha256Constructor A constructor function that can instantiate SHA-256 | ||
* @internal | ||
* | ||
* @param sha256Constructor - a constructor function that can instantiate SHA-256 | ||
* hash objects. | ||
* @param credentials The credentials with which the request will be | ||
* @param credentials - the credentials with which the request will be | ||
* signed. | ||
* @param shortDate The current calendar date in the form YYYYMMDD. | ||
* @param region The AWS region in which the service resides. | ||
* @param service The service to which the signed request is being | ||
* @param shortDate - the current calendar date in the form YYYYMMDD. | ||
* @param region - the AWS region in which the service resides. | ||
* @param service - the service to which the signed request is being | ||
* sent. | ||
@@ -22,0 +26,0 @@ */ |
import { HeaderBag, HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getCanonicalHeaders: ({ headers }: HttpRequest, unsignableHeaders?: Set<string>, signableHeaders?: Set<string>) => HeaderBag; |
import { HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getCanonicalQuery: ({ query }: HttpRequest) => string; |
import { ChecksumConstructor, HashConstructor, HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getPayloadHash: ({ headers, body }: HttpRequest, hashConstructor: ChecksumConstructor | HashConstructor) => Promise<string>; |
import type { HttpRequest as IHttpRequest, QueryParameterBag } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
@@ -5,0 +5,0 @@ export declare const moveHeadersToQuery: (request: IHttpRequest, options?: { |
import type { HttpRequest as IHttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const prepareRequest: (request: IHttpRequest) => IHttpRequest; |
import { AwsCredentialIdentity, ChecksumConstructor, EventSigner, EventSigningArguments, FormattedEvent, HashConstructor, HttpRequest, MessageSigner, Provider, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SignableMessage, SignedMessage, SigningArguments, StringSigner } from "@smithy/types"; | ||
/** | ||
* @public | ||
*/ | ||
export interface SignatureV4Init { | ||
@@ -40,5 +43,11 @@ /** | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export interface SignatureV4CryptoInit { | ||
sha256: ChecksumConstructor | HashConstructor; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare class SignatureV4 implements RequestPresigner, RequestSigner, StringSigner, EventSigner, MessageSigner { | ||
@@ -45,0 +54,0 @@ private readonly service; |
@@ -5,17 +5,21 @@ import { AwsCredentialIdentity, ChecksumConstructor, HashConstructor } from "@smithy/types"; | ||
* | ||
* @param shortDate The current calendar date in the form YYYYMMDD. | ||
* @param region The AWS region in which the service resides. | ||
* @param service The service to which the signed request is being sent. | ||
* @internal | ||
* | ||
* @param shortDate - the current calendar date in the form YYYYMMDD. | ||
* @param region - the AWS region in which the service resides. | ||
* @param service - the service to which the signed request is being sent. | ||
*/ | ||
export declare const createScope: (shortDate: string, region: string, service: string) => string; | ||
/** | ||
* Derive a signing key from its composite parts | ||
* Derive a signing key from its composite parts. | ||
* | ||
* @param sha256Constructor A constructor function that can instantiate SHA-256 | ||
* @internal | ||
* | ||
* @param sha256Constructor - a constructor function that can instantiate SHA-256 | ||
* hash objects. | ||
* @param credentials The credentials with which the request will be | ||
* @param credentials - the credentials with which the request will be | ||
* signed. | ||
* @param shortDate The current calendar date in the form YYYYMMDD. | ||
* @param region The AWS region in which the service resides. | ||
* @param service The service to which the signed request is being | ||
* @param shortDate - the current calendar date in the form YYYYMMDD. | ||
* @param region - the AWS region in which the service resides. | ||
* @param service - the service to which the signed request is being | ||
* sent. | ||
@@ -22,0 +26,0 @@ */ |
import { HeaderBag, HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getCanonicalHeaders: ({ headers }: HttpRequest, unsignableHeaders?: Set<string>, signableHeaders?: Set<string>) => HeaderBag; |
import { HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getCanonicalQuery: ({ query }: HttpRequest) => string; |
import { ChecksumConstructor, HashConstructor, HttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const getPayloadHash: ({ headers, body }: HttpRequest, hashConstructor: ChecksumConstructor | HashConstructor) => Promise<string>; |
import { HttpRequest as IHttpRequest, QueryParameterBag } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
@@ -5,0 +5,0 @@ export declare const moveHeadersToQuery: (request: IHttpRequest, options?: { |
import { HttpRequest as IHttpRequest } from "@smithy/types"; | ||
/** | ||
* @private | ||
* @internal | ||
*/ | ||
export declare const prepareRequest: (request: IHttpRequest) => IHttpRequest; |
import { AwsCredentialIdentity, ChecksumConstructor, EventSigner, EventSigningArguments, FormattedEvent, HashConstructor, HttpRequest, MessageSigner, Provider, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SignableMessage, SignedMessage, SigningArguments, StringSigner } from "@smithy/types"; | ||
/** | ||
* @public | ||
*/ | ||
export interface SignatureV4Init { | ||
@@ -40,5 +43,11 @@ /** | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export interface SignatureV4CryptoInit { | ||
sha256: ChecksumConstructor | HashConstructor; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare class SignatureV4 implements RequestPresigner, RequestSigner, StringSigner, EventSigner, MessageSigner { | ||
@@ -45,0 +54,0 @@ private readonly service; |
{ | ||
"name": "@smithy/signature-v4", | ||
"version": "4.2.4", | ||
"version": "5.0.0", | ||
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm", | ||
@@ -28,9 +28,9 @@ "main": "./dist-cjs/index.js", | ||
"dependencies": { | ||
"@smithy/is-array-buffer": "^3.0.0", | ||
"@smithy/protocol-http": "^4.1.8", | ||
"@smithy/types": "^3.7.2", | ||
"@smithy/util-hex-encoding": "^3.0.0", | ||
"@smithy/util-middleware": "^3.0.11", | ||
"@smithy/util-uri-escape": "^3.0.0", | ||
"@smithy/util-utf8": "^3.0.0", | ||
"@smithy/is-array-buffer": "^4.0.0", | ||
"@smithy/protocol-http": "^5.0.0", | ||
"@smithy/types": "^4.0.0", | ||
"@smithy/util-hex-encoding": "^4.0.0", | ||
"@smithy/util-middleware": "^4.0.0", | ||
"@smithy/util-uri-escape": "^4.0.0", | ||
"@smithy/util-utf8": "^4.0.0", | ||
"tslib": "^2.6.2" | ||
@@ -46,3 +46,3 @@ }, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "typesVersions": { |
1956
96049
+ Added@smithy/is-array-buffer@4.0.0(transitive)
+ Added@smithy/protocol-http@5.0.1(transitive)
+ Added@smithy/types@4.1.0(transitive)
+ Added@smithy/util-buffer-from@4.0.0(transitive)
+ Added@smithy/util-hex-encoding@4.0.0(transitive)
+ Added@smithy/util-middleware@4.0.1(transitive)
+ Added@smithy/util-uri-escape@4.0.0(transitive)
+ Added@smithy/util-utf8@4.0.0(transitive)
- Removed@smithy/is-array-buffer@3.0.0(transitive)
- Removed@smithy/protocol-http@4.1.8(transitive)
- Removed@smithy/types@3.7.2(transitive)
- Removed@smithy/util-buffer-from@3.0.0(transitive)
- Removed@smithy/util-hex-encoding@3.0.0(transitive)
- Removed@smithy/util-middleware@3.0.11(transitive)
- Removed@smithy/util-uri-escape@3.0.0(transitive)
- Removed@smithy/util-utf8@3.0.0(transitive)
Updated@smithy/protocol-http@^5.0.0
Updated@smithy/types@^4.0.0
Updated@smithy/util-utf8@^4.0.0