@graphql-mesh/hmac-upstream-signature 1.2.19-alpha-73dbe3a2dabb6b84105c4dac3586696daa3d4fcb → 1.2.19-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202
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/CHANGELOG.md +9 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
# @graphql-mesh/hmac-upstream-signature
|
2
2
|
|
3
|
-
## 1.2.19-alpha-
|
3
|
+
## 1.2.19-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
+
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`e31d79c`](https://github.com/graphql-hive/gateway/commit/e31d79c704014d5180074bdb3ce11dcd1675eb58) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
8
|
+
|
9
|
+
- Added dependency [`@graphql-tools/executor-common@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor-common/v/workspace:^) (to `dependencies`)
|
10
|
+
- Removed dependency [`@graphql-mesh/transport-common@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-mesh/transport-common/v/workspace:^) (from `dependencies`)
|
11
|
+
|
7
12
|
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`73dbe3a`](https://github.com/graphql-hive/gateway/commit/73dbe3a2dabb6b84105c4dac3586696daa3d4fcb) Thanks [@ardatan](https://github.com/ardatan)! - Like HMAC Upstream Signature plugin, different components of the gateway were using different ways of serializing the execution request.
|
8
13
|
Some of them were ignoring `variables` if it is empty, some of not, this was causing the signature generation to be different for the same query.
|
9
14
|
For example, it was working as expected in Proxy mode, but not working as expected in Federation Gateway mode.
|
10
15
|
|
11
16
|
With this change, now we have a shared helper to serialize the upstream execution request with a memoized `print` function for query AST etc to have a consistent serialization so consistent signature generation for HMAC.
|
12
17
|
|
18
|
+
- Updated dependencies [[`73dbe3a`](https://github.com/graphql-hive/gateway/commit/73dbe3a2dabb6b84105c4dac3586696daa3d4fcb)]:
|
19
|
+
- @graphql-tools/executor-common@0.0.1-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202
|
20
|
+
|
13
21
|
## 1.2.18
|
14
22
|
|
15
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -11,7 +11,7 @@ var jsonStableStringify__default = /*#__PURE__*/_interopDefault(jsonStableString
|
|
11
11
|
const DEFAULT_EXTENSION_NAME = "hmac-signature";
|
12
12
|
const DEFAULT_SHOULD_SIGN_FN = () => true;
|
13
13
|
const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify__default.default(
|
14
|
-
executorCommon.
|
14
|
+
executorCommon.serializeExecutionRequest({
|
15
15
|
executionRequest: {
|
16
16
|
document: executionRequest.document,
|
17
17
|
variables: executionRequest.variables
|
@@ -44,7 +44,7 @@ function useHmacUpstreamSignature(options) {
|
|
44
44
|
}
|
45
45
|
const shouldSign = options.shouldSign || DEFAULT_SHOULD_SIGN_FN;
|
46
46
|
const extensionName = options.extensionName || DEFAULT_EXTENSION_NAME;
|
47
|
-
const
|
47
|
+
const serializeExecutionRequest2 = options.serializeExecutionRequest || defaultExecutionRequestSerializer;
|
48
48
|
let key$;
|
49
49
|
let fetchAPI;
|
50
50
|
let textEncoder;
|
@@ -73,7 +73,7 @@ function useHmacUpstreamSignature(options) {
|
|
73
73
|
});
|
74
74
|
return utils.mapMaybePromise(key$, async (key) => {
|
75
75
|
key$ = key;
|
76
|
-
const serializedExecutionRequest =
|
76
|
+
const serializedExecutionRequest = serializeExecutionRequest2(executionRequest);
|
77
77
|
const encodedContent = textEncoder.encode(serializedExecutionRequest);
|
78
78
|
const signature = await fetchAPI.crypto.subtle.sign(
|
79
79
|
"HMAC",
|
package/dist/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { serializeExecutionRequest } from '@graphql-tools/executor-common';
|
2
2
|
import { mapMaybePromise } from '@graphql-tools/utils';
|
3
3
|
import jsonStableStringify from 'json-stable-stringify';
|
4
4
|
|
5
5
|
const DEFAULT_EXTENSION_NAME = "hmac-signature";
|
6
6
|
const DEFAULT_SHOULD_SIGN_FN = () => true;
|
7
7
|
const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify(
|
8
|
-
|
8
|
+
serializeExecutionRequest({
|
9
9
|
executionRequest: {
|
10
10
|
document: executionRequest.document,
|
11
11
|
variables: executionRequest.variables
|
@@ -38,7 +38,7 @@ function useHmacUpstreamSignature(options) {
|
|
38
38
|
}
|
39
39
|
const shouldSign = options.shouldSign || DEFAULT_SHOULD_SIGN_FN;
|
40
40
|
const extensionName = options.extensionName || DEFAULT_EXTENSION_NAME;
|
41
|
-
const
|
41
|
+
const serializeExecutionRequest2 = options.serializeExecutionRequest || defaultExecutionRequestSerializer;
|
42
42
|
let key$;
|
43
43
|
let fetchAPI;
|
44
44
|
let textEncoder;
|
@@ -67,7 +67,7 @@ function useHmacUpstreamSignature(options) {
|
|
67
67
|
});
|
68
68
|
return mapMaybePromise(key$, async (key) => {
|
69
69
|
key$ = key;
|
70
|
-
const serializedExecutionRequest =
|
70
|
+
const serializedExecutionRequest = serializeExecutionRequest2(executionRequest);
|
71
71
|
const encodedContent = textEncoder.encode(serializedExecutionRequest);
|
72
72
|
const signature = await fetchAPI.crypto.subtle.sign(
|
73
73
|
"HMAC",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-mesh/hmac-upstream-signature",
|
3
|
-
"version": "1.2.19-alpha-
|
3
|
+
"version": "1.2.19-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202",
|
4
4
|
"type": "module",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -45,13 +45,13 @@
|
|
45
45
|
"@graphql-mesh/cross-helpers": "^0.4.9",
|
46
46
|
"@graphql-mesh/types": "^0.103.6",
|
47
47
|
"@graphql-mesh/utils": "^0.103.6",
|
48
|
-
"@graphql-tools/executor-common": "
|
48
|
+
"@graphql-tools/executor-common": "0.0.1-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202",
|
49
49
|
"@graphql-tools/utils": "^10.7.0",
|
50
50
|
"json-stable-stringify": "^1.1.1",
|
51
51
|
"tslib": "^2.8.1"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|
54
|
-
"@graphql-hive/gateway": "1.7.4-alpha-
|
54
|
+
"@graphql-hive/gateway": "1.7.4-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202",
|
55
55
|
"@types/json-stable-stringify": "^1.1.0",
|
56
56
|
"graphql": "^16.9.0",
|
57
57
|
"graphql-yoga": "^5.10.6",
|