@diia-inhouse/crypto 2.1.20 → 2.1.21

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/dist/index.d.ts CHANGED
@@ -8,5 +8,7 @@ import { JweService } from "./services/jwe.js";
8
8
  import { JwtService } from "./services/jwt.js";
9
9
  import { IdentifierConfig, IdentifierOps } from "./interfaces/identifier.js";
10
10
  import { IdentifierService } from "./services/identifier.js";
11
+ import "./services/index.js";
11
12
  import { CryptoDeps } from "./interfaces/deps.js";
12
- export { Algorithm, AuthConfig, AuthService, CryptoDeps, CryptoService, DocumentDecryptedData, DocumentEncryptedDataResult, HashService, IdentifierConfig, IdentifierOps, IdentifierService, JweService, Jwt, JwtHeader, JwtPayload, JwtService, JwtServiceParams, JwtToken, TokenSignOptions, TokenVerifyOptions };
13
+ import "./interfaces/index.js";
14
+ export { Algorithm, AuthConfig, AuthService, CryptoDeps, CryptoService, DocumentDecryptedData, DocumentEncryptedDataResult, HashService, IdentifierConfig, IdentifierOps, IdentifierService, JweService, type Jwt, type JwtHeader, type JwtPayload, JwtService, JwtServiceParams, JwtToken, TokenSignOptions, TokenVerifyOptions };
@@ -1,9 +1,7 @@
1
1
  import { JwtServiceParams } from "./jwt.js";
2
-
3
2
  //#region src/interfaces/auth.d.ts
