get-random-values 1.2.2 → 2.1.0
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 +18 -0
- package/LICENSE.txt +1 -1
- package/index.d.ts +7 -0
- package/index.js +8 -0
- package/package.json +30 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [2.1.0](https://github.com/KenanY/get-random-values/compare/2.0.0...2.1.0) (2023-03-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add TypeScript declarations ([9a7f39f](https://github.com/KenanY/get-random-values/commit/9a7f39fbfca6b94699024619eccebeba83babc07))
|
|
7
|
+
|
|
8
|
+
## [2.0.0](https://github.com/KenanY/get-random-values/compare/1.2.2...2.0.0) (2022-06-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* Node.js v10 and v12 are no longer supported.
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* drop Node.js v10 and v12 support ([1e727b9](https://github.com/KenanY/get-random-values/commit/1e727b95bc162a7afbb6608687950101fae573ab))
|
|
18
|
+
|
|
1
19
|
### [1.2.2](https://github.com/KenanY/get-random-values/compare/1.2.1...1.2.2) (2020-08-25)
|
|
2
20
|
|
|
3
21
|
|
package/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2014–
|
|
1
|
+
Copyright 2014–2023 Kenan Yildirim <https://kenany.me/>
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
4
|
this software and associated documentation files (the "Software"), to deal in
|
package/index.d.ts
ADDED
package/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/* eslint-disable no-var, operator-linebreak */
|
|
2
|
+
|
|
1
3
|
var window = require('global/window');
|
|
2
4
|
var nodeCrypto = require('crypto');
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @template {ArrayBufferView | null} T
|
|
8
|
+
* @param {T} buf
|
|
9
|
+
* @returns {T}
|
|
10
|
+
*/
|
|
4
11
|
function getRandomValues(buf) {
|
|
5
12
|
if (window.crypto && window.crypto.getRandomValues) {
|
|
6
13
|
return window.crypto.getRandomValues(buf);
|
|
@@ -14,6 +21,7 @@ function getRandomValues(buf) {
|
|
|
14
21
|
}
|
|
15
22
|
if (buf.length > 65536) {
|
|
16
23
|
var e = new Error();
|
|
24
|
+
// @ts-expect-error
|
|
17
25
|
e.code = 22;
|
|
18
26
|
e.message = 'Failed to execute \'getRandomValues\' on \'Crypto\': The ' +
|
|
19
27
|
'ArrayBufferView\'s byte length (' + buf.length + ') exceeds the ' +
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-random-values",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "`window.crypto.getRandomValues` with fallback to Node.js crypto",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crypto"
|
|
7
7
|
],
|
|
8
8
|
"repository": "KenanY/get-random-values",
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"author": "Kenan Yildirim <kenan@kenany.me> (
|
|
10
|
+
"author": "Kenan Yildirim <kenan@kenany.me> (https://kenany.me/)",
|
|
11
11
|
"main": "index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
12
13
|
"files": [
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"index.d.ts",
|
|
13
16
|
"index.js",
|
|
14
17
|
"LICENSE.txt"
|
|
15
18
|
],
|
|
@@ -17,25 +20,39 @@
|
|
|
17
20
|
"test": "test"
|
|
18
21
|
},
|
|
19
22
|
"engines": {
|
|
20
|
-
"node": "
|
|
23
|
+
"node": "14 || 16 || >=18"
|
|
21
24
|
},
|
|
22
25
|
"scripts": {
|
|
26
|
+
"clean": "rimraf --glob test/**/*.d.ts *.d.ts",
|
|
27
|
+
"lint": "eslint .",
|
|
23
28
|
"release": "semantic-release",
|
|
24
|
-
"
|
|
29
|
+
"type-coverage": "type-coverage --at-least 100 --detail --strict",
|
|
30
|
+
"prebuild": "npm run clean",
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"pretest": "npm run build",
|
|
33
|
+
"test": "tape test/*.js",
|
|
34
|
+
"posttest": "npm run lint && npm run type-coverage",
|
|
35
|
+
"prepack": "npm run build"
|
|
25
36
|
},
|
|
26
37
|
"dependencies": {
|
|
27
38
|
"global": "^4.4.0"
|
|
28
39
|
},
|
|
29
40
|
"devDependencies": {
|
|
30
|
-
"@kenan/
|
|
31
|
-
"@semantic-release/changelog": "
|
|
32
|
-
"@semantic-release/git": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
41
|
+
"@kenan/eslint-config": "^10.0.1",
|
|
42
|
+
"@semantic-release/changelog": "^6.0.2",
|
|
43
|
+
"@semantic-release/git": "^10.0.1",
|
|
44
|
+
"@tsconfig/node14": "^1.0.3",
|
|
45
|
+
"@types/lodash.isfunction": "^3.0.7",
|
|
46
|
+
"@types/tape": "^4.13.3",
|
|
47
|
+
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
48
|
+
"eslint": "^8.36.0",
|
|
49
|
+
"is-browser": "^2.1.0",
|
|
50
|
+
"lodash.isfunction": "^3.0.9",
|
|
51
|
+
"rimraf": "^4.4.1",
|
|
52
|
+
"semantic-release": "^20.1.3",
|
|
53
|
+
"tape": "^5.6.3",
|
|
54
|
+
"type-coverage": "^2.25.0",
|
|
55
|
+
"typescript": "^4.9.5"
|
|
39
56
|
},
|
|
40
57
|
"browser": {
|
|
41
58
|
"crypto": false
|