mirror of
https://github.com/tutao/tutanota.git
synced 2025-12-08 06:09:50 +00:00
WIP tsgo [ it's crashing :( ]
This commit is contained in:
parent
61a8348761
commit
d4aaa493f5
9 changed files with 90 additions and 82 deletions
76
libs/electron-updater.mjs
vendored
76
libs/electron-updater.mjs
vendored
|
|
@ -11603,55 +11603,47 @@ const coerce$1 = (version, options) => {
|
||||||
};
|
};
|
||||||
var coerce_1 = coerce$1;
|
var coerce_1 = coerce$1;
|
||||||
|
|
||||||
var lrucache;
|
class LRUCache {
|
||||||
var hasRequiredLrucache;
|
constructor () {
|
||||||
|
this.max = 1000;
|
||||||
|
this.map = new Map();
|
||||||
|
}
|
||||||
|
|
||||||
function requireLrucache () {
|
get (key) {
|
||||||
if (hasRequiredLrucache) return lrucache;
|
const value = this.map.get(key);
|
||||||
hasRequiredLrucache = 1;
|
if (value === undefined) {
|
||||||
class LRUCache {
|
return undefined
|
||||||
constructor () {
|
} else {
|
||||||
this.max = 1000;
|
// Remove the key from the map and add it to the end
|
||||||
this.map = new Map();
|
this.map.delete(key);
|
||||||
}
|
this.map.set(key, value);
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get (key) {
|
delete (key) {
|
||||||
const value = this.map.get(key);
|
return this.map.delete(key)
|
||||||
if (value === undefined) {
|
}
|
||||||
return undefined
|
|
||||||
} else {
|
|
||||||
// Remove the key from the map and add it to the end
|
|
||||||
this.map.delete(key);
|
|
||||||
this.map.set(key, value);
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete (key) {
|
set (key, value) {
|
||||||
return this.map.delete(key)
|
const deleted = this.delete(key);
|
||||||
}
|
|
||||||
|
|
||||||
set (key, value) {
|
if (!deleted && value !== undefined) {
|
||||||
const deleted = this.delete(key);
|
// If cache is full, delete the least recently used item
|
||||||
|
if (this.map.size >= this.max) {
|
||||||
|
const firstKey = this.map.keys().next().value;
|
||||||
|
this.delete(firstKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (!deleted && value !== undefined) {
|
this.map.set(key, value);
|
||||||
// If cache is full, delete the least recently used item
|
}
|
||||||
if (this.map.size >= this.max) {
|
|
||||||
const firstKey = this.map.keys().next().value;
|
|
||||||
this.delete(firstKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.map.set(key, value);
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lrucache = LRUCache;
|
|
||||||
return lrucache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lrucache = LRUCache;
|
||||||
|
|
||||||
var range;
|
var range;
|
||||||
var hasRequiredRange;
|
var hasRequiredRange;
|
||||||
|
|
||||||
|
|
@ -11872,7 +11864,7 @@ function requireRange () {
|
||||||
|
|
||||||
range = Range;
|
range = Range;
|
||||||
|
|
||||||
const LRU = requireLrucache();
|
const LRU = lrucache;
|
||||||
const cache = new LRU();
|
const cache = new LRU();
|
||||||
|
|
||||||
const parseOptions = parseOptions_1;
|
const parseOptions = parseOptions_1;
|
||||||
|
|
|
||||||
62
package-lock.json
generated
62
package-lock.json
generated
|
|
@ -4574,28 +4574,28 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview": {
|
"node_modules/@typescript/native-preview": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-nyMp0ybgJVZFtDOWmcKDqaRqtj8dOg65+fDxbjIrnZuMWIqlOUGH+imFwofqlW+KndAA7KtAio2YSZMMZB25WA==",
|
"integrity": "sha512-4nae7v1KJNga2zHEak87PNF2KZjwYpueaPtBnNEU7Sb8Lh+oIWG5Iqia9lXuvpjOKd0mign9SNUO+fgj/VB3CA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsgo": "bin/tsgo.js"
|
"tsgo": "bin/tsgo.js"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@typescript/native-preview-darwin-arm64": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-darwin-arm64": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-darwin-x64": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-darwin-x64": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-linux-arm": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-linux-arm": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-linux-arm64": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-linux-arm64": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-linux-x64": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-linux-x64": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-win32-arm64": "7.0.0-dev.20251204.1",
|
"@typescript/native-preview-win32-arm64": "7.0.0-dev.20251205.1",
|
||||||
"@typescript/native-preview-win32-x64": "7.0.0-dev.20251204.1"
|
"@typescript/native-preview-win32-x64": "7.0.0-dev.20251205.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-darwin-arm64": {
|
"node_modules/@typescript/native-preview-darwin-arm64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-CgIzuO/LFRufdVjJmll6x7jnejYqqLo4kJwrsUxQipJ/dcGeP0q2XMcxNBzT7F9L4Sd5dphRPOZFXES4kS0lig==",
|
"integrity": "sha512-gDYe0y5MFr28jqPlKVQbvCsrodAnKB4KxL4WJhAiJ/sbRdbBEu1WjTS6n5ws8Ci1SuGXUBPI00kIL4BdZopKqw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -4607,9 +4607,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-darwin-x64": {
|
"node_modules/@typescript/native-preview-darwin-x64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-X76oQeDMQHJiukkPPbk7STrfu97pfPe5ixwiN6nXzSGXLE+tzrXRecNkYhz4XWeAW2ASNmGwDJJ2RAU5l8MbgQ==",
|
"integrity": "sha512-j/l25AGlW1TDgHbw5O/Y1L++A2TCEtddcn9hTW0g4y1WMMMa8hjRQfg0NE7u4rPbBNWfoYLnedcM3hr83gPmpA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -4621,9 +4621,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-linux-arm": {
|
"node_modules/@typescript/native-preview-linux-arm": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-3zl/Jj5rzkK9Oo5KVSIW+6bzRligoI+ZnA1xLpg0BBH2sk27a8Vasj7ZaGPlFvlSegvcaJdIjSt7Z8nBtiF9Ww==",
|
"integrity": "sha512-VYKQvVl/9qQ004fWdg6HDXF3PZbd1sZMcRN/LA55JesJI0xWqNkP5NQlB//4kan5+F6SX8+IyZDIoW0A2d6dqw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
|
@ -4635,9 +4635,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-linux-arm64": {
|
"node_modules/@typescript/native-preview-linux-arm64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-+1as+h6ZNpc9TqlHwvDkBP7jg0FoCMUf6Rrc9/Mkllau6etznfVsWMADWT4t76gkGZKUIXOZqsl2Ya3uaBrCBQ==",
|
"integrity": "sha512-jBPA0GV98C8i/K+ZIEP4b3A20o0fsDz8C+UjG52mnzek6gUiG7tbZ5mVONhMBcbLfRT3b/8giq9iN0vJEC0UfA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -4649,9 +4649,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-linux-x64": {
|
"node_modules/@typescript/native-preview-linux-x64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-YD//l6yv7iPNlKn9OZDzBxrI+QGLN6d4RV3dSucsyq/YNZUulcywGztbZiaQxdUzKPwj70G+LVb9WCgf5ITOIQ==",
|
"integrity": "sha512-HYlaVfNLGxbatJsWWn0StJ898DC3WbBKSJ4E9+BLYWz0Y9sSE8cex9aBdAkSIn342qVv4VUPw7p8BP50MZ3a2A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -4663,9 +4663,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-win32-arm64": {
|
"node_modules/@typescript/native-preview-win32-arm64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-eDXYR5qfPFA8EfQ0d9SbWGLn02VbAaeTM9jQ5VeLlPLcBP81nGRaGQ9Quta5zeEHev1S9iCdyRj5BqCRtl0ohw==",
|
"integrity": "sha512-xmIGqzkeb0dT4yB/N0uJ4GcR1JzkIU/af/jraFcfPHhwcQ54sFLChJGKZnow2mPLYu4tI2dLhLcifP7coQs5qw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -4677,9 +4677,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@typescript/native-preview-win32-x64": {
|
"node_modules/@typescript/native-preview-win32-x64": {
|
||||||
"version": "7.0.0-dev.20251204.1",
|
"version": "7.0.0-dev.20251205.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20251204.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20251205.1.tgz",
|
||||||
"integrity": "sha512-CRWI2OPdqXbzOU52R2abWMb3Ie2Wp6VPrCFzR3pzP53JabTAe8+XoBWlont9bw/NsqbPKp2aQbdfbLQX5RI44g==",
|
"integrity": "sha512-Tn33QPqswaFWTkHJ1DokHor91f/lGNbOp1FdsKamqEtRtZXAmhtbLShR21YiUatdY4DjBRkZNkk1jgIc03NYNA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export function aes256RandomKey(): Aes256Key {
|
||||||
return uint8ArrayToBitArray(random.generateRandomData(KEY_LENGTH_BYTES_AES_256))
|
return uint8ArrayToBitArray(random.generateRandomData(KEY_LENGTH_BYTES_AES_256))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateIV(): Uint8Array {
|
export function generateIV(): Uint8Array<ArrayBuffer> {
|
||||||
return random.generateRandomData(IV_BYTE_LENGTH)
|
return random.generateRandomData(IV_BYTE_LENGTH)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,7 +76,12 @@ export function aesEncrypt(key: AesKey, bytes: Uint8Array, iv: Uint8Array = gene
|
||||||
* @param usePadding If true, padding is used, otherwise no padding is used and the encrypted data must have the key size.
|
* @param usePadding If true, padding is used, otherwise no padding is used and the encrypted data must have the key size.
|
||||||
* @return The encrypted text as words (sjcl internal structure)..
|
* @return The encrypted text as words (sjcl internal structure)..
|
||||||
*/
|
*/
|
||||||
export function aes256EncryptSearchIndexEntry(key: Aes256Key, bytes: Uint8Array, iv: Uint8Array = generateIV(), usePadding: boolean = true): Uint8Array {
|
export function aes256EncryptSearchIndexEntry(
|
||||||
|
key: Aes256Key,
|
||||||
|
bytes: Uint8Array<ArrayBuffer>,
|
||||||
|
iv: Uint8Array<ArrayBuffer> = generateIV(),
|
||||||
|
usePadding: boolean = true,
|
||||||
|
): Uint8Array {
|
||||||
verifyKeySize(key, [KEY_LENGTH_BITS_AES_256])
|
verifyKeySize(key, [KEY_LENGTH_BITS_AES_256])
|
||||||
|
|
||||||
if (iv.length !== IV_BYTE_LENGTH) {
|
if (iv.length !== IV_BYTE_LENGTH) {
|
||||||
|
|
@ -197,7 +202,7 @@ export function getAesSubKeys(
|
||||||
cKey: AesKey
|
cKey: AesKey
|
||||||
} {
|
} {
|
||||||
if (mac) {
|
if (mac) {
|
||||||
let hashedKey: Uint8Array
|
let hashedKey: Uint8Array<ArrayBuffer>
|
||||||
switch (getKeyLengthBytes(key)) {
|
switch (getKeyLengthBytes(key)) {
|
||||||
case KEY_LENGTH_BYTES_AES_128:
|
case KEY_LENGTH_BYTES_AES_128:
|
||||||
hashedKey = sha256Hash(bitArrayToUint8Array(key))
|
hashedKey = sha256Hash(bitArrayToUint8Array(key))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { AesKey } from "./Aes.js"
|
import { AesKey } from "./Aes.js"
|
||||||
import sjcl from "../internal/sjcl.js"
|
import sjcl from "../internal/sjcl.js"
|
||||||
import { bitArrayToUint8Array, uint8ArrayToBitArray } from "../misc/Utils.js"
|
import { bitArrayToUint8Array, uint8ArrayToBitArray } from "../misc/Utils.js"
|
||||||
import { arrayEquals } from "@tutao/tutanota-utils"
|
|
||||||
import { CryptoError } from "../misc/CryptoError.js"
|
import { CryptoError } from "../misc/CryptoError.js"
|
||||||
|
|
||||||
export type MacTag = Uint8Array & { __brand: "macTag" }
|
export type MacTag = Uint8Array & { __brand: "macTag" }
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ const RSA_PUBLIC_EXPONENT = 65537
|
||||||
interface BigInteger {
|
interface BigInteger {
|
||||||
clone(): BigInteger
|
clone(): BigInteger
|
||||||
toByteArray(): Uint8Array
|
toByteArray(): Uint8Array
|
||||||
|
toString(radix: number): string
|
||||||
|
bitLength(): number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RSAKey {
|
interface RSAKey {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// @ts-ignore[untyped-import]
|
import bCryptUntyped from "../internal/bCrypt.js"
|
||||||
import bCrypt from "../internal/bCrypt.js"
|
|
||||||
import { random } from "../random/Randomizer.js"
|
import { random } from "../random/Randomizer.js"
|
||||||
import { stringToUtf8Uint8Array } from "@tutao/tutanota-utils"
|
import { stringToUtf8Uint8Array } from "@tutao/tutanota-utils"
|
||||||
import { uint8ArrayToBitArray } from "../misc/Utils.js"
|
import { uint8ArrayToBitArray } from "../misc/Utils.js"
|
||||||
|
|
@ -8,6 +7,16 @@ import { CryptoError } from "../misc/CryptoError.js"
|
||||||
import { sha256Hash } from "./Sha256.js"
|
import { sha256Hash } from "./Sha256.js"
|
||||||
import { AesKey } from "../encryption/Aes.js"
|
import { AesKey } from "../encryption/Aes.js"
|
||||||
|
|
||||||
|
const bCrypt = bCryptUntyped as unknown as BcryptConstructor
|
||||||
|
|
||||||
|
interface Bcrypt {
|
||||||
|
crypt_raw(password: SignedBytes, salt: SignedBytes, log_rounds: number): SignedBytes
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BcryptConstructor {
|
||||||
|
new (): Bcrypt
|
||||||
|
}
|
||||||
|
|
||||||
const logRounds = 8 // pbkdf2 number of iterations
|
const logRounds = 8 // pbkdf2 number of iterations
|
||||||
|
|
||||||
export type SignedBytes = number[]
|
export type SignedBytes = number[]
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export const SHA256_HASH_LENGTH_BYTES = 32
|
||||||
* @param uint8Array The bytes.
|
* @param uint8Array The bytes.
|
||||||
* @return The hash.
|
* @return The hash.
|
||||||
*/
|
*/
|
||||||
export function sha256Hash(uint8Array: Uint8Array): Uint8Array {
|
export function sha256Hash(uint8Array: Uint8Array): Uint8Array<ArrayBuffer> {
|
||||||
try {
|
try {
|
||||||
sha256.update(sjcl.codec.arrayBuffer.toBits(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength))
|
sha256.update(sjcl.codec.arrayBuffer.toBits(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength))
|
||||||
return new Uint8Array(sjcl.codec.arrayBuffer.fromBits(sha256.finalize(), false))
|
return new Uint8Array(sjcl.codec.arrayBuffer.fromBits(sha256.finalize(), false))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore[untyped-import]
|
// @ts-ignore[untyped-import]
|
||||||
import sjcl from "../internal/sjcl.js"
|
import sjcl from "../internal/sjcl.js"
|
||||||
|
|
||||||
const sha512 = new sjcl.hash.sha512()
|
const sha512 = new sjcl.hash.sha512()
|
||||||
export const SHA512_HASH_LENGTH_BYTES = 64
|
export const SHA512_HASH_LENGTH_BYTES = 64
|
||||||
|
|
||||||
|
|
@ -8,7 +9,7 @@ export const SHA512_HASH_LENGTH_BYTES = 64
|
||||||
* @param uint8Array The bytes.
|
* @param uint8Array The bytes.
|
||||||
* @return The hash.
|
* @return The hash.
|
||||||
*/
|
*/
|
||||||
export function sha512Hash(uint8Array: Uint8Array): Uint8Array {
|
export function sha512Hash(uint8Array: Uint8Array): Uint8Array<ArrayBuffer> {
|
||||||
try {
|
try {
|
||||||
sha512.update(sjcl.codec.arrayBuffer.toBits(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength))
|
sha512.update(sjcl.codec.arrayBuffer.toBits(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength))
|
||||||
return new Uint8Array(sjcl.codec.arrayBuffer.fromBits(sha512.finalize(), false))
|
return new Uint8Array(sjcl.codec.arrayBuffer.fromBits(sha512.finalize(), false))
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export class Randomizer {
|
||||||
* @return A hex coded string of random data.
|
* @return A hex coded string of random data.
|
||||||
* @throws {CryptoError} if the randomizer is not seeded (isReady == false)
|
* @throws {CryptoError} if the randomizer is not seeded (isReady == false)
|
||||||
*/
|
*/
|
||||||
generateRandomData(nbrOfBytes: number): Uint8Array {
|
generateRandomData(nbrOfBytes: number): Uint8Array<ArrayBuffer> {
|
||||||
try {
|
try {
|
||||||
// read the minimal number of words to get nbrOfBytes
|
// read the minimal number of words to get nbrOfBytes
|
||||||
let nbrOfWords = Math.floor((nbrOfBytes + 3) / 4)
|
let nbrOfWords = Math.floor((nbrOfBytes + 3) / 4)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue