@dynamic-labs/utils 3.0.0-alpha.55 → 3.0.0-alpha.56
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
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.56](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.55...v3.0.0-alpha.56) (2024-09-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass `authCode` for telegram from sdk to `signin` and `verify` calls ([#6777](https://github.com/dynamic-labs/DynamicAuth/issues/6777)) ([43d09dd](https://github.com/dynamic-labs/DynamicAuth/commit/43d09dd3ea82fd13f1c798c0745aa0fef2051f90))
|
|
8
|
+
|
|
2
9
|
## [3.0.0-alpha.55](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.54...v3.0.0-alpha.55) (2024-09-02)
|
|
3
10
|
|
|
4
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.56",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
29
|
+
"@dynamic-labs/sdk-api-core": "0.0.525",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "3.0.0-alpha.56",
|
|
32
|
+
"@dynamic-labs/types": "3.0.0-alpha.56",
|
|
33
33
|
"buffer": "6.0.3",
|
|
34
34
|
"stream": "0.0.2"
|
|
35
35
|
},
|
|
@@ -87,7 +87,7 @@ const createWindowOauth2Service = () => ({
|
|
|
87
87
|
}
|
|
88
88
|
clearListeners();
|
|
89
89
|
if (isTelegramCompletedMessage) {
|
|
90
|
-
handleTelegramCompletionMessage(message);
|
|
90
|
+
handleTelegramCompletionMessage(message, state);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
handleAuthorizationMessage(message, provider, state);
|
|
@@ -107,11 +107,21 @@ const createWindowOauth2Service = () => ({
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
const handleTelegramCompletionMessage = (message) => {
|
|
110
|
+
const handleTelegramCompletionMessage = (message, state) => {
|
|
111
111
|
logger.logger.debug('Telegram completion message received', {
|
|
112
112
|
data: message,
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
const { code, state: authState } = message;
|
|
115
|
+
// check that the state we receive from message is the same state we calculated earlier
|
|
116
|
+
// this could be an attack
|
|
117
|
+
if (state !== authState) {
|
|
118
|
+
typedReject({
|
|
119
|
+
code: types.SocialOAuthErrorCode.OAUTH_ERROR,
|
|
120
|
+
message: 'Failed to connect telegram account: Invalid random state',
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
resolve(code);
|
|
115
125
|
setIsProcessing(false);
|
|
116
126
|
};
|
|
117
127
|
const handleAuthorizationMessage = (message, provider, state) => {
|
|
@@ -83,7 +83,7 @@ const createWindowOauth2Service = () => ({
|
|
|
83
83
|
}
|
|
84
84
|
clearListeners();
|
|
85
85
|
if (isTelegramCompletedMessage) {
|
|
86
|
-
handleTelegramCompletionMessage(message);
|
|
86
|
+
handleTelegramCompletionMessage(message, state);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
handleAuthorizationMessage(message, provider, state);
|
|
@@ -103,11 +103,21 @@ const createWindowOauth2Service = () => ({
|
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
const handleTelegramCompletionMessage = (message) => {
|
|
106
|
+
const handleTelegramCompletionMessage = (message, state) => {
|
|
107
107
|
logger.debug('Telegram completion message received', {
|
|
108
108
|
data: message,
|
|
109
109
|
});
|
|
110
|
-
|
|
110
|
+
const { code, state: authState } = message;
|
|
111
|
+
// check that the state we receive from message is the same state we calculated earlier
|
|
112
|
+
// this could be an attack
|
|
113
|
+
if (state !== authState) {
|
|
114
|
+
typedReject({
|
|
115
|
+
code: SocialOAuthErrorCode.OAUTH_ERROR,
|
|
116
|
+
message: 'Failed to connect telegram account: Invalid random state',
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
resolve(code);
|
|
111
121
|
setIsProcessing(false);
|
|
112
122
|
};
|
|
113
123
|
const handleAuthorizationMessage = (message, provider, state) => {
|