@aws-sdk/middleware-ssec 3.972.11 → 3.972.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -1,73 +1,10 @@
1
1
  'use strict';
2
2
 
3
- function ssecMiddleware(options) {
4
- return (next) => async (args) => {
5
- const input = { ...args.input };
6
- const properties = [
7
- {
8
- target: "SSECustomerKey",
9
- hash: "SSECustomerKeyMD5",
10
- },
11
- {
12
- target: "CopySourceSSECustomerKey",
13
- hash: "CopySourceSSECustomerKeyMD5",
14
- },
15
- ];
16
- for (const prop of properties) {
17
- const value = input[prop.target];
18
- if (value) {
19
- let valueForHash;
20
- if (typeof value === "string") {
21
- if (isValidBase64EncodedSSECustomerKey(value, options)) {
22
- valueForHash = options.base64Decoder(value);
23
- }
24
- else {
25
- valueForHash = options.utf8Decoder(value);
26
- input[prop.target] = options.base64Encoder(valueForHash);
27
- }
28
- }
29
- else {
30
- valueForHash = ArrayBuffer.isView(value)
31
- ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
32
- : new Uint8Array(value);
33
- input[prop.target] = options.base64Encoder(valueForHash);
34
- }
35
- const hash = new options.md5();
36
- hash.update(valueForHash);
37
- input[prop.hash] = options.base64Encoder(await hash.digest());
38
- }
39
- }
40
- return next({
41
- ...args,
42
- input,
43
- });
44
- };
45
- }
46
- const ssecMiddlewareOptions = {
47
- name: "ssecMiddleware",
48
- step: "initialize",
49
- tags: ["SSE"],
50
- override: true,
51
- };
52
- const getSsecPlugin = (config) => ({
53
- applyToStack: (clientStack) => {
54
- clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
55
- },
56
- });
57
- function isValidBase64EncodedSSECustomerKey(str, options) {
58
- const base64Regex = /^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
59
- if (!base64Regex.test(str))
60
- return false;
61
- try {
62
- const decodedBytes = options.base64Decoder(str);
63
- return decodedBytes.length === 32;
64
- }
65
- catch {
66
- return false;
67
- }
68
- }
3
+ var s3 = require('@aws-sdk/middleware-sdk-s3/s3');
69
4
 
70
- exports.getSsecPlugin = getSsecPlugin;
71
- exports.isValidBase64EncodedSSECustomerKey = isValidBase64EncodedSSECustomerKey;
72
- exports.ssecMiddleware = ssecMiddleware;
73
- exports.ssecMiddlewareOptions = ssecMiddlewareOptions;
5
+
6
+
7
+ exports.getSsecPlugin = s3.getSsecPlugin;
8
+ exports.isValidBase64EncodedSSECustomerKey = s3.isValidBase64EncodedSSECustomerKey;
9
+ exports.ssecMiddleware = s3.ssecMiddleware;
10
+ exports.ssecMiddlewareOptions = s3.ssecMiddlewareOptions;
package/dist-es/index.js CHANGED
@@ -1,66 +1 @@
1
- export function ssecMiddleware(options) {
2
- return (next) => async (args) => {
3
- const input = { ...args.input };
4
- const properties = [
5
- {
6
- target: "SSECustomerKey",
7
- hash: "SSECustomerKeyMD5",
8
- },
9
- {
10
- target: "CopySourceSSECustomerKey",
11
- hash: "CopySourceSSECustomerKeyMD5",
12
- },
13
- ];
14
- for (const prop of properties) {
15
- const value = input[prop.target];
16
- if (value) {
17
- let valueForHash;
18
- if (typeof value === "string") {
19
- if (isValidBase64EncodedSSECustomerKey(value, options)) {
20
- valueForHash = options.base64Decoder(value);
21
- }
22
- else {
23
- valueForHash = options.utf8Decoder(value);
24
- input[prop.target] = options.base64Encoder(valueForHash);
25
- }
26
- }
27
- else {
28
- valueForHash = ArrayBuffer.isView(value)
29
- ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
30
- : new Uint8Array(value);
31
- input[prop.target] = options.base64Encoder(valueForHash);
32
- }
33
- const hash = new options.md5();
34
- hash.update(valueForHash);
35
- input[prop.hash] = options.base64Encoder(await hash.digest());
36
- }
37
- }
38
- return next({
39
- ...args,
40
- input,
41
- });
42
- };
43
- }
44
- export const ssecMiddlewareOptions = {
45
- name: "ssecMiddleware",
46
- step: "initialize",
47
- tags: ["SSE"],
48
- override: true,
49
- };
50
- export const getSsecPlugin = (config) => ({
51
- applyToStack: (clientStack) => {
52
- clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
53
- },
54
- });
55
- export function isValidBase64EncodedSSECustomerKey(str, options) {
56
- const base64Regex = /^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
57
- if (!base64Regex.test(str))
58
- return false;
59
- try {
60
- const decodedBytes = options.base64Decoder(str);
61
- return decodedBytes.length === 32;
62
- }
63
- catch {
64
- return false;
65
- }
66
- }
1
+ export { ssecMiddleware, ssecMiddlewareOptions, getSsecPlugin, isValidBase64EncodedSSECustomerKey, } from "@aws-sdk/middleware-sdk-s3/s3";
@@ -1,12 +1 @@
1
- import type { ChecksumConstructor, Decoder, Encoder, HashConstructor, InitializeHandlerOptions, InitializeMiddleware, Pluggable } from "@smithy/types";
2
- interface PreviouslyResolved {
3
- base64Encoder: Encoder;
4
- md5: ChecksumConstructor | HashConstructor;
5
- utf8Decoder: Decoder;
6
- base64Decoder: Decoder;
7
- }
8
- export declare function ssecMiddleware(options: PreviouslyResolved): InitializeMiddleware<any, any>;
9
- export declare const ssecMiddlewareOptions: InitializeHandlerOptions;
10
- export declare const getSsecPlugin: (config: PreviouslyResolved) => Pluggable<any, any>;
11
- export declare function isValidBase64EncodedSSECustomerKey(str: string, options: PreviouslyResolved): boolean;
12
- export {};
1
+ export { ssecMiddleware, ssecMiddlewareOptions, getSsecPlugin, isValidBase64EncodedSSECustomerKey, } from "@aws-sdk/middleware-sdk-s3/s3";
package/package.json CHANGED
@@ -1,18 +1,13 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-ssec",
3
- "version": "3.972.11",
3
+ "version": "3.972.13",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-ssec",
7
7
  "build:es": "tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
