@jvsoft/utils 1.0.0-alpha.11 → 1.0.0-alpha.12
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/fesm2022/jvsoft-utils-functions.mjs +19 -14
- package/fesm2022/jvsoft-utils-functions.mjs.map +1 -1
- package/fesm2022/jvsoft-utils-services.mjs +128 -2
- package/fesm2022/jvsoft-utils-services.mjs.map +1 -1
- package/fesm2022/jvsoft-utils.mjs +220 -28
- package/fesm2022/jvsoft-utils.mjs.map +1 -1
- package/functions/string.d.ts +7 -0
- package/interceptors/encryption.interceptor.d.ts +7 -0
- package/interceptors/public-api.d.ts +1 -0
- package/package.json +9 -10
- package/public-api.d.ts +1 -0
- package/services/encryption.service.d.ts +40 -0
- package/services/public-api.d.ts +1 -0
package/functions/string.d.ts
CHANGED
|
@@ -21,3 +21,10 @@ export declare const extraerDominio: (url: string | null | undefined, options?:
|
|
|
21
21
|
includePort?: boolean;
|
|
22
22
|
includeProtocol?: boolean;
|
|
23
23
|
}) => string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Genera un hash numérico simple a partir de una cadena (versión ligera de shorthash2).
|
|
26
|
+
* Útil para generar identificadores únicos deterministas basados en contenido.
|
|
27
|
+
* @param str Cadena a hashear
|
|
28
|
+
* @returns Hash alfanumérico en base 36
|
|
29
|
+
*/
|
|
30
|
+
export declare function simpleHash(str: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HttpInterceptorFn } from '@angular/common/http';
|
|
2
|
+
/**
|
|
3
|
+
* Interceptor de Encriptación Híbrida.
|
|
4
|
+
* Detecta el header 'X-Secure-Request: true'.
|
|
5
|
+
* Autogestiona la descarga de llaves y reintenta ante errores de desencriptación.
|
|
6
|
+
*/
|
|
7
|
+
export declare const encryptionInterceptor: HttpInterceptorFn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './encryption.interceptor';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvsoft/utils",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.12",
|
|
4
4
|
"description": "JVSOFT Angular Utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"tag": "alpha",
|
|
@@ -12,16 +12,18 @@
|
|
|
12
12
|
"@angular/core": ">=17.1.0",
|
|
13
13
|
"@angular/forms": ">=17.1.0",
|
|
14
14
|
"@angular/material": ">=17.1.0",
|
|
15
|
-
"@rxweb/reactive-form-validators": ">=13.0.0",
|
|
16
15
|
"crypto-js": "^4.2.0",
|
|
17
16
|
"date-fns": ">=3.0.0",
|
|
18
17
|
"file-saver": "^2.0.5",
|
|
18
|
+
"jsencrypt": "^3.5.4",
|
|
19
19
|
"jwt-decode": "^4.0.0",
|
|
20
|
-
"moment": "^2.30.1",
|
|
21
20
|
"ngx-toastr": "^19.0.0",
|
|
22
21
|
"sweetalert2": "^11.17.2",
|
|
23
22
|
"xlsx": "^0.18.5"
|
|
24
23
|
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tslib": "^2.3.0"
|
|
26
|
+
},
|
|
25
27
|
"sideEffects": false,
|
|
26
28
|
"module": "fesm2022/jvsoft-utils.mjs",
|
|
27
29
|
"typings": "index.d.ts",
|
|
@@ -37,14 +39,14 @@
|
|
|
37
39
|
"types": "./directives/index.d.ts",
|
|
38
40
|
"default": "./fesm2022/jvsoft-utils-directives.mjs"
|
|
39
41
|
},
|
|
40
|
-
"./functions": {
|
|
41
|
-
"types": "./functions/index.d.ts",
|
|
42
|
-
"default": "./fesm2022/jvsoft-utils-functions.mjs"
|
|
43
|
-
},
|
|
44
42
|
"./interfaces": {
|
|
45
43
|
"types": "./interfaces/index.d.ts",
|
|
46
44
|
"default": "./fesm2022/jvsoft-utils-interfaces.mjs"
|
|
47
45
|
},
|
|
46
|
+
"./functions": {
|
|
47
|
+
"types": "./functions/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/jvsoft-utils-functions.mjs"
|
|
49
|
+
},
|
|
48
50
|
"./pipes": {
|
|
49
51
|
"types": "./pipes/index.d.ts",
|
|
50
52
|
"default": "./fesm2022/jvsoft-utils-pipes.mjs"
|
|
@@ -53,8 +55,5 @@
|
|
|
53
55
|
"types": "./services/index.d.ts",
|
|
54
56
|
"default": "./fesm2022/jvsoft-utils-services.mjs"
|
|
55
57
|
}
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"tslib": "^2.3.0"
|
|
59
58
|
}
|
|
60
59
|
}
|
package/public-api.d.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export interface EncryptedPayload {
|
|
4
|
+
payload: string;
|
|
5
|
+
keys: string;
|
|
6
|
+
}
|
|
7
|
+
export interface EncryptionConfig {
|
|
8
|
+
publicKeyUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const ENCRYPTION_CONFIG: InjectionToken<EncryptionConfig>;
|
|
11
|
+
export declare class EncryptionService {
|
|
12
|
+
private readonly http;
|
|
13
|
+
private readonly reloj;
|
|
14
|
+
private readonly config;
|
|
15
|
+
private readonly PUBLIC_KEY_URL;
|
|
16
|
+
private readonly CACHE_KEY;
|
|
17
|
+
private publicKey;
|
|
18
|
+
private pendingFetch?;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Obtiene la llave pública del servidor.
|
|
22
|
+
* Utiliza la Signal (RAM) primariamente, luego localStorage.
|
|
23
|
+
* Maneja peticiones concurrentes de forma que solo se dispare una descarga.
|
|
24
|
+
*/
|
|
25
|
+
getPublicKey(): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Fuerza la limpieza del caché y descarga una nueva llave.
|
|
28
|
+
* Útil para auto-saneamiento cuando el backend reporta error de desencriptación.
|
|
29
|
+
*/
|
|
30
|
+
forceRefreshPublicKey(): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Encriptación Híbrida (RSA + AES-256-CBC)
|
|
33
|
+
*/
|
|
34
|
+
encryptHybrid(data: any): Promise<EncryptedPayload>;
|
|
35
|
+
private setPublicKey;
|
|
36
|
+
private loadCachedPublicKey;
|
|
37
|
+
private escucharCambiosOtrasPestanas;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EncryptionService, never>;
|
|
39
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EncryptionService>;
|
|
40
|
+
}
|
package/services/public-api.d.ts
CHANGED