@vardario/cognito-client 4.0.5 → 4.0.7
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/lib/browser.js +7 -5
- package/lib/cognito-client.d.ts +1 -1
- package/lib/cognito-client.js +6 -4
- package/lib/utils.js +1 -1
- package/package.json +2 -1
package/lib/browser.js
CHANGED
|
@@ -582,7 +582,7 @@ var N = BigInt(
|
|
|
582
582
|
"0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF"
|
|
583
583
|
);
|
|
584
584
|
var g = BigInt("0x2");
|
|
585
|
-
var k = BigInt("
|
|
585
|
+
var k = BigInt("0x538282c4354742d7cbbde2359fcf67f9f5b3a6b08791e5011b43b8a5b66d9ee6");
|
|
586
586
|
function padHex(bigInt) {
|
|
587
587
|
const HEX_MSB_REGEX = /^[89a-f]/i;
|
|
588
588
|
const isNegative = bigInt < 0n;
|
|
@@ -1111,15 +1111,17 @@ var CognitoClient = class {
|
|
|
1111
1111
|
*
|
|
1112
1112
|
* @throws {Error}
|
|
1113
1113
|
*/
|
|
1114
|
-
async handleCodeFlow(returnUrl, pkce) {
|
|
1114
|
+
async handleCodeFlow(returnUrl, pkce, state) {
|
|
1115
1115
|
if (this.oAuth === void 0) {
|
|
1116
1116
|
throw Error("You have to define oAuth options to use handleCodeFlow");
|
|
1117
1117
|
}
|
|
1118
1118
|
const url = new URL(returnUrl);
|
|
1119
1119
|
const code = url.searchParams.get("code");
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1120
|
+
if (code === null) {
|
|
1121
|
+
throw Error("code parameter is missing from return url.");
|
|
1122
|
+
}
|
|
1123
|
+
if (url.searchParams.get("state") !== state) {
|
|
1124
|
+
throw Error("State parameter does not match.");
|
|
1123
1125
|
}
|
|
1124
1126
|
const urlParams = new URLSearchParams();
|
|
1125
1127
|
urlParams.append("grant_type", "authorization_code");
|
package/lib/cognito-client.d.ts
CHANGED
|
@@ -452,7 +452,7 @@ export declare class CognitoClient {
|
|
|
452
452
|
*
|
|
453
453
|
* @throws {Error}
|
|
454
454
|
*/
|
|
455
|
-
handleCodeFlow(returnUrl: string, pkce: string): Promise<Session>;
|
|
455
|
+
handleCodeFlow(returnUrl: string, pkce: string, state: string): Promise<Session>;
|
|
456
456
|
/**
|
|
457
457
|
* Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user. Call this operation when your user signs out of your app. This results in the following behavior.
|
|
458
458
|
* @param accessToken Access token of the current user.
|
package/lib/cognito-client.js
CHANGED
|
@@ -408,15 +408,17 @@ export class CognitoClient {
|
|
|
408
408
|
*
|
|
409
409
|
* @throws {Error}
|
|
410
410
|
*/
|
|
411
|
-
async handleCodeFlow(returnUrl, pkce) {
|
|
411
|
+
async handleCodeFlow(returnUrl, pkce, state) {
|
|
412
412
|
if (this.oAuth === undefined) {
|
|
413
413
|
throw Error('You have to define oAuth options to use handleCodeFlow');
|
|
414
414
|
}
|
|
415
415
|
const url = new URL(returnUrl);
|
|
416
416
|
const code = url.searchParams.get('code');
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
if (code === null) {
|
|
418
|
+
throw Error('code parameter is missing from return url.');
|
|
419
|
+
}
|
|
420
|
+
if (url.searchParams.get('state') !== state) {
|
|
421
|
+
throw Error('State parameter does not match.');
|
|
420
422
|
}
|
|
421
423
|
const urlParams = new URLSearchParams();
|
|
422
424
|
urlParams.append('grant_type', 'authorization_code');
|
package/lib/utils.js
CHANGED
|
@@ -39,7 +39,7 @@ const N = BigInt('0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' +
|
|
|
39
39
|
'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' +
|
|
40
40
|
'43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF');
|
|
41
41
|
const g = BigInt('0x2');
|
|
42
|
-
const k = BigInt('
|
|
42
|
+
const k = BigInt('0x538282c4354742d7cbbde2359fcf67f9f5b3a6b08791e5011b43b8a5b66d9ee6');
|
|
43
43
|
export function padHex(bigInt) {
|
|
44
44
|
const HEX_MSB_REGEX = /^[89a-f]/i;
|
|
45
45
|
const isNegative = bigInt < 0n;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vardario/cognito-client",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sahin Vardar",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@aws-sdk/client-cognito-identity-provider": "^3.465.0",
|
|
29
29
|
"@types/jsdom": "^21.1.5",
|
|
30
|
+
"@types/node": "^20",
|
|
30
31
|
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
31
32
|
"@typescript-eslint/parser": "^6.11.0",
|
|
32
33
|
"esbuild": "^0.20.2",
|