@vardario/cognito-client 0.1.8 → 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/utils.d.ts +0 -1
- package/lib/utils.js +2 -10
- package/package.json +4 -2
package/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { BigInteger } from "jsbn";
|
|
3
|
-
import { Buffer } from "buffer";
|
|
4
3
|
export declare function padHex(bigInt: BigInteger): string;
|
|
5
4
|
export declare function hashHexString(str: string): string;
|
|
6
5
|
export declare function hashBuffer(buffer: Buffer): string;
|
package/lib/utils.js
CHANGED
|
@@ -1,7 +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
|
|
4
|
+
import rb from "randombytes";
|
|
5
5
|
const initN = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
|
|
6
6
|
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
|
|
7
7
|
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
|
|
@@ -113,13 +113,5 @@ export function decodeJwt(jwt) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
export async function randomBytes(num) {
|
|
116
|
-
|
|
117
|
-
const bytes = new Uint8Array(num);
|
|
118
|
-
window.crypto.getRandomValues(bytes);
|
|
119
|
-
return Buffer.from(bytes);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
const { randomBytes } = await import("node:crypto");
|
|
123
|
-
return randomBytes(num);
|
|
124
|
-
}
|
|
116
|
+
return rb(num);
|
|
125
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",
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
"date-fns": "^2.29.3",
|
|
16
16
|
"date-fns-tz": "^1.3.7",
|
|
17
17
|
"hash.js": "^1.1.7",
|
|
18
|
-
"jsbn": "^1.1.0"
|
|
18
|
+
"jsbn": "^1.1.0",
|
|
19
|
+
"randombytes": "^2.1.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"@aws-sdk/client-cognito-identity-provider": "^3.209.0",
|
|
22
23
|
"@types/jsbn": "^1.2.30",
|
|
23
24
|
"@types/jsdom": "^20.0.1",
|
|
25
|
+
"@types/randombytes": "^2.0.0",
|
|
24
26
|
"isomorphic-fetch": "^3.0.0",
|
|
25
27
|
"jsdom": "^20.0.2",
|
|
26
28
|
"testcontainers": "^9.0.0",
|