@arex95/vue-core 1.1.16 → 1.1.19

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.
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Converts an ArrayBuffer to a hexadecimal string.
3
+ * @param {Uint8Array} buffer - The Uint8Array to convert.
4
+ * @returns {string} The hexadecimal string representation.
5
+ */
6
+ declare function ab2hex(buffer: Uint8Array): string;
7
+ /**
8
+ * Converts a hexadecimal string to a Uint8Array.
9
+ * @param {string} hex - The hexadecimal string to convert.
10
+ * @returns {Uint8Array} The Uint8Array representation.
11
+ */
12
+ declare function hex2ab(hex: string): Uint8Array;
13
+ /**
14
+ * Imports a secret key for cryptographic operations.
15
+ * @param {string} secretKey - The string secret key.
16
+ * @returns {Promise<CryptoKey>} A Promise that resolves to the CryptoKey.
17
+ */
18
+ declare function importKey(secretKey: string): Promise<CryptoKey>;
1
19
  /**
2
20
  * Interface for the expected structure of a successful login response from the API.
3
21
  */
@@ -30,5 +48,10 @@ export declare function useAuth(secretKey?: string): {
30
48
  logout: (params?: object) => Promise<void>;
31
49
  cleanStorage: () => Promise<void>;
32
50
  verifyToken: () => Promise<void>;
51
+ ab2hex: typeof ab2hex;
52
+ hex2ab: typeof hex2ab;
53
+ importKey: typeof importKey;
54
+ encrypt: (value: string, secretKey: string) => Promise<string>;
55
+ decrypt: (value: string, secretKey: string) => Promise<string>;
33
56
  };
34
57
  export {};