9
  "build:types": "tsc -p tsconfig.types.json",
10
- "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
12
- "test": "yarn g:vitest run",
13
- "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
14
- "test:watch": "yarn g:vitest watch",
15
- "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
10
+ "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
16
11
  },
17
12
  "main": "./dist-cjs/index.js",
18
13
  "module": "./dist-es/index.js",
@@ -24,20 +19,12 @@
24
19
  },
25
20
  "license": "Apache-2.0",
26
21
  "dependencies": {
27
- "@aws-sdk/types": "^3.973.9",
28
- "@smithy/types": "^4.14.2",
22
+ "@aws-sdk/middleware-sdk-s3": "^3.972.47",
29
23
  "tslib": "^2.6.2"
30
24
  },
31
25
  "engines": {
32
26
  "node": ">=20.0.0"
33
27
  },
34
- "typesVersions": {
35
- "<4.5": {
36
- "dist-types/*": [
37
- "dist-types/ts3.4/*"
38
- ]
39
- }
40
- },
41
28
  "files": [
42
29
  "dist-*/**"
43
30
  ],
@@ -48,9 +35,7 @@
48
35
  "directory": "packages-internal/middleware-ssec"
49
36
  },
50
37
  "devDependencies": {
51
- "@tsconfig/recommended": "1.0.1",
52
38
  "concurrently": "7.0.0",
53
- "downlevel-dts": "0.10.1",
54
39
  "premove": "4.0.0",
55
40
  "typescript": "~5.8.3"
56
41
  }
@@ -1,27 +0,0 @@
1
- import {
2
- ChecksumConstructor,
3
- Decoder,
4
- Encoder,
5
- HashConstructor,
6
- InitializeHandlerOptions,
7
- InitializeMiddleware,
8
- Pluggable,
9
- } from "@smithy/types";
10
- interface PreviouslyResolved {
11
- base64Encoder: Encoder;
12
- md5: ChecksumConstructor | HashConstructor;
13
- utf8Decoder: Decoder;
14
- base64Decoder: Decoder;
15
- }
16
- export declare function ssecMiddleware(
17
- options: PreviouslyResolved
18
- ): InitializeMiddleware<any, any>;
19
- export declare const ssecMiddlewareOptions: InitializeHandlerOptions;
20
- export declare const getSsecPlugin: (
21
- config: PreviouslyResolved
22
- ) => Pluggable<any, any>;
23
- export declare function isValidBase64EncodedSSECustomerKey(
24
- str: string,
25
- options: PreviouslyResolved
26
- ): boolean;
27
- export {};