cybertoken 2.0.3 → 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/biome.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "vcs": {
7
+ "enabled": true,
8
+ "clientKind": "git",
9
+ "useIgnoreFile": true
10
+ },
11
+ "linter": {
12
+ "enabled": true,
13
+ "rules": {
14
+ "recommended": true
15
+ }
16
+ },
17
+ "javascript": {
18
+ "formatter": {
19
+ "arrowParentheses": "asNeeded"
20
+ }
21
+ }
22
+ }
package/built/crc32.js CHANGED
@@ -46,7 +46,7 @@ const table = new Uint32Array([
46
46
  export default function crc32(inputBuffer) {
47
47
  const ds = new Uint8Array(inputBuffer);
48
48
  let crc = 0 ^ -1;
49
- for (var i = 0; i < ds.length; i++) {
49
+ for (let i = 0; i < ds.length; i++) {
50
50
  crc = (crc >>> 8) ^ table[(crc ^ ds[i]) & 0xff];
51
51
  }
52
52
  const result = new Uint8Array(4);
package/built/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import crc32 from "./crc32.js";
2
1
  import { base62, version } from "./constants.js";
2
+ import crc32 from "./crc32.js";
3
3
  import { getTokenPattern, parseTokenData } from "./parse.js";
4
4
  const cryptoServices = globalThis.crypto;
5
5
  export function createTokenGenerator(options) {
@@ -7,7 +7,7 @@ export function createTokenGenerator(options) {
7
7
  if (!options.prefixWithoutUnderscore) {
8
8
  throw new Error("The `prefixWithoutUnderscore` option is required and must not be an empty string.");
9
9
  }
10
- const prefixWithUnderscore = options.prefixWithoutUnderscore + "_";
10
+ const prefixWithUnderscore = `${options.prefixWithoutUnderscore}_`;
11
11
  const tokenPattern = getTokenPattern(prefixWithUnderscore);
12
12
  const tokenSecretByteCount = (_a = options.entropyBytes) !== null && _a !== void 0 ? _a : 22;
13
13
  if (tokenSecretByteCount <= 20) {
package/built/parse.js CHANGED
@@ -1,5 +1,5 @@
1
- import crc32 from "./crc32.js";
2
1
  import { alphabet, base62, version } from "./constants.js";
2
+ import crc32 from "./crc32.js";
3
3
  export function getTokenPattern(prefixWithUnderscore) {
4
4
  return new RegExp(`^${prefixWithUnderscore}[${alphabet}]+$`);
5
5
  }
package/jsr.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@cybertoken/cybertoken",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "exports": "./src/index.ts"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cybertoken",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
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,9 @@
14
14
  "scripts": {
15
15
  "compile": "tsc",
16
16
  "clean": "rimraf built",
17
+ "ci": "tsc --noEmit && biome ci ./src",
17
18
  "docs": "typedoc",
19
+ "format": "biome format --write ./src",
18
20
  "test": "tsc --noEmit && vitest run",
19
21
  "test:coverage": "vitest run --coverage",
20
22
  "test:watch": "vitest watch --coverage",
@@ -31,6 +33,7 @@
31
33
  "base-x": "^4.0.0"
32
34
  },
33
35
  "devDependencies": {
36
+ "@biomejs/biome": "^1.5.3",
34
37
  "@types/node": "^20.10.5",
35
38
  "@vitest/coverage-v8": "^1.1.0",
36
39
  "rimraf": "^5.0.5",