@vardario/cognito-client 0.1.7 → 0.1.9
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/cognito-client.js +1 -0
- package/lib/utils.js +2 -9
- package/package.json +7 -4
package/lib/cognito-client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addSeconds } from "date-fns";
|
|
2
2
|
import hashJs from "hash.js";
|
|
3
3
|
import { BigInteger } from "jsbn";
|
|
4
|
+
import { Buffer } from "buffer";
|
|
4
5
|
import { AuthError, AuthException, getAuthError, } from "./error.js";
|
|
5
6
|
import { calculateSignature, calculateU, decodeJwt, generateA, generateSmallA, getPasswordAuthenticationKey, randomBytes, } from "./utils.js";
|
|
6
7
|
/**
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import formatInTimeZone from "date-fns-tz/formatInTimeZone";
|
|
2
2
|
import hashJs from "hash.js";
|
|
3
3
|
import { BigInteger } from "jsbn";
|
|
4
|
+
import rb from "randombytes";
|
|
4
5
|
const initN = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
|
|
5
6
|
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
|
|
6
7
|
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
|
|
@@ -112,13 +113,5 @@ export function decodeJwt(jwt) {
|
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
export async function randomBytes(num) {
|
|
115
|
-
|
|
116
|
-
const bytes = new Uint8Array(num);
|
|
117
|
-
window.crypto.getRandomValues(bytes);
|
|
118
|
-
return Buffer.from(bytes);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
const { randomBytes } = await import("node:crypto");
|
|
122
|
-
return randomBytes(num);
|
|
123
|
-
}
|
|
116
|
+
return rb(num);
|
|
124
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vardario/cognito-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,26 +11,29 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@vardario/cookies": "^0.1.4",
|
|
14
|
+
"buffer": "^6.0.3",
|
|
14
15
|
"date-fns": "^2.29.3",
|
|
15
16
|
"date-fns-tz": "^1.3.7",
|
|
17
|
+
"hash.js": "^1.1.7",
|
|
16
18
|
"jsbn": "^1.1.0",
|
|
17
|
-
"
|
|
19
|
+
"randombytes": "^2.1.0"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
22
|
"@aws-sdk/client-cognito-identity-provider": "^3.209.0",
|
|
21
23
|
"@types/jsbn": "^1.2.30",
|
|
22
24
|
"@types/jsdom": "^20.0.1",
|
|
25
|
+
"@types/randombytes": "^2.0.0",
|
|
23
26
|
"isomorphic-fetch": "^3.0.0",
|
|
24
27
|
"jsdom": "^20.0.2",
|
|
25
28
|
"testcontainers": "^9.0.0",
|
|
26
|
-
"
|
|
29
|
+
"typescript": "^5.1.3",
|
|
27
30
|
"vitest": "^0.31.0"
|
|
28
31
|
},
|
|
29
32
|
"repository": {
|
|
30
33
|
"type": "git",
|
|
31
34
|
"url": "git@github.com:vardario/cognito-client.git"
|
|
32
35
|
},
|
|
33
|
-
"packageManager": "pnpm@8.
|
|
36
|
+
"packageManager": "pnpm@8.6.0",
|
|
34
37
|
"scripts": {
|
|
35
38
|
"test": "vitest run",
|
|
36
39
|
"build": "tsc --build",
|