cybertoken 1.0.2 → 1.0.6
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 +3 -3
- package/built/cli.d.ts +1 -0
- package/built/cli.js +1 -0
- package/built/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# cybertoken [](https://github.com/nikeee/cybertoken/actions/workflows/CI.yaml) [](https://www.npmjs.com/package/cybertoken)
|
|
1
|
+
# cybertoken [](https://github.com/nikeee/cybertoken/actions/workflows/CI.yaml) [](https://github.com/nikeee/cybertoken/actions/workflows/CI.yaml) [](https://www.npmjs.com/package/cybertoken)
|
|
2
2
|
|
|
3
|
-
A token format
|
|
3
|
+
A token format inspired by the GitHub's new API token format. Think of it as a standardized password format with some handy properties. Intended for API token and password generation.
|
|
4
4
|
|
|
5
5
|
## What is this?
|
|
6
6
|
|
|
@@ -85,7 +85,7 @@ myapitoken_161YNJQOaoFoWLaoXeMVHYyrSLhGPOjSBYBtxY6V3GqFFZKV
|
|
|
85
85
|
|
|
86
86
|
Explanation:
|
|
87
87
|
|
|
88
|
-
- `n-bytes` are `n` random bytes, but at least 21 (default:
|
|
88
|
+
- `n-bytes` are `n` random bytes, but at least 21 (default: 22), generated by a cryptographically secure random source
|
|
89
89
|
- `v` is a single byte containing the version of the cybertoken format used (currently, only `0x00`)
|
|
90
90
|
- The bytes are concatenated with the version and their CRC32 sum before base62 encoding
|
|
91
91
|
- base62 alphabet used: `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`
|
package/built/cli.d.ts
CHANGED
package/built/cli.js
CHANGED
package/built/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export function createTokenGenerator(options) {
|
|
|
10
10
|
}
|
|
11
11
|
const prefixWithUnderscore = options.prefixWithoutUnderscore + "_";
|
|
12
12
|
const tokenPattern = getTokenPattern(prefixWithUnderscore);
|
|
13
|
-
const tokenSecretByteCount = (_a = options.entropyBytes) !== null && _a !== void 0 ? _a :
|
|
13
|
+
const tokenSecretByteCount = (_a = options.entropyBytes) !== null && _a !== void 0 ? _a : 22;
|
|
14
14
|
if (tokenSecretByteCount <= 20) {
|
|
15
15
|
throw new Error("The token secret byte count (`entropyBytes`) must be greater than 20.");
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cybertoken",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "A token format for APIs inspired by the GitHub's API token format.",
|
|
5
5
|
"author": "Niklas Mollenhauer",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test": "tsc --noEmit && vitest run",
|
|
15
15
|
"test:coverage": "vitest run --coverage",
|
|
16
16
|
"test:watch": "vitest watch --coverage",
|
|
17
|
-
"
|
|
17
|
+
"prepublishOnly": "npm run clean && npm run compile"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"token",
|