secure-random-octet 5.0.3 → 6.0.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/README.md +2 -2
- package/dist/index.cjs +34 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +10 -0
- package/package.json +35 -23
- package/index.js +0 -14
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Generate a cryptographically secure octet.
|
|
|
5
5
|
## Example
|
|
6
6
|
|
|
7
7
|
``` javascript
|
|
8
|
-
|
|
8
|
+
import { secureRandomOctet } from 'secure-random-octet';
|
|
9
9
|
|
|
10
10
|
secureRandomOctet();
|
|
11
11
|
// => 4
|
|
@@ -20,7 +20,7 @@ $ npm install secure-random-octet
|
|
|
20
20
|
## API
|
|
21
21
|
|
|
22
22
|
``` javascript
|
|
23
|
-
|
|
23
|
+
import { secureRandomOctet } from 'secure-random-octet';
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### `secureRandomOctet()`
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let get_random_values = require("get-random-values");
|
|
25
|
+
get_random_values = __toESM(get_random_values);
|
|
26
|
+
//#region src/index.ts
|
|
27
|
+
/** Generates a cryptographically secure octet. */
|
|
28
|
+
function secureRandomOctet() {
|
|
29
|
+
const buf = new Uint8Array(1);
|
|
30
|
+
(0, get_random_values.default)(buf);
|
|
31
|
+
return buf[0];
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.secureRandomOctet = secureRandomOctet;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import getRandomValues from "get-random-values";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/** Generates a cryptographically secure octet. */
|
|
4
|
+
function secureRandomOctet() {
|
|
5
|
+
const buf = new Uint8Array(1);
|
|
6
|
+
getRandomValues(buf);
|
|
7
|
+
return buf[0];
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { secureRandomOctet };
|
package/package.json
CHANGED
|
@@ -1,48 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "secure-random-octet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Generate a cryptographically secure octet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crypto"
|
|
7
7
|
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Kenan Yildirim <kenan@kenany.me> (https://kenany.me/)",
|
|
8
10
|
"repository": {
|
|
9
11
|
"type": "git",
|
|
10
12
|
"url": "git+https://github.com/kenany/secure-random-octet.git"
|
|
11
13
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"main": "index.
|
|
14
|
+
"type": "commonjs",
|
|
15
|
+
"types": "dist/index.d.cts",
|
|
16
|
+
"main": "dist/index.cjs",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./*.mjs": {
|
|
23
|
+
"default": "./dist/*.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./*.cjs": {
|
|
26
|
+
"default": "./dist/*.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./*": {
|
|
29
|
+
"import": "./dist/*.mjs",
|
|
30
|
+
"require": "./dist/*.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
15
33
|
"files": [
|
|
16
|
-
"
|
|
34
|
+
"dist",
|
|
17
35
|
"LICENSE.txt"
|
|
18
36
|
],
|
|
19
|
-
"directories": {
|
|
20
|
-
"test": "test"
|
|
21
|
-
},
|
|
22
37
|
"engines": {
|
|
23
|
-
"node": "
|
|
38
|
+
"node": "22 || 24 || >=26"
|
|
24
39
|
},
|
|
25
40
|
"dependencies": {
|
|
26
|
-
"get-random-values": "^
|
|
41
|
+
"get-random-values": "^5.0.0"
|
|
27
42
|
},
|
|
28
43
|
"devDependencies": {
|
|
29
|
-
"@biomejs/biome": "2.4.
|
|
30
|
-
"@containerbase/semantic-release-pnpm": "1.
|
|
44
|
+
"@biomejs/biome": "2.4.15",
|
|
45
|
+
"@containerbase/semantic-release-pnpm": "1.4.1",
|
|
31
46
|
"@kenan/biome-config": "1.0.6",
|
|
32
47
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
33
|
-
"
|
|
34
|
-
"lodash.isfunction": "3.0.9",
|
|
35
|
-
"lodash.isnumber": "3.0.3",
|
|
36
|
-
"nyc": "18.0.0",
|
|
48
|
+
"publint": "0.3.21",
|
|
37
49
|
"semantic-release": "25.0.3",
|
|
38
|
-
"
|
|
50
|
+
"tsdown": "0.22.0",
|
|
51
|
+
"typescript": "6.0.3",
|
|
52
|
+
"vitest": "4.1.7"
|
|
39
53
|
},
|
|
40
54
|
"scripts": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"pretest": "pnpm run lint",
|
|
46
|
-
"test": "pnpm run tests-only"
|
|
55
|
+
"build": "tsdown && tsc --noEmit",
|
|
56
|
+
"lint": "biome check",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"publint": "publint --strict"
|
|
47
59
|
}
|
|
48
60
|
}
|
package/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const getRandomValues = require('get-random-values');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generates a cryptographically secure octet.
|
|
5
|
-
*
|
|
6
|
-
* @returns {number} A cryptographically secure octet
|
|
7
|
-
*/
|
|
8
|
-
function secureRandomOctet() {
|
|
9
|
-
const buf = new Uint8Array(1);
|
|
10
|
-
getRandomValues(buf);
|
|
11
|
-
return buf[0];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = secureRandomOctet;
|