4
- interface AuthConfig {
3
+ export interface AuthConfig {
5
4
  jwk?: string;
6
5
  jwt?: JwtServiceParams;
7
6
  }
8
- //#endregion
9
- export { AuthConfig };
7
+ //#endregion
@@ -1,10 +1,9 @@
1
1
  //#region src/interfaces/crypto.d.ts
2
- type DocumentDecryptedData = Record<string, unknown> & {
2
+ export type DocumentDecryptedData = Record<string, unknown> & {
3
3
  id: string;
4
4
  };
5
- interface DocumentEncryptedDataResult {
5
+ export interface DocumentEncryptedDataResult {
6
6
  hashData?: string;
7
7
  encryptedData: string;
8
8
  }
9
- //#endregion
10
- export { DocumentDecryptedData, DocumentEncryptedDataResult };
9
+ //#endregion
@@ -2,12 +2,12 @@ import { AuthService } from "../services/auth.js";
2
2
  import { HashService } from "../services/hash.js";
3
3
  import { CryptoService } from "../services/crypto.js";
4
4
  import { IdentifierService } from "../services/identifier.js";
5
+ import "../services/index.js";
5
6
  //#region src/interfaces/deps.d.ts
6
- type CryptoDeps = {
7
+ export type CryptoDeps = {
7
8
  auth?: AuthService;
8
9
  crypto?: CryptoService;
9
10
  hash?: HashService;
10
11
  identifier?: IdentifierService;
11
12
  };
12
- //#endregion
13
- export { CryptoDeps };
13
+ //#endregion
@@ -1,10 +1,9 @@
1
1
  //#region src/interfaces/identifier.d.ts
2
- interface IdentifierConfig {
2
+ export interface IdentifierConfig {
3
3
  salt: string;
4
4
  }
5
- interface IdentifierOps {
5
+ export interface IdentifierOps {
6
6
  customSalt?: string;
7
7
  prefix?: string;
8
8
  }
9
- //#endregion
10
- export { IdentifierConfig, IdentifierOps };
9
+ //#endregion
@@ -2,4 +2,5 @@ import { Algorithm, Jwt, JwtHeader, JwtPayload, JwtServiceParams, JwtToken, Toke
2
2
  import { AuthConfig } from "./auth.js";
3
3
  import { DocumentDecryptedData, DocumentEncryptedDataResult } from "./crypto.js";
4
4
  import { IdentifierConfig, IdentifierOps } from "./identifier.js";
5
- import { CryptoDeps } from "./deps.js";
5
+ import { CryptoDeps } from "./deps.js";
6
+ export { Algorithm, AuthConfig, CryptoDeps, DocumentDecryptedData, DocumentEncryptedDataResult, IdentifierConfig, IdentifierOps, type Jwt, type JwtHeader, type JwtPayload, JwtServiceParams, JwtToken, TokenSignOptions, TokenVerifyOptions };
@@ -1,25 +1,24 @@
1
1
  import { Jwt as Jwt$1, JwtHeader, JwtPayload as JwtPayload$1 } from "jsonwebtoken";
2
-
3
2
  //#region src/interfaces/jwt.d.ts
4
- interface JwtServiceParams {
3
+ export interface JwtServiceParams {
5
4
  tokenVerifyOptions: TokenVerifyOptions;
6
5
  tokenSignOptions?: TokenSignOptions;
7
6
  privateKey?: string;
8
7
  publicKey?: string;
9
8
  }
10
- interface TokenSignOptions {
9
+ export interface TokenSignOptions {
11
10
  algorithm: string;
12
11
  expiresIn: string;
13
12
  }
14
- type Algorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "none";
15
- interface TokenVerifyOptions {
13
+ export type Algorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "none";
14
+ export interface TokenVerifyOptions {
16
15
  algorithms: Algorithm[];
17
16
  ignoreExpiration: boolean;
18
17
  }
19
- interface JwtToken {
18
+ export interface JwtToken {
20
19
  data: string;
21
20
  exp?: number;
22
21
  iat?: number;
23
22
  }
24
23
  //#endregion
25
- export { Algorithm, type Jwt$1 as Jwt, type JwtHeader, type JwtPayload$1 as JwtPayload, JwtServiceParams, JwtToken, TokenSignOptions, TokenVerifyOptions };
24
+ export type { Jwt$1 as Jwt, JwtHeader, JwtPayload$1 as JwtPayload };
@@ -2,9 +2,8 @@ import { AuthConfig } from "../interfaces/auth.js";
2
2
  import { Jwt, VerifyOptions } from "jsonwebtoken";
3
3
  import { KeyObject } from "node:crypto";
4
4
  import { AcquirerTokenData, EResidentApplicantTokenData, EResidentTokenData, Logger, OnInit, PartnerTokenData, PortalUserTokenData, ServiceEntranceTokenData, ServiceUserTokenData, SessionType, TemporaryTokenData, TokenData, UserTokenData, VerifiedBaseTokenData } from "@diia-inhouse/types";
5
-
6
5
  //#region src/services/auth.d.ts
7
- declare class AuthService implements OnInit {
6
+ export declare class AuthService implements OnInit {
8
7
  private readonly authConfig;
9
8
  private readonly logger;
10
9
  private jwe;
@@ -37,5 +36,4 @@ declare class AuthService implements OnInit {
37
36
  private getJwtService;
38
37
  private getJweService;
39
38
  }
40
- //#endregion
41
- export { AuthService };
39
+ //#endregion
@@ -1,9 +1,8 @@
1
1
  import { AuthService } from "./auth.js";
2
2
  import { DocumentDecryptedData, DocumentEncryptedDataResult } from "../interfaces/crypto.js";
3
3
  import { HashService } from "./hash.js";
4
-
5
4
  //#region src/services/crypto.d.ts
6
- declare class CryptoService {
5
+ export declare class CryptoService {
7
6
  private readonly auth;
8
7
  private readonly hash;
9
8
  constructor(auth: AuthService, hash: HashService);
@@ -11,5 +10,4 @@ declare class CryptoService {
11
10
  generateHashData(dataToEncrypt: DocumentDecryptedData): string;
12
11
  decryptData<T>(encryptedData: string): Promise<T>;
13
12
  }
14
- //#endregion
15
- export { CryptoService };
13
+ //#endregion
@@ -1,9 +1,7 @@
1
1
  import { BinaryLike, BinaryToTextEncoding } from "node:crypto";
2
-
3
2
  //#region src/services/hash.d.ts
4
- declare class HashService {
3
+ export declare class HashService {
5
4
  hmac(data: string, secret: string, algorithm?: string, encodeTo?: BinaryToTextEncoding): string;
6
5
  hash(data: BinaryLike, algorithm?: string, encodeTo?: BinaryToTextEncoding): string;
7
6
  }
8
- //#endregion
9
- export { HashService };
7
+ //#endregion
@@ -1,12 +1,10 @@
1
1
  import { IdentifierConfig, IdentifierOps } from "../interfaces/identifier.js";
2
2
  import { SessionType } from "@diia-inhouse/types";
3
-
4
3
  //#region src/services/identifier.d.ts
5
- declare class IdentifierService {
4
+ export declare class IdentifierService {
6
5
  private readonly salt;
7
6
  constructor(identifierConfig: IdentifierConfig);
8
7
  createIdentifier(itn: string, ops?: IdentifierOps): string;
9
8
  getSessionTypeFromIdentifier(userIdentifier: string): SessionType;
10
9
  }
11
- //#endregion
12
- export { IdentifierService };
10
+ //#endregion
@@ -3,4 +3,5 @@ import { HashService } from "./hash.js";
3
3
  import { CryptoService } from "./crypto.js";
4
4
  import { JweService } from "./jwe.js";
5
5
  import { JwtService } from "./jwt.js";
6
- import { IdentifierService } from "./identifier.js";
6
+ import { IdentifierService } from "./identifier.js";
7
+ export { AuthService, CryptoService, HashService, IdentifierService, JweService, JwtService };
@@ -1,7 +1,7 @@
1
- import "./jwe.js";
2
- import "./jwt.js";
3
- import "./auth.js";
4
- import "./crypto.js";
5
- import "./identifier.js";
6
- import "./hash.js";
7
- export {};
1
+ import { JweService } from "./jwe.js";
2
+ import { JwtService } from "./jwt.js";
3
+ import { AuthService } from "./auth.js";
4
+ import { CryptoService } from "./crypto.js";
5
+ import { IdentifierService } from "./identifier.js";
6
+ import { HashService } from "./hash.js";
7
+ export { AuthService, CryptoService, HashService, IdentifierService, JweService, JwtService };
@@ -1,8 +1,7 @@
1
1
  import { JwtToken } from "../interfaces/jwt.js";
2
2
  import { Logger, OnInit, TokenData } from "@diia-inhouse/types";
3
-
4
3
  //#region src/services/jwe.d.ts
5
- declare class JweService implements OnInit {
4
+ export declare class JweService implements OnInit {
6
5
  private jwkSecretData;
7
6
  private logger;
8
7
  private key?;
@@ -13,5 +12,4 @@ declare class JweService implements OnInit {
13
12
  private handleUriData;
14
13
  private getKey;
15
14
  }
16
- //#endregion
17
- export { JweService };
15
+ //#endregion
@@ -1,9 +1,8 @@
1
1
  import { JwtServiceParams, JwtToken } from "../interfaces/jwt.js";
2
2
  import { DecodeOptions, Jwt, JwtPayload, VerifyOptions } from "jsonwebtoken";
3
3
  import { KeyObject } from "node:crypto";
4
-
5
4
  //#region src/services/jwt.d.ts
6
- declare class JwtService {
5
+ export declare class JwtService {
7
6
  private readonly privateKey;
8
7
  private readonly publicKey;
9
8
  private readonly tokenSignOptions;
@@ -26,5 +25,4 @@ declare class JwtService {
26
25
  json: true;
27
26
  }): null | JwtPayload;
28
27
  }
29
- //#endregion
30
- export { JwtService };
28
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diia-inhouse/crypto",
3
- "version": "2.1.20",
3
+ "version": "2.1.21",
4
4
  "type": "module",
5
5
  "description": "Tools for encryption and auth",
6
6
  "main": "dist/index.js",
@@ -45,27 +45,27 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@diia-inhouse/configs": "7.2.1",
48
- "@diia-inhouse/diia-logger": "4.4.63",
49
- "@diia-inhouse/errors": "2.2.25",
50
- "@diia-inhouse/oxc-config": "2.1.4",
51
- "@diia-inhouse/test": "8.3.12",
52
- "@diia-inhouse/types": "14.2.7",
53
- "@diia-inhouse/utils": "6.0.98",
54
- "@diia-inhouse/validators": "2.2.72",
48
+ "@diia-inhouse/diia-logger": "4.4.66",
49
+ "@diia-inhouse/errors": "2.2.27",
50
+ "@diia-inhouse/oxc-config": "2.1.6",
51
+ "@diia-inhouse/test": "8.3.15",
52
+ "@diia-inhouse/types": "14.2.9",
53
+ "@diia-inhouse/utils": "6.1.1",
54
+ "@diia-inhouse/validators": "2.2.74",
55
55
  "@types/node": "25.6.2",
56
56
  "@types/node-jose": "1.1.13",
57
- "@vitest/coverage-v8": "4.1.5",
58
- "@vitest/ui": "4.1.5",
57
+ "@vitest/coverage-v8": "4.1.11",
58
+ "@vitest/ui": "4.1.11",
59
59
  "glob": "13.0.6",
60
- "lockfile-lint": "5.0.0",
60
+ "lockfile-lint": "5.0.1",
61
61
  "madge": "8.0.0",
62
- "oxfmt": "0.48.0",
63
- "oxlint": "1.63.0",
64
- "oxlint-tsgolint": "0.22.1",
62
+ "oxfmt": "0.67.0",
63
+ "oxlint": "1.82.0",
64
+ "oxlint-tsgolint": "7.0.2001",
65
65
  "rimraf": "6.1.3",
66
- "tsdown": "0.22.0",
67
- "vitest": "4.1.5",
68
- "vitest-mock-extended": "4.0.0"
66
+ "tsdown": "0.23.0",
67
+ "vitest": "4.1.11",
68
+ "vitest-mock-extended": "5.1.1"
69
69
  },
70
70
  "release": {
71
71
  "extends": "@diia-inhouse/configs/dist/semantic-release/package",