@smithy/signature-v4 5.6.4 → 5.6.5
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 +11 -11
- package/dist-es/HeaderFormatter.js +10 -10
- package/dist-es/SignatureV4Base.js +1 -1
- package/package.json +3 -5
package/dist-cjs/index.js
CHANGED
|
@@ -20,27 +20,27 @@ class HeaderFormatter {
|
|
|
20
20
|
formatHeaderValue(header) {
|
|
21
21
|
switch (header.type) {
|
|
22
22
|
case "boolean":
|
|
23
|
-
return Uint8Array.from([header.value ?
|
|
23
|
+
return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
|
|
24
24
|
case "byte":
|
|
25
|
-
return Uint8Array.from([
|
|
25
|
+
return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
|
|
26
26
|
case "short":
|
|
27
27
|
const shortView = new DataView(new ArrayBuffer(3));
|
|
28
|
-
shortView.setUint8(0,
|
|
28
|
+
shortView.setUint8(0, HEADER_VALUE_TYPE.short);
|
|
29
29
|
shortView.setInt16(1, header.value, false);
|
|
30
30
|
return new Uint8Array(shortView.buffer);
|
|
31
31
|
case "integer":
|
|
32
32
|
const intView = new DataView(new ArrayBuffer(5));
|
|
33
|
-
intView.setUint8(0,
|
|
33
|
+
intView.setUint8(0, HEADER_VALUE_TYPE.integer);
|
|
34
34
|
intView.setInt32(1, header.value, false);
|
|
35
35
|
return new Uint8Array(intView.buffer);
|
|
36
36
|
case "long":
|
|
37
37
|
const longBytes = new Uint8Array(9);
|
|
38
|
-
longBytes[0] =
|
|
38
|
+
longBytes[0] = HEADER_VALUE_TYPE.long;
|
|
39
39
|
longBytes.set(header.value.bytes, 1);
|
|
40
40
|
return longBytes;
|
|
41
41
|
case "binary":
|
|
42
42
|
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
43
|
-
binView.setUint8(0,
|
|
43
|
+
binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
|
|
44
44
|
binView.setUint16(1, header.value.byteLength, false);
|
|
45
45
|
const binBytes = new Uint8Array(binView.buffer);
|
|
46
46
|
binBytes.set(header.value, 3);
|
|
@@ -48,14 +48,14 @@ class HeaderFormatter {
|
|
|
48
48
|
case "string":
|
|
49
49
|
const utf8Bytes = fromUtf8(header.value);
|
|
50
50
|
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
51
|
-
strView.setUint8(0,
|
|
51
|
+
strView.setUint8(0, HEADER_VALUE_TYPE.string);
|
|
52
52
|
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
53
53
|
const strBytes = new Uint8Array(strView.buffer);
|
|
54
54
|
strBytes.set(utf8Bytes, 3);
|
|
55
55
|
return strBytes;
|
|
56
56
|
case "timestamp":
|
|
57
57
|
const tsBytes = new Uint8Array(9);
|
|
58
|
-
tsBytes[0] =
|
|
58
|
+
tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
|
|
59
59
|
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
|
60
60
|
return tsBytes;
|
|
61
61
|
case "uuid":
|
|
@@ -63,8 +63,8 @@ class HeaderFormatter {
|
|
|
63
63
|
throw new Error(`Invalid UUID received: ${header.value}`);
|
|
64
64
|
}
|
|
65
65
|
const uuidBytes = new Uint8Array(17);
|
|
66
|
-
uuidBytes[0] =
|
|
67
|
-
uuidBytes.set(fromHex(header.value.replace(
|
|
66
|
+
uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
|
|
67
|
+
uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
|
|
68
68
|
return uuidBytes;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -278,7 +278,7 @@ ${toHex(hashedRequest)}`;
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
formatDate(now) {
|
|
281
|
-
const longDate = iso8601(now).replace(/[
|
|
281
|
+
const longDate = iso8601(now).replace(/[-:]/g, "");
|
|
282
282
|
return {
|
|
283
283
|
longDate,
|
|
284
284
|
shortDate: longDate.slice(0, 8),
|
|
@@ -17,27 +17,27 @@ export class HeaderFormatter {
|
|
|
17
17
|
formatHeaderValue(header) {
|
|
18
18
|
switch (header.type) {
|
|
19
19
|
case "boolean":
|
|
20
|
-
return Uint8Array.from([header.value ?
|
|
20
|
+
return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
|
|
21
21
|
case "byte":
|
|
22
|
-
return Uint8Array.from([
|
|
22
|
+
return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
|
|
23
23
|
case "short":
|
|
24
24
|
const shortView = new DataView(new ArrayBuffer(3));
|
|
25
|
-
shortView.setUint8(0,
|
|
25
|
+
shortView.setUint8(0, HEADER_VALUE_TYPE.short);
|
|
26
26
|
shortView.setInt16(1, header.value, false);
|
|
27
27
|
return new Uint8Array(shortView.buffer);
|
|
28
28
|
case "integer":
|
|
29
29
|
const intView = new DataView(new ArrayBuffer(5));
|
|
30
|
-
intView.setUint8(0,
|
|
30
|
+
intView.setUint8(0, HEADER_VALUE_TYPE.integer);
|
|
31
31
|
intView.setInt32(1, header.value, false);
|
|
32
32
|
return new Uint8Array(intView.buffer);
|
|
33
33
|
case "long":
|
|
34
34
|
const longBytes = new Uint8Array(9);
|
|
35
|
-
longBytes[0] =
|
|
35
|
+
longBytes[0] = HEADER_VALUE_TYPE.long;
|
|
36
36
|
longBytes.set(header.value.bytes, 1);
|
|
37
37
|
return longBytes;
|
|
38
38
|
case "binary":
|
|
39
39
|
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
40
|
-
binView.setUint8(0,
|
|
40
|
+
binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
|
|
41
41
|
binView.setUint16(1, header.value.byteLength, false);
|
|
42
42
|
const binBytes = new Uint8Array(binView.buffer);
|
|
43
43
|
binBytes.set(header.value, 3);
|
|
@@ -45,14 +45,14 @@ export class HeaderFormatter {
|
|
|
45
45
|
case "string":
|
|
46
46
|
const utf8Bytes = fromUtf8(header.value);
|
|
47
47
|
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
48
|
-
strView.setUint8(0,
|
|
48
|
+
strView.setUint8(0, HEADER_VALUE_TYPE.string);
|
|
49
49
|
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
50
50
|
const strBytes = new Uint8Array(strView.buffer);
|
|
51
51
|
strBytes.set(utf8Bytes, 3);
|
|
52
52
|
return strBytes;
|
|
53
53
|
case "timestamp":
|
|
54
54
|
const tsBytes = new Uint8Array(9);
|
|
55
|
-
tsBytes[0] =
|
|
55
|
+
tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
|
|
56
56
|
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
|
57
57
|
return tsBytes;
|
|
58
58
|
case "uuid":
|
|
@@ -60,8 +60,8 @@ export class HeaderFormatter {
|
|
|
60
60
|
throw new Error(`Invalid UUID received: ${header.value}`);
|
|
61
61
|
}
|
|
62
62
|
const uuidBytes = new Uint8Array(17);
|
|
63
|
-
uuidBytes[0] =
|
|
64
|
-
uuidBytes.set(fromHex(header.value.replace(
|
|
63
|
+
uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
|
|
64
|
+
uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
|
|
65
65
|
return uuidBytes;
|
|
66
66
|
}
|
|
67
67
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/signature-v4",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.5",
|
|
4
4
|
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
7
7
|
"types": "./dist-types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
10
|
-
"build:es:cjs": "
|
|
10
|
+
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
|
|
11
11
|
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
|
|
12
12
|
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
13
13
|
"clean": "premove dist-cjs dist-es dist-types",
|
|
14
14
|
"extract:docs": "api-extractor run --local",
|
|
15
|
-
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
16
|
-
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
17
15
|
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
18
16
|
"test": "yarn g:vitest run",
|
|
19
17
|
"test:watch": "yarn g:vitest watch"
|
|
@@ -25,7 +23,7 @@
|
|
|
25
23
|
"license": "Apache-2.0",
|
|
26
24
|
"sideEffects": false,
|
|
27
25
|
"dependencies": {
|
|
28
|
-
"@smithy/core": "^3.29.
|
|
26
|
+
"@smithy/core": "^3.29.4",
|
|
29
27
|
"@smithy/types": "^4.16.1",
|
|
30
28
|
"tslib": "^2.6.2"
|
|
31
29
|
},
|