package/dist/index.mjs CHANGED
@@ -3005,7 +3005,11 @@ function ab2hex(buffer) {
3005
3005
  * @returns {Uint8Array} The Uint8Array representation.
3006
3006
  */
3007
3007
  function hex2ab(hex) {
3008
- return new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
3008
+ const matches = hex.match(/.{1,2}/g);
3009
+ if (!matches) {
3010
+ return new Uint8Array([]);
3011
+ }
3012
+ return new Uint8Array(matches.map((byte) => parseInt(byte, 16)));
3009
3013
  }
3010
3014
  /**
3011
3015
  * Imports a secret key for cryptographic operations.
@@ -3276,6 +3280,11 @@ function useAuth(secretKey = getSecretKey()) {
3276
3280
  logout,
3277
3281
  cleanStorage,
3278
3282
  verifyToken,
3283
+ ab2hex,
3284
+ hex2ab,
3285
+ importKey,
3286
+ encrypt,
3287
+ decrypt,
3279
3288
  };
3280
3289
  }
3281
3290
 
package/package.json CHANGED
@@ -1,68 +1,75 @@
1
- {
2
- "name": "@arex95/vue-core",
3
- "version": "1.1.16",
4
- "description": "Opinionated Vue Core",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "exports": {
8
- "import": "./dist/index.mjs"
9
- },
10
- "types": "dist/index.d.ts",
11
- "type": "module",
12
- "files": [
13
- "dist"
14
- ],
15
- "scripts": {
16
- "build": "rollup -c",
17
- "changelog": "conventional-changelog -p angular -o CHANGELOG.md -r 0",
18
- "release": "npm version patch && npm run changelog && git add CHANGELOG.md package.json package-lock.json && git commit -m \"chore(release): update changelog\" && git push && npm publish --access public"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/Arex95/npm-arex-core.git"
23
- },
24
- "keywords": [
25
- "vue",
26
- "composables",
27
- "core",
28
- "npm"
29
- ],
30
- "author": "Arturo Rafael Serrano Girón",
31
- "license": "MIT",
32
- "peerDependencies": {
33
- "@tanstack/vue-query": ">=5.0.0",
34
- "@vueuse/core": ">=12.8.2",
35
- "axios": ">=1.6.0",
36
- "jwt-decode": "^4.0.0",
37
- "uuid": ">=11.1.0",
38
- "vue": ">=3.0.0",
39
- "vue-router": ">=4.5.0"
40
- },
41
- "devDependencies": {
42
- "@eslint/js": "^9.23.0",
43
- "@rollup/plugin-commonjs": "^28.0.3",
44
- "@rollup/plugin-json": "^6.1.0",
45
- "@rollup/plugin-node-resolve": "^16.0.0",
46
- "@rollup/plugin-typescript": "^12.1.2",
47
- "@types/crypto-js": "^4.2.2",
48
- "@types/node": "^22.13.10",
49
- "conventional-changelog-cli": "^5.0.0",
50
- "eslint": "^9.23.0",
51
- "eslint-plugin-vue": "^10.0.0",
52
- "globals": "^16.0.0",
53
- "rollup": "^4.35.0",
54
- "ts-node": "^10.9.2",
55
- "tslib": "^2.8.1",
56
- "typescript": "^5.8.2",
57
- "typescript-eslint": "^8.28.0"
58
- },
59
- "dependencies": {
60
- "@tanstack/vue-query": ">=5.0.0",
61
- "@vueuse/core": ">=12.8.2",
62
- "axios": ">=1.6.0",
63
- "jwt-decode": "^4.0.0",
64
- "uuid": ">=11.1.0",
65
- "vue": ">=3.0.0",
66
- "vue-router": ">=4.5.0"
67
- }
68
- }
1
+ {
2
+ "name": "@arex95/vue-core",
3
+ "version": "1.1.19",
4
+ "description": "Opinionated Vue Core",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "exports": {
8
+ "import": "./dist/index.mjs"
9
+ },
10
+ "types": "dist/index.d.ts",
11
+ "type": "module",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "rollup -c",
17
+ "changelog": "conventional-changelog -p angular -o CHANGELOG.md -r 0",
18
+ "release": "npm version patch && npm run changelog && git add CHANGELOG.md package.json pnpm-lock.yaml && git commit -m \"chore(release): update changelog\" && git push && npm publish --access public",
19
+ "test": "vitest",
20
+ "test:watch": "vitest --watch",
21
+ "test:ui": "vitest --ui"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/Arex95/npm-arex-core.git"
26
+ },
27
+ "keywords": [
28
+ "vue",
29
+ "composables",
30
+ "core",
31
+ "npm"
32
+ ],
33
+ "author": "Arturo Rafael Serrano Girón",
34
+ "license": "MIT",
35
+ "peerDependencies": {
36
+ "@tanstack/vue-query": ">=5.0.0",
37
+ "@vueuse/core": ">=12.8.2",
38
+ "axios": ">=1.6.0",
39
+ "jwt-decode": "^4.0.0",
40
+ "uuid": ">=11.1.0",
41
+ "vue": ">=3.0.0",
42
+ "vue-router": ">=4.5.0"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "^9.23.0",
46
+ "@rollup/plugin-commonjs": "^28.0.3",
47
+ "@rollup/plugin-json": "^6.1.0",
48
+ "@rollup/plugin-node-resolve": "^16.0.0",
49
+ "@rollup/plugin-typescript": "^12.1.2",
50
+ "@types/crypto-js": "^4.2.2",
51
+ "@types/node": "^22.13.10",
52
+ "@vitest/ui": "^3.2.3",
53
+ "@vue/test-utils": "^2.4.6",
54
+ "conventional-changelog-cli": "^5.0.0",
55
+ "eslint": "^9.23.0",
56
+ "eslint-plugin-vue": "^10.0.0",
57
+ "globals": "^16.0.0",
58
+ "jsdom": "^26.1.0",
59
+ "rollup": "^4.35.0",
60
+ "ts-node": "^10.9.2",
61
+ "tslib": "^2.8.1",
62
+ "typescript": "^5.8.2",
63
+ "typescript-eslint": "^8.28.0",
64
+ "vitest": "^3.2.3"
65
+ },
66
+ "dependencies": {
67
+ "@tanstack/vue-query": ">=5.0.0",
68
+ "@vueuse/core": ">=12.8.2",
69
+ "axios": ">=1.6.0",
70
+ "jwt-decode": "^4.0.0",
71
+ "uuid": ">=11.1.0",
72
+ "vue": ">=3.0.0",
73
+ "vue-router": ">=4.5.0"
74
+ }
75
+ }