@venizia/ignis-helpers 0.4.7-4 → 0.4.7-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.
Files changed (33) hide show
  1. package/dist/esm/core.d.ts +0 -1
  2. package/dist/esm/core.d.ts.map +1 -1
  3. package/dist/esm/core.js +1 -1
  4. package/dist/esm/core.js.map +1 -1
  5. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.d.ts +1 -1
  6. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.js +1 -1
  7. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.js.map +1 -1
  8. package/dist/esm/modules/crypto/algorithms/aes.engine.d.ts +1 -1
  9. package/dist/esm/modules/crypto/algorithms/aes.engine.js +2 -2
  10. package/dist/esm/modules/crypto/algorithms/aes.engine.js.map +1 -1
  11. package/dist/esm/modules/crypto/algorithms/index.d.ts +0 -1
  12. package/dist/esm/modules/crypto/algorithms/index.d.ts.map +1 -1
  13. package/dist/esm/modules/crypto/algorithms/index.js +0 -1
  14. package/dist/esm/modules/crypto/algorithms/index.js.map +1 -1
  15. package/dist/esm/modules/crypto/common/constants.d.ts +0 -2
  16. package/dist/esm/modules/crypto/common/constants.d.ts.map +1 -1
  17. package/dist/esm/modules/crypto/common/constants.js +0 -2
  18. package/dist/esm/modules/crypto/common/constants.js.map +1 -1
  19. package/dist/esm/modules/crypto/common/types.d.ts +0 -11
  20. package/dist/esm/modules/crypto/common/types.d.ts.map +1 -1
  21. package/dist/esm/modules/crypto/common/types.js.map +1 -1
  22. package/dist/esm/modules/env/app-env.d.ts +0 -1
  23. package/dist/esm/modules/env/app-env.d.ts.map +1 -1
  24. package/dist/esm/modules/env/app-env.js +0 -1
  25. package/dist/esm/modules/env/app-env.js.map +1 -1
  26. package/dist/esm/modules/redis/common/types.d.ts +2 -1
  27. package/dist/esm/modules/redis/common/types.d.ts.map +1 -1
  28. package/dist/esm/modules/redis/common/types.js.map +1 -1
  29. package/package.json +3 -3
  30. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.d.ts +0 -41
  31. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.d.ts.map +0 -1
  32. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js +0 -107
  33. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js.map +0 -1
@@ -35,6 +35,5 @@ export { ECDH } from './modules/crypto/algorithms/ecdh.algorithm.js';
35
35
  export type { ECDHAlgorithmType, IECDHEncryptedPayload, IECDHExtraOptions, } from './modules/crypto/algorithms/ecdh.algorithm.js';
36
36
  export { AESAlgorithms } from './modules/crypto/algorithms/aes.constants.js';
37
37
  export type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants.js';
38
- export type { IPayloadCipher } from './modules/crypto/common/types.js';
39
38
  export type { IRedisHelper } from './modules/redis/common/interfaces.js';
40
39
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAGzF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,cAAc,qDAAqD,CAAC;AAIpE,cAAc,qDAAqD,CAAC;AACpE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAG9B,cAAc,yDAAyD,CAAC;AACxE,Y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OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAKvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAClE,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4CAA4C,CAAC;AAKpD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/esm/core.js CHANGED
@@ -38,7 +38,7 @@ export { PerformanceUtility } from './utilities/performance.utility.js';
38
38
  export { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility.js';
39
39
  export { ProjectRootRegistry } from './utilities/project-root.utility.js';
40
40
  // `ECDH` is the one crypto algorithm that is browser-pure: it runs over `crypto.subtle`, `btoa` and `atob`. It and its
41
- // base class come by leaf path, never the algorithms barrel, which also carries `AES`, `LegacyAES` and `RSA`
41
+ // base class come by leaf path, never the algorithms barrel, which also carries `AES` and `RSA`
42
42
  // (server code: they use `Buffer`, and `AES` reads files with `node:fs`).
43
43
  export { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm.js';
44
44
  export { ECDH } from './modules/crypto/algorithms/ecdh.algorithm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,6FAA6F;AAC7F,8DAA8D;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,6HAA6H;AAC7H,iHAAiH;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,cAAc,qDAAqD,CAAC;AACpE,qGAAqG;AACrG,4FAA4F;AAC5F,oBAAoB;AACpB,cAAc,qDAAqD,CAAC;AACpE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,iGAAiG;AACjG,yFAAyF;AACzF,cAAc,yDAAyD,CAAC;AAExE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAcrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,gGAAgG;AAChG,6FAA6F;AAC7F,iGAAiG;AACjG,0DAA0D;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,uHAAuH;AACvH,6GAA6G;AAC7G,0EAA0E;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAOlE,+FAA+F;AAC/F,6GAA6G;AAC7G,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export { BaseHelper } from './modules/base';\n// By name, never `export *` from `./modules/env`: that barrel also carries `Environment` and\n// `applicationEnvironment`, both of which read `process.env`.\nexport { EnvironmentNames } from './modules/env/names';\nexport * from './modules/error';\nexport { LogLevels } from './modules/logger/common/types';\nexport type { ILogger, ILoggerProvider, TLogLevel } from './modules/logger/common/types';\n// The one way to get a logger, the same in the browser and on the server: `LoggerFactory` imports nothing from node, and its\n// default provider is the console. An application chooses another with `LoggerFactory.use({ provider, level })`.\nexport { ConsoleLogger } from './modules/logger/base/console';\nexport { LoggerFactory } from './modules/logger/factory';\nexport * from './modules/network/http-request/fetcher/base-fetcher';\n// The node fetcher carries no node builtin - its one `querystring.stringify` is written out - so the\n// framework HTTP layer is reachable from a browser bundle, and a connector on HTTP need not\n// re-implement one.\nexport * from './modules/network/http-request/fetcher/node-fetcher';\nexport * from './modules/network/http-request/base-network-request.helper';\nexport * from './modules/pool';\nexport * from './modules/queue/internal/hf';\nexport * from './modules/temporal';\nexport * from './modules/uid';\n// The url guard, pure half only: `UrlPolicy` decides a url and a literal address with string and\n// number work. Its sibling `UrlIngest` reaches `node:dns` and stays out of this subpath.\nexport * from './modules/network/utilities/url-safety/common/constants';\nexport type { IUrlSafetyPolicy } from './modules/network/utilities/url-safety/common/types';\nexport * from './modules/network/utilities/url-safety/policy';\nexport * from './modules/network/utilities/query-string';\nexport { RetryBackoffStrategies, RetryJitterModes } from './modules/retry/common/constants';\nexport type { TRetryBackoffStrategy, TRetryJitterMode } from './modules/retry/common/constants';\nexport type { IRetryBackoffOptions, IRetryContext } from './modules/retry/common/types';\nexport { RetryHelper } from './modules/retry/helper';\nexport { SlugHelper } from './modules/slug/helper';\nexport { TreeBuilder } from './modules/tree/builder';\nexport type {\n IBuildOptions,\n IHeightWhereOptions,\n ILeavesOptions,\n INodeWithPath,\n IPrintOptions,\n ITreeNode,\n IWalkAsyncOptions,\n IWalkOptions,\n TNodePredicate,\n TOnVisit,\n TOnVisitAsync,\n} from './modules/tree/common/types';\nexport { TreeWalker } from './modules/tree/walk';\n\n// Pure value/type utilities that already live under the root barrel's `./utilities` re-export -\n// that barrel also carries node-only siblings (module.utility.ts, request.utility.ts), so it\n// cannot itself become a subpath. Named one at a time here instead of widening the barrel: every\n// symbol below is verified free of node builtins/globals.\nexport { BuildInfoRegistry } from './utilities/build-info.utility';\nexport type { IBuildInfo, TBuildInfoRecord } from './utilities/build-info.utility';\nexport { ParseUtility } from './utilities/parse.utility';\nexport { PerformanceUtility } from './utilities/performance.utility';\nexport { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility';\nexport { ProjectRootRegistry } from './utilities/project-root.utility';\n\n// `ECDH` is the one crypto algorithm that is browser-pure: it runs over `crypto.subtle`, `btoa` and `atob`. It and its\n// base class come by leaf path, never the algorithms barrel, which also carries `AES`, `LegacyAES` and `RSA`\n// (server code: they use `Buffer`, and `AES` reads files with `node:fs`).\nexport { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm';\nexport { ECDH } from './modules/crypto/algorithms/ecdh.algorithm';\nexport type {\n ECDHAlgorithmType,\n IECDHEncryptedPayload,\n IECDHExtraOptions,\n} from './modules/crypto/algorithms/ecdh.algorithm';\n\n// Type-only: erased at compile time, so re-exporting these carries no runtime/bundle cost even\n// though the concrete classes they describe (the other crypto algorithms, the ioredis-backed helper) are not\n// themselves part of this pure surface.\nexport { AESAlgorithms } from './modules/crypto/algorithms/aes.constants';\nexport type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants';\nexport type { IPayloadCipher } from './modules/crypto/common/types';\nexport type { IRedisHelper } from './modules/redis/common/interfaces';\n"]}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,6FAA6F;AAC7F,8DAA8D;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,6HAA6H;AAC7H,iHAAiH;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,cAAc,qDAAqD,CAAC;AACpE,qGAAqG;AACrG,4FAA4F;AAC5F,oBAAoB;AACpB,cAAc,qDAAqD,CAAC;AACpE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,iGAAiG;AACjG,yFAAyF;AACzF,cAAc,yDAAyD,CAAC;AAExE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAcrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,gGAAgG;AAChG,6FAA6F;AAC7F,iGAAiG;AACjG,0DAA0D;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,uHAAuH;AACvH,gGAAgG;AAChG,0EAA0E;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAOlE,+FAA+F;AAC/F,6GAA6G;AAC7G,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export { BaseHelper } from './modules/base';\n// By name, never `export *` from `./modules/env`: that barrel also carries `Environment` and\n// `applicationEnvironment`, both of which read `process.env`.\nexport { EnvironmentNames } from './modules/env/names';\nexport * from './modules/error';\nexport { LogLevels } from './modules/logger/common/types';\nexport type { ILogger, ILoggerProvider, TLogLevel } from './modules/logger/common/types';\n// The one way to get a logger, the same in the browser and on the server: `LoggerFactory` imports nothing from node, and its\n// default provider is the console. An application chooses another with `LoggerFactory.use({ provider, level })`.\nexport { ConsoleLogger } from './modules/logger/base/console';\nexport { LoggerFactory } from './modules/logger/factory';\nexport * from './modules/network/http-request/fetcher/base-fetcher';\n// The node fetcher carries no node builtin - its one `querystring.stringify` is written out - so the\n// framework HTTP layer is reachable from a browser bundle, and a connector on HTTP need not\n// re-implement one.\nexport * from './modules/network/http-request/fetcher/node-fetcher';\nexport * from './modules/network/http-request/base-network-request.helper';\nexport * from './modules/pool';\nexport * from './modules/queue/internal/hf';\nexport * from './modules/temporal';\nexport * from './modules/uid';\n// The url guard, pure half only: `UrlPolicy` decides a url and a literal address with string and\n// number work. Its sibling `UrlIngest` reaches `node:dns` and stays out of this subpath.\nexport * from './modules/network/utilities/url-safety/common/constants';\nexport type { IUrlSafetyPolicy } from './modules/network/utilities/url-safety/common/types';\nexport * from './modules/network/utilities/url-safety/policy';\nexport * from './modules/network/utilities/query-string';\nexport { RetryBackoffStrategies, RetryJitterModes } from './modules/retry/common/constants';\nexport type { TRetryBackoffStrategy, TRetryJitterMode } from './modules/retry/common/constants';\nexport type { IRetryBackoffOptions, IRetryContext } from './modules/retry/common/types';\nexport { RetryHelper } from './modules/retry/helper';\nexport { SlugHelper } from './modules/slug/helper';\nexport { TreeBuilder } from './modules/tree/builder';\nexport type {\n IBuildOptions,\n IHeightWhereOptions,\n ILeavesOptions,\n INodeWithPath,\n IPrintOptions,\n ITreeNode,\n IWalkAsyncOptions,\n IWalkOptions,\n TNodePredicate,\n TOnVisit,\n TOnVisitAsync,\n} from './modules/tree/common/types';\nexport { TreeWalker } from './modules/tree/walk';\n\n// Pure value/type utilities that already live under the root barrel's `./utilities` re-export -\n// that barrel also carries node-only siblings (module.utility.ts, request.utility.ts), so it\n// cannot itself become a subpath. Named one at a time here instead of widening the barrel: every\n// symbol below is verified free of node builtins/globals.\nexport { BuildInfoRegistry } from './utilities/build-info.utility';\nexport type { IBuildInfo, TBuildInfoRecord } from './utilities/build-info.utility';\nexport { ParseUtility } from './utilities/parse.utility';\nexport { PerformanceUtility } from './utilities/performance.utility';\nexport { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility';\nexport { ProjectRootRegistry } from './utilities/project-root.utility';\n\n// `ECDH` is the one crypto algorithm that is browser-pure: it runs over `crypto.subtle`, `btoa` and `atob`. It and its\n// base class come by leaf path, never the algorithms barrel, which also carries `AES` and `RSA`\n// (server code: they use `Buffer`, and `AES` reads files with `node:fs`).\nexport { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm';\nexport { ECDH } from './modules/crypto/algorithms/ecdh.algorithm';\nexport type {\n ECDHAlgorithmType,\n IECDHEncryptedPayload,\n IECDHExtraOptions,\n} from './modules/crypto/algorithms/ecdh.algorithm';\n\n// Type-only: erased at compile time, so re-exporting these carries no runtime/bundle cost even\n// though the concrete classes they describe (the other crypto algorithms, the ioredis-backed helper) are not\n// themselves part of this pure surface.\nexport { AESAlgorithms } from './modules/crypto/algorithms/aes.constants';\nexport type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants';\nexport type { IRedisHelper } from './modules/redis/common/interfaces';\n"]}
@@ -4,7 +4,7 @@ import type { ICryptoAlgorithm } from '../common/types.js';
4
4
  * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no
5
5
  * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it
6
6
  * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs
7
- * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).
7
+ * `Buffer`) extends it for the server algorithms (`AES`, `RSA`).
8
8
  */
9
9
  export declare abstract class AbstractCryptoAlgorithm<AlgorithmType extends string, EncryptInputType = unknown, DecryptInputType = unknown, SecretKeyType = unknown, EncryptReturnType = unknown, DecryptReturnType = unknown, ExtraOptions = unknown> extends BaseHelper implements ICryptoAlgorithm<AlgorithmType, EncryptInputType, DecryptInputType, SecretKeyType, EncryptReturnType, DecryptReturnType, ExtraOptions> {
10
10
  algorithm: AlgorithmType;
@@ -3,7 +3,7 @@ import { BaseHelper } from '../../base.js';
3
3
  * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no
4
4
  * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it
5
5
  * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs
6
- * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).
6
+ * `Buffer`) extends it for the server algorithms (`AES`, `RSA`).
7
7
  */
8
8
  export class AbstractCryptoAlgorithm extends BaseHelper {
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.algorithm.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/abstract.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;GAKG;AACH,MAAM,OAAgB,uBASpB,SAAQ,UAAU;CAyBnB","sourcesContent":["import { BaseHelper } from '@/modules/base';\nimport type { ICryptoAlgorithm } from '../common/types';\n\n/**\n * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no\n * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it\n * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs\n * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).\n */\nexport abstract class AbstractCryptoAlgorithm<\n AlgorithmType extends string,\n EncryptInputType = unknown,\n DecryptInputType = unknown,\n SecretKeyType = unknown,\n EncryptReturnType = unknown,\n DecryptReturnType = unknown,\n ExtraOptions = unknown,\n>\n extends BaseHelper\n implements\n ICryptoAlgorithm<\n AlgorithmType,\n EncryptInputType,\n DecryptInputType,\n SecretKeyType,\n EncryptReturnType,\n DecryptReturnType,\n ExtraOptions\n >\n{\n algorithm: AlgorithmType;\n\n abstract encrypt(opts: {\n message: EncryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): EncryptReturnType;\n\n abstract decrypt(opts: {\n message: DecryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): DecryptReturnType;\n}\n"]}
1
+ {"version":3,"file":"abstract.algorithm.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/abstract.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;GAKG;AACH,MAAM,OAAgB,uBASpB,SAAQ,UAAU;CAyBnB","sourcesContent":["import { BaseHelper } from '@/modules/base';\nimport type { ICryptoAlgorithm } from '../common/types';\n\n/**\n * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no\n * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it\n * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs\n * `Buffer`) extends it for the server algorithms (`AES`, `RSA`).\n */\nexport abstract class AbstractCryptoAlgorithm<\n AlgorithmType extends string,\n EncryptInputType = unknown,\n DecryptInputType = unknown,\n SecretKeyType = unknown,\n EncryptReturnType = unknown,\n DecryptReturnType = unknown,\n ExtraOptions = unknown,\n>\n extends BaseHelper\n implements\n ICryptoAlgorithm<\n AlgorithmType,\n EncryptInputType,\n DecryptInputType,\n SecretKeyType,\n EncryptReturnType,\n DecryptReturnType,\n ExtraOptions\n >\n{\n algorithm: AlgorithmType;\n\n abstract encrypt(opts: {\n message: EncryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): EncryptReturnType;\n\n abstract decrypt(opts: {\n message: DecryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): DecryptReturnType;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type AESAlgorithmType } from './aes.constants.js';
2
2
  /**
3
- * AES-CBC and AES-GCM over `crypto.subtle`, shared by `AES` and `LegacyAES`. It keeps the layout of the
3
+ * AES-CBC and AES-GCM over `crypto.subtle`, used by `AES`. It keeps the layout of the
4
4
  * synchronous implementation it replaced, so what is already stored still reads: CBC pads with PKCS#7,
5
5
  * and GCM takes a 16-byte IV and a 16-byte tag. Web Crypto returns GCM output as `cipherText || tag`;
6
6
  * the stored envelopes put the tag BEFORE the cipher text, so `seal` and `open` split and join them here
@@ -4,7 +4,7 @@ const IV_BYTES = 16;
4
4
  const TAG_BYTES = 16;
5
5
  const TAG_BITS = TAG_BYTES * 8;
6
6
  /**
7
- * AES-CBC and AES-GCM over `crypto.subtle`, shared by `AES` and `LegacyAES`. It keeps the layout of the
7
+ * AES-CBC and AES-GCM over `crypto.subtle`, used by `AES`. It keeps the layout of the
8
8
  * synchronous implementation it replaced, so what is already stored still reads: CBC pads with PKCS#7,
9
9
  * and GCM takes a 16-byte IV and a 16-byte tag. Web Crypto returns GCM output as `cipherText || tag`;
10
10
  * the stored envelopes put the tag BEFORE the cipher text, so `seal` and `open` split and join them here
@@ -59,7 +59,7 @@ export class AesEngine {
59
59
  static getParams(opts) {
60
60
  const { algorithm, iv } = opts;
61
61
  if (algorithm === AESAlgorithms.AES_256_GCM) {
62
- // GCM takes an IV of any length from 1 byte (12 is the usual one). `LegacyAES` read such data before, so it still does.
62
+ // The engine itself takes a GCM IV of any length from 1 byte, as the synchronous implementation did; `AES` always passes 16.
63
63
  if (iv.length === 0) {
64
64
  throw getError({ message: '[AesEngine][getParams] The GCM IV must not be empty' });
65
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aes.engine.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes.engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AAEvE,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,CAAC;AAS/B;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IACpB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAKjB;QACC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,E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Aa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAqD;QAC5E,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;QAE/B,IAAI,SAAS,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;YAC5C,wHAAwH;YACxH,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,QAAQ,CAAC,EAAE,OAAO,EAAE,qDAAqD,EAAE,CAAC,CAAC;YACrF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACpE,CAAC;QAED,IAAI,EAAE,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,4CAA4C,EAAE,CAAC,MAAM,oBAAoB,QAAQ,EAAE;aAC7F,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAY,EAAE,CAAC;IAC/C,CAAC;CACF","sourcesContent":["import { getError } from '@/modules/error';\nimport { AESAlgorithms, type AESAlgorithmType } from './aes.constants';\n\nconst IV_BYTES = 16;\nconst TAG_BYTES = 16;\nconst TAG_BITS = TAG_BYTES * 8;\n\n/** What `crypto.subtle` takes. Every array here is backed by an `ArrayBuffer`; none is shared memory. */\ntype TBytes = Uint8Array<ArrayBuffer>;\n\ntype TCipherParams =\n | { name: 'AES-CBC'; iv: TBytes }\n | { name: 'AES-GCM'; iv: TBytes; tagLength: number };\n\n/**\n * AES-CBC and AES-GCM over `crypto.subtle`, shared by `AES` and `LegacyAES`. It keeps the layout of the\n * synchronous implementation it replaced, so what is already stored still reads: CBC pads with PKCS#7,\n * and GCM takes a 16-byte IV and a 16-byte tag. Web Crypto returns GCM output as `cipherText || tag`;\n * the stored envelopes put the tag BEFORE the cipher text, so `seal` and `open` split and join them here\n * and the callers deal in the two parts.\n */\nexport class AesEngine {\n static async seal(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n iv: Uint8Array;\n plain: Uint8Array;\n }): Promise<{ cipherText: Uint8Array; authTag: Uint8Array | null }> {\n const { algorithm, key, iv, plain } = opts;\n const cryptoKey = await AesEngine.importKey({ algorithm, key, usage: 'encrypt' });\n const encrypted = await crypto.subtle.encrypt(\n AesEngine.getParams({ algorithm, iv }),\n cryptoKey,\n plain as TBytes,\n );\n const sealed = new Uint8Array(encrypted);\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n return {\n cipherText: sealed.subarray(0, sealed.length - TAG_BYTES),\n authTag: sealed.subarray(sealed.length - TAG_BYTES),\n };\n }\n\n return { cipherText: sealed, authTag: null };\n }\n\n /** Throws when the tag does not authenticate: a GCM tag that is missing or not 16 bytes is refused before any decryption. */\n static async open(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n iv: Uint8Array;\n cipherText: Uint8Array;\n authTag: Uint8Array | null;\n }): Promise<Uint8Array> {\n const { algorithm, key, iv, cipherText, authTag } = opts;\n const cryptoKey = await AesEngine.importKey({ algorithm, key, usage: 'decrypt' });\n let input = cipherText;\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n if (authTag === null || authTag.length !== TAG_BYTES) {\n throw getError({\n message: `[AesEngine][open] The GCM auth tag must be ${TAG_BYTES} bytes, got ${authTag?.length ?? 0}`,\n });\n }\n\n input = new Uint8Array(cipherText.length + TAG_BYTES);\n input.set(cipherText, 0);\n input.set(authTag, cipherText.length);\n }\n\n const decrypted = await crypto.subtle.decrypt(\n AesEngine.getParams({ algorithm, iv }),\n cryptoKey,\n input as TBytes,\n );\n return new Uint8Array(decrypted);\n }\n\n /** The key must be exactly the size the algorithm names: Web Crypto would otherwise run a 16 or 24 byte key as AES-128 or AES-192. */\n private static async importKey(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n usage: 'encrypt' | 'decrypt';\n }): Promise<CryptoKey> {\n const { algorithm, key, usage } = opts;\n const expected = Number(algorithm.split('-')[1]) / 8;\n\n if (key.length !== expected) {\n throw getError({\n message: `[AesEngine][importKey] Invalid key length ${key.length} bytes for ${algorithm}, expected ${expected}`,\n });\n }\n\n return crypto.subtle.importKey(\n 'raw',\n key as TBytes,\n { name: AesEngine.getName({ algorithm }) },\n false,\n [usage],\n );\n }\n\n private static getName(opts: { algorithm: AESAlgorithmType }): 'AES-CBC' | 'AES-GCM' {\n return opts.algorithm === AESAlgorithms.AES_256_GCM ? 'AES-GCM' : 'AES-CBC';\n }\n\n private static getParams(opts: { algorithm: AESAlgorithmType; iv: Uint8Array }): TCipherParams {\n const { algorithm, iv } = opts;\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n // GCM takes an IV of any length from 1 byte (12 is the usual one). `LegacyAES` read such data before, so it still does.\n if (iv.length === 0) {\n throw getError({ message: '[AesEngine][getParams] The GCM IV must not be empty' });\n }\n\n return { name: 'AES-GCM', iv: iv as TBytes, tagLength: TAG_BITS };\n }\n\n if (iv.length !== IV_BYTES) {\n throw getError({\n message: `[AesEngine][getParams] Invalid IV length ${iv.length} bytes, expected ${IV_BYTES}`,\n });\n }\n\n return { name: 'AES-CBC', iv: iv as TBytes };\n }\n}\n"]}
1
+ {"version":3,"file":"aes.engine.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes.engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AAEvE,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,CAAC;AAS/B;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IACpB,MAAM,CAAC,K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;IAEO,MAAM,CAAC,OAAO,CAAC,IAAqC;QAC1D,OAAO,IAAI,CAAC,SAAS,KAAK,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAqD;QAC5E,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;QAE/B,IAAI,SAAS,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;YAC5C,6HAA6H;YAC7H,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,QAAQ,CAAC,EAAE,OAAO,EAAE,qDAAqD,EAAE,CAAC,CAAC;YACrF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACpE,CAAC;QAED,IAAI,EAAE,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,4CAA4C,EAAE,CAAC,MAAM,oBAAoB,QAAQ,EAAE;aAC7F,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAY,EAAE,CAAC;IAC/C,CAAC;CACF","sourcesContent":["import { getError } from '@/modules/error';\nimport { AESAlgorithms, type AESAlgorithmType } from './aes.constants';\n\nconst IV_BYTES = 16;\nconst TAG_BYTES = 16;\nconst TAG_BITS = TAG_BYTES * 8;\n\n/** What `crypto.subtle` takes. Every array here is backed by an `ArrayBuffer`; none is shared memory. */\ntype TBytes = Uint8Array<ArrayBuffer>;\n\ntype TCipherParams =\n | { name: 'AES-CBC'; iv: TBytes }\n | { name: 'AES-GCM'; iv: TBytes; tagLength: number };\n\n/**\n * AES-CBC and AES-GCM over `crypto.subtle`, used by `AES`. It keeps the layout of the\n * synchronous implementation it replaced, so what is already stored still reads: CBC pads with PKCS#7,\n * and GCM takes a 16-byte IV and a 16-byte tag. Web Crypto returns GCM output as `cipherText || tag`;\n * the stored envelopes put the tag BEFORE the cipher text, so `seal` and `open` split and join them here\n * and the callers deal in the two parts.\n */\nexport class AesEngine {\n static async seal(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n iv: Uint8Array;\n plain: Uint8Array;\n }): Promise<{ cipherText: Uint8Array; authTag: Uint8Array | null }> {\n const { algorithm, key, iv, plain } = opts;\n const cryptoKey = await AesEngine.importKey({ algorithm, key, usage: 'encrypt' });\n const encrypted = await crypto.subtle.encrypt(\n AesEngine.getParams({ algorithm, iv }),\n cryptoKey,\n plain as TBytes,\n );\n const sealed = new Uint8Array(encrypted);\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n return {\n cipherText: sealed.subarray(0, sealed.length - TAG_BYTES),\n authTag: sealed.subarray(sealed.length - TAG_BYTES),\n };\n }\n\n return { cipherText: sealed, authTag: null };\n }\n\n /** Throws when the tag does not authenticate: a GCM tag that is missing or not 16 bytes is refused before any decryption. */\n static async open(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n iv: Uint8Array;\n cipherText: Uint8Array;\n authTag: Uint8Array | null;\n }): Promise<Uint8Array> {\n const { algorithm, key, iv, cipherText, authTag } = opts;\n const cryptoKey = await AesEngine.importKey({ algorithm, key, usage: 'decrypt' });\n let input = cipherText;\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n if (authTag === null || authTag.length !== TAG_BYTES) {\n throw getError({\n message: `[AesEngine][open] The GCM auth tag must be ${TAG_BYTES} bytes, got ${authTag?.length ?? 0}`,\n });\n }\n\n input = new Uint8Array(cipherText.length + TAG_BYTES);\n input.set(cipherText, 0);\n input.set(authTag, cipherText.length);\n }\n\n const decrypted = await crypto.subtle.decrypt(\n AesEngine.getParams({ algorithm, iv }),\n cryptoKey,\n input as TBytes,\n );\n return new Uint8Array(decrypted);\n }\n\n /** The key must be exactly the size the algorithm names: Web Crypto would otherwise run a 16 or 24 byte key as AES-128 or AES-192. */\n private static async importKey(opts: {\n algorithm: AESAlgorithmType;\n key: Uint8Array;\n usage: 'encrypt' | 'decrypt';\n }): Promise<CryptoKey> {\n const { algorithm, key, usage } = opts;\n const expected = Number(algorithm.split('-')[1]) / 8;\n\n if (key.length !== expected) {\n throw getError({\n message: `[AesEngine][importKey] Invalid key length ${key.length} bytes for ${algorithm}, expected ${expected}`,\n });\n }\n\n return crypto.subtle.importKey(\n 'raw',\n key as TBytes,\n { name: AesEngine.getName({ algorithm }) },\n false,\n [usage],\n );\n }\n\n private static getName(opts: { algorithm: AESAlgorithmType }): 'AES-CBC' | 'AES-GCM' {\n return opts.algorithm === AESAlgorithms.AES_256_GCM ? 'AES-GCM' : 'AES-CBC';\n }\n\n private static getParams(opts: { algorithm: AESAlgorithmType; iv: Uint8Array }): TCipherParams {\n const { algorithm, iv } = opts;\n\n if (algorithm === AESAlgorithms.AES_256_GCM) {\n // The engine itself takes a GCM IV of any length from 1 byte, as the synchronous implementation did; `AES` always passes 16.\n if (iv.length === 0) {\n throw getError({ message: '[AesEngine][getParams] The GCM IV must not be empty' });\n }\n\n return { name: 'AES-GCM', iv: iv as TBytes, tagLength: TAG_BITS };\n }\n\n if (iv.length !== IV_BYTES) {\n throw getError({\n message: `[AesEngine][getParams] Invalid IV length ${iv.length} bytes, expected ${IV_BYTES}`,\n });\n }\n\n return { name: 'AES-CBC', iv: iv as TBytes };\n }\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  export * from './base.algorithm.js';
2
2
  export * from './aes.algorithm.js';
3
- export * from './aes-legacy.algorithm.js';
4
3
  export * from './ecdh.algorithm.js';
5
4
  export * from './hash.algorithm.js';
6
5
  export * from './credential.algorithm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  export * from './base.algorithm.js';
2
2
  export * from './aes.algorithm.js';
3
- export * from './aes-legacy.algorithm.js';
4
3
  export * from './ecdh.algorithm.js';
5
4
  export * from './hash.algorithm.js';
6
5
  export * from './credential.algorithm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './base.algorithm';\n\nexport * from './aes.algorithm';\nexport * from './aes-legacy.algorithm';\nexport * from './ecdh.algorithm';\nexport * from './hash.algorithm';\nexport * from './credential.algorithm';\nexport * from './rsa.algorithm';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './base.algorithm';\n\nexport * from './aes.algorithm';\nexport * from './ecdh.algorithm';\nexport * from './hash.algorithm';\nexport * from './credential.algorithm';\nexport * from './rsa.algorithm';\n"]}
@@ -1,7 +1,5 @@
1
1
  import type { TConstValue } from '../../../common/index.js';
2
2
  export declare const DEFAULT_CIPHER_BITS = 256;
3
- /** Legacy padEnd key-stretching char, no longer used - keys now derive via PBKDF2 (`DEFAULT_KDF_*`). Kept only so existing imports do not break. */
4
- export declare const DEFAULT_PAD_END: string;
5
3
  /**
6
4
  * Public and identical across every deployment, so it stops a bare dictionary attack but not a
7
5
  * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,oJAAoJ;AACpJ,eAAO,MAAM,eAAe,QAAoB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AACpD,eAAO,MAAM,sBAAsB,SAAU,CAAC;AAC9C,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,qDAAqD;AACrD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,qBAAa,cAAc;IACzB,gIAAgI;IAChI,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAE5B,gIAAgI;IAChI,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAMvB;IAEH,MAAM,CAAC,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G,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA4B,EAAE,oBAAoD,CAAC"}
@@ -1,6 +1,4 @@
1
1
  export const DEFAULT_CIPHER_BITS = 256;
2
- /** Legacy padEnd key-stretching char, no longer used - keys now derive via PBKDF2 (`DEFAULT_KDF_*`). Kept only so existing imports do not break. */
3
- export const DEFAULT_PAD_END = (0x00).toString();
4
2
  /**
5
3
  * Public and identical across every deployment, so it stops a bare dictionary attack but not a
6
4
  * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC,oJAAoJ;AACpJ,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C,gGAAgG;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,OAAO,cAAc;IACzB,gIAAgI;aAChH,QAAG,GAAG,KAAK,CAAC;IAE5B,gIAAgI;aAChH,SAAI,GAAG,MAAM,CAAC;aAEd,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,GAAG;QACR,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,OAAO,mBAAmB;aACd,QAAG,GAAG,KAAK,CAAC;aACZ,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,WAAW,CAAC;aAExB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAEtF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAwB,mBAAmB,CAAC,GAAG,CAAC;AAEzF,MAAM,OAAO,oBAAoB;IAC/B,0EAA0E;aAC1D,aAAQ,GAAG,UAAU,CAAC;aACtB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3E,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAyB,oBAAoB,CAAC,QAAQ,CAAC","sourcesContent":["import type { TConstValue } from '@/common';\n\nexport const DEFAULT_CIPHER_BITS = 256;\n\n/** Legacy padEnd key-stretching char, no longer used - keys now derive via PBKDF2 (`DEFAULT_KDF_*`). Kept only so existing imports do not break. */\nexport const DEFAULT_PAD_END = (0x00).toString();\n\n/**\n * Public and identical across every deployment, so it stops a bare dictionary attack but not a\n * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never\n * change this: every ciphertext already encrypted under it becomes undecryptable.\n */\nexport const DEFAULT_KDF_SALT = 'ignis-kdf-salt-v1';\nexport const DEFAULT_KDF_ITERATIONS = 100_000;\nexport const DEFAULT_KDF_DIGEST = 'sha256';\n\n/** NIST SP 800-132 minimum recommended salt size (128 bits) for a caller-supplied `kdfSalt`. */\nexport const MINIMUM_KDF_SALT_BYTES = 16;\n\n/** NIST SP 800-57 Part 1 floor for RSA past 2030. */\nexport const MINIMUM_RSA_MODULUS_BITS = 2048;\n\nexport class HashAlgorithms {\n /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */\n static readonly MD5 = 'md5';\n\n /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */\n static readonly SHA1 = 'sha1';\n\n static readonly SHA256 = 'sha256';\n static readonly SHA384 = 'sha384';\n static readonly SHA512 = 'sha512';\n\n static readonly SCHEME_SET = new Set<string>([\n this.MD5,\n this.SHA1,\n this.SHA256,\n this.SHA384,\n this.SHA512,\n ]);\n\n static isValid(value: string): value is THashAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type THashAlgorithm = TConstValue<typeof HashAlgorithms>;\n\nexport class HashOutputEncodings {\n static readonly HEX = 'hex';\n static readonly BASE64 = 'base64';\n static readonly BASE64URL = 'base64url';\n\n static readonly SCHEME_SET = new Set<string>([this.HEX, this.BASE64, this.BASE64URL]);\n\n static isValid(value: string): value is THashOutputEncoding {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type THashOutputEncoding = TConstValue<typeof HashOutputEncodings>;\n\nexport const DEFAULT_HASH_OUTPUT_ENCODING: THashOutputEncoding = HashOutputEncodings.HEX;\n\nexport class CredentialAlgorithms {\n /** What `Bun.password` writes by default, with its default parameters. */\n static readonly ARGON2ID = 'argon2id';\n static readonly BCRYPT = 'bcrypt';\n\n static readonly SCHEME_SET = new Set<string>([this.ARGON2ID, this.BCRYPT]);\n\n static isValid(value: string): value is TCredentialAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TCredentialAlgorithm = TConstValue<typeof CredentialAlgorithms>;\n\nexport const DEFAULT_CREDENTIAL_ALGORITHM: TCredentialAlgorithm = CredentialAlgorithms.ARGON2ID;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C,gGAAgG;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,OAAO,cAAc;IACzB,gIAAgI;aAChH,QAAG,GAAG,KAAK,CAAC;IAE5B,gIAAgI;aAChH,SAAI,GAAG,MAAM,CAAC;aAEd,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,GAAG;QACR,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,OAAO,mBAAmB;aACd,QAAG,GAAG,KAAK,CAAC;aACZ,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,WAAW,CAAC;aAExB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAEtF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAwB,mBAAmB,CAAC,GAAG,CAAC;AAEzF,MAAM,OAAO,oBAAoB;IAC/B,0EAA0E;aAC1D,aAAQ,GAAG,UAAU,CAAC;aACtB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3E,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAyB,oBAAoB,CAAC,QAAQ,CAAC","sourcesContent":["import type { TConstValue } from '@/common';\n\nexport const DEFAULT_CIPHER_BITS = 256;\n\n/**\n * Public and identical across every deployment, so it stops a bare dictionary attack but not a\n * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never\n * change this: every ciphertext already encrypted under it becomes undecryptable.\n */\nexport const DEFAULT_KDF_SALT = 'ignis-kdf-salt-v1';\nexport const DEFAULT_KDF_ITERATIONS = 100_000;\nexport const DEFAULT_KDF_DIGEST = 'sha256';\n\n/** NIST SP 800-132 minimum recommended salt size (128 bits) for a caller-supplied `kdfSalt`. */\nexport const MINIMUM_KDF_SALT_BYTES = 16;\n\n/** NIST SP 800-57 Part 1 floor for RSA past 2030. */\nexport const MINIMUM_RSA_MODULUS_BITS = 2048;\n\nexport class HashAlgorithms {\n /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */\n static readonly MD5 = 'md5';\n\n /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */\n static readonly SHA1 = 'sha1';\n\n static readonly SHA256 = 'sha256';\n static readonly SHA384 = 'sha384';\n static readonly SHA512 = 'sha512';\n\n static readonly SCHEME_SET = new Set<string>([\n this.MD5,\n this.SHA1,\n this.SHA256,\n this.SHA384,\n this.SHA512,\n ]);\n\n static isValid(value: string): value is THashAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type THashAlgorithm = TConstValue<typeof HashAlgorithms>;\n\nexport class HashOutputEncodings {\n static readonly HEX = 'hex';\n static readonly BASE64 = 'base64';\n static readonly BASE64URL = 'base64url';\n\n static readonly SCHEME_SET = new Set<string>([this.HEX, this.BASE64, this.BASE64URL]);\n\n static isValid(value: string): value is THashOutputEncoding {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type THashOutputEncoding = TConstValue<typeof HashOutputEncodings>;\n\nexport const DEFAULT_HASH_OUTPUT_ENCODING: THashOutputEncoding = HashOutputEncodings.HEX;\n\nexport class CredentialAlgorithms {\n /** What `Bun.password` writes by default, with its default parameters. */\n static readonly ARGON2ID = 'argon2id';\n static readonly BCRYPT = 'bcrypt';\n\n static readonly SCHEME_SET = new Set<string>([this.ARGON2ID, this.BCRYPT]);\n\n static isValid(value: string): value is TCredentialAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TCredentialAlgorithm = TConstValue<typeof CredentialAlgorithms>;\n\nexport const DEFAULT_CREDENTIAL_ALGORITHM: TCredentialAlgorithm = CredentialAlgorithms.ARGON2ID;\n"]}
@@ -1,14 +1,3 @@
1
- /** The narrow slice of a cipher that string-in/string-out payload encryption needs. A cipher may answer at once or with a promise (`AES` and `LegacyAES` answer with a promise); the caller awaits either. Both `AES` and `LegacyAES` satisfy it, so an application holding data in the pre-PBKDF2 envelope can hand over the legacy one instead of re-encrypting. */
2
- export interface IPayloadCipher {
3
- encrypt(opts: {
4
- message: string;
5
- secret: string;
6
- }): string | Promise<string>;
7
- decrypt(opts: {
8
- message: string;
9
- secret: string;
10
- }): string | Promise<string>;
11
- }
12
1
  export interface ICryptoAlgorithm<AlgorithmNameType extends string, EncryptInputType = unknown, DecryptInputType = unknown, SecretKeyType = unknown, EncryptReturnType = unknown, DecryptReturnType = unknown, ExtraOptions = unknown> {
13
2
  algorithm: AlgorithmNameType;
14
3
  encrypt(opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/types.ts"],"names":[],"mappings":"AAAA,sWAAsW;AACtW,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,gBAAgB,CAC/B,iBAAiB,SAAS,MAAM,EAChC,gBAAgB,GAAG,OAAO,EAC1B,gBAAgB,GAAG,OAAO,EAC1B,aAAa,GAAG,OAAO,EACvB,iBAAiB,GAAG,OAAO,EAC3B,iBAAiB,GAAG,OAAO,EAC3B,YAAY,GAAG,OAAO;IAEtB,SAAS,EAAE,iBAAiB,CAAC;IAE7B,OAAO,CAAC,IAAI,EAAE;QACZ,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE;QACZ,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB,CAAC;CACvB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAC/B,iBAAiB,SAAS,MAAM,EAChC,gBAAgB,GAAG,OAAO,EAC1B,gBAAgB,GAAG,OAAO,EAC1B,aAAa,GAAG,OAAO,EACvB,iBAAiB,GAAG,OAAO,EAC3B,iBAAiB,GAAG,OAAO,EAC3B,YAAY,GAAG,OAAO;IAEtB,SAAS,EAAE,iBAAiB,CAAC;IAE7B,OAAO,CAAC,IAAI,EAAE;QACZ,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE;QACZ,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB,CAAC;CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/types.ts"],"names":[],"mappings":"","sourcesContent":["/** The narrow slice of a cipher that string-in/string-out payload encryption needs. A cipher may answer at once or with a promise (`AES` and `LegacyAES` answer with a promise); the caller awaits either. Both `AES` and `LegacyAES` satisfy it, so an application holding data in the pre-PBKDF2 envelope can hand over the legacy one instead of re-encrypting. */\nexport interface IPayloadCipher {\n encrypt(opts: { message: string; secret: string }): string | Promise<string>;\n decrypt(opts: { message: string; secret: string }): string | Promise<string>;\n}\n\nexport interface ICryptoAlgorithm<\n AlgorithmNameType extends string,\n EncryptInputType = unknown,\n DecryptInputType = unknown,\n SecretKeyType = unknown,\n EncryptReturnType = unknown,\n DecryptReturnType = unknown,\n ExtraOptions = unknown,\n> {\n algorithm: AlgorithmNameType;\n\n encrypt(opts: {\n message: EncryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): EncryptReturnType;\n decrypt(opts: {\n message: DecryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): DecryptReturnType;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ICryptoAlgorithm<\n AlgorithmNameType extends string,\n EncryptInputType = unknown,\n DecryptInputType = unknown,\n SecretKeyType = unknown,\n EncryptReturnType = unknown,\n DecryptReturnType = unknown,\n ExtraOptions = unknown,\n> {\n algorithm: AlgorithmNameType;\n\n encrypt(opts: {\n message: EncryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): EncryptReturnType;\n decrypt(opts: {\n message: DecryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): DecryptReturnType;\n}\n"]}
@@ -41,5 +41,4 @@ export declare class ApplicationEnvironment extends BaseHelper implements IAppli
41
41
  }
42
42
  export declare const applicationEnvironment: ApplicationEnvironment;
43
43
  export declare const AppEnvs: ApplicationEnvironment;
44
- export declare const Envs: ApplicationEnvironment;
45
44
  //# sourceMappingURL=app-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-env.d.ts","sourceRoot":"","sources":["../../../../src/modules/env/app-env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,sPAAsP;AACtP,qBAAa,WAAY,SAAQ,gBAAgB;IAC/C,gNAAgN;IAChN,MAAM,KAAK,OAAO,IAAI,MAAM,GAAG,SAAS,CAGvC;IAED,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MA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M,CAE3B;IAED,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;CAGjC;AAED,qBAAa,sBAAuB,SAAQ,UAAW,YAAW,uBAAuB;IACvF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAA4C;gBAEjD,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE;IAcvF;;;;;;;;;;OAUG;IACH,GAAG,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,EAC3C,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,UAAU,CAAC;QAC1B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,UAAU,CAAC;KACxD,GACA,UAAU;IAcb,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS;IAI5C,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;IAO5C,aAAa;IAIb,IAAI;CAGL;AAqBD,eAAO,MAAM,sBAAsB,wBAAkC,CAAC;AAEtE,eAAO,MAAM,OAAO,wBAAyB,CAAC"}
@@ -80,5 +80,4 @@ const resolveApplicationEnvironment = () => {
80
80
  };
81
81
  export const applicationEnvironment = resolveApplicationEnvironment();
82
82
  export const AppEnvs = applicationEnvironment;
83
- export const Envs = applicationEnvironment;
84
83
  //# sourceMappingURL=app-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-env.js","sourceRoot":"","sources":["../../../../src/modules/env/app-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC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sBAAsB,CAAC;QACzC,MAAM,EACJ,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,IAAI,SAAS;QAC3F,IAAI,EAAE,OAAO,CAAC,GAAG;KAClB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,EAAE,CAAC;AAEtE,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,IAAI,GAAG,sBAAsB,CAAC","sourcesContent":["import { ParseUtility } from '@/utilities/parse.utility';\nimport { BaseHelper } from '@/modules/base';\nimport { EnvironmentNames } from './names';\nimport { type IApplicationEnvironment } from './common';\n\n/** Adds the `NODE_ENV` reads to {@link EnvironmentNames}. Every name and set is inherited, so `Environment.PRODUCTION`, `Environment.COMMON_ENVS` and `Environment.DEVELOPMENT_ENVS` keep resolving here; only these two members need a `process`. */\nexport class Environment extends EnvironmentNames {\n /** `NODE_ENV` exactly as the host has it, `undefined` when unset. Destructured on purpose: `bun build` rewrites `process.env.NODE_ENV` to a literal at build time, a destructured read stays a runtime read. */\n static get ambient(): string | undefined {\n const { NODE_ENV } = process.env;\n return NODE_ENV;\n }\n\n static get current(): string {\n return Environment.ambient ?? Environment.DEVELOPMENT;\n }\n\n static is(opts: { name: string }) {\n return this.current === opts.name;\n }\n}\n\nexport class ApplicationEnvironment extends BaseHelper implements IApplicationEnvironment {\n private prefix: string;\n private arguments: Record<string, any> = Object.create(null);\n\n constructor(opts: { prefix: string; envs: Record<string, string | number | undefined> }) {\n super({ scope: ApplicationEnvironment.name });\n\n this.prefix = opts.prefix;\n\n for (const key in opts.envs) {\n if (!key.startsWith(this.prefix)) {\n continue;\n }\n\n this.arguments[key] = opts.envs[key];\n }\n }\n\n /**\n * Reads one name. A line that is present but empty - `KEY=`, or padded to `KEY= ` by a hand\n * edit - is a pipeline that forgot to export the value, not a value: it is normalised to\n * `undefined` so `defaultValue` applies, and `transform` is handed that `undefined` rather than\n * the empty string.\n *\n * The normalisation runs ONLY when the caller supplied a `defaultValue`, because that call site\n * has already declared what it wants when the name carries nothing. A caller without one still\n * receives `''` unchanged, so no existing read changes shape. `'0'` and `'false'` are values and\n * are never normalised.\n */\n get<ReturnType, BeforeTransformType = unknown>(\n key: string,\n opts?: {\n defaultValue?: ReturnType;\n transform?: (value: BeforeTransformType) => ReturnType;\n },\n ): ReturnType {\n const raw = this.arguments[key];\n\n const isBlank = raw === undefined || raw === null || (typeof raw === 'string' && !raw.trim());\n const rs = opts?.defaultValue !== undefined && isBlank ? undefined : raw;\n\n if (!opts?.transform) {\n return (rs ?? opts?.defaultValue) as ReturnType;\n }\n\n const transformed = opts.transform(rs);\n return (transformed ?? opts?.defaultValue) as ReturnType;\n }\n\n set<ValueType>(key: string, value: ValueType) {\n this.arguments[key] = value;\n }\n\n merge(opts: { envs: Record<string, string> }) {\n const envsEntries = Object.entries(opts.envs);\n for (const [key, value] of envsEntries) {\n this.arguments[key] = value;\n }\n }\n\n isDevelopment() {\n return Environment.ambient === 'development';\n }\n\n keys() {\n return Object.keys(this.arguments);\n }\n}\n\n/** A process can carry two copies of this module - an application's ESM import beside a CommonJS require. The instance lives in this globalThis slot so a `set()` through one copy is read through the other. */\nconst INSTANCE_SLOT = Symbol.for('ignis:application-environment');\n\nconst resolveApplicationEnvironment = (): ApplicationEnvironment => {\n const shared: ApplicationEnvironment | undefined = Reflect.get(globalThis, INSTANCE_SLOT);\n if (shared) {\n return shared;\n }\n\n const created = new ApplicationEnvironment({\n prefix:\n ParseUtility.blankToUndefined({ input: process.env.APPLICATION_ENV_PREFIX }) ?? 'APP_ENV',\n envs: process.env,\n });\n Reflect.set(globalThis, INSTANCE_SLOT, created);\n\n return created;\n};\n\nexport const applicationEnvironment = resolveApplicationEnvironment();\n\nexport const AppEnvs = applicationEnvironment;\nexport const Envs = applicationEnvironment;\n"]}
1
+ {"version":3,"file":"app-env.js","sourceRoot":"","sources":["../../../../src/modules/env/app-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C,sPAAsP;AACtP,MAAM,OAAO,WAAY,SAAQ,gBAAgB;IAC/C,gNAAgN;IAChN,MAAM,KAAK,OAAO;QAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,WAAW,CAAC,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,IAAsB;QAC9B,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IAIpD,YAAY,IAA2E;QACrF,KAAK,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC;QAHxC,cAAS,GAAwB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAK3D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE1B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjC,SAAS;YACX,CAAC;YAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;IACH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,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAElE,MAAM,6BAA6B,GAAG,GAA2B,EAAE;IACjE,MAAM,MAAM,GAAuC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC1F,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC;QACzC,MAAM,EACJ,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,IAAI,SAAS;QAC3F,IAAI,EAAE,OAAO,CAAC,GAAG;KAClB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,EAAE,CAAC;AAEtE,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC","sourcesContent":["import { ParseUtility } from '@/utilities/parse.utility';\nimport { BaseHelper } from '@/modules/base';\nimport { EnvironmentNames } from './names';\nimport { type IApplicationEnvironment } from './common';\n\n/** Adds the `NODE_ENV` reads to {@link EnvironmentNames}. Every name and set is inherited, so `Environment.PRODUCTION`, `Environment.COMMON_ENVS` and `Environment.DEVELOPMENT_ENVS` keep resolving here; only these two members need a `process`. */\nexport class Environment extends EnvironmentNames {\n /** `NODE_ENV` exactly as the host has it, `undefined` when unset. Destructured on purpose: `bun build` rewrites `process.env.NODE_ENV` to a literal at build time, a destructured read stays a runtime read. */\n static get ambient(): string | undefined {\n const { NODE_ENV } = process.env;\n return NODE_ENV;\n }\n\n static get current(): string {\n return Environment.ambient ?? Environment.DEVELOPMENT;\n }\n\n static is(opts: { name: string }) {\n return this.current === opts.name;\n }\n}\n\nexport class ApplicationEnvironment extends BaseHelper implements IApplicationEnvironment {\n private prefix: string;\n private arguments: Record<string, any> = Object.create(null);\n\n constructor(opts: { prefix: string; envs: Record<string, string | number | undefined> }) {\n super({ scope: ApplicationEnvironment.name });\n\n this.prefix = opts.prefix;\n\n for (const key in opts.envs) {\n if (!key.startsWith(this.prefix)) {\n continue;\n }\n\n this.arguments[key] = opts.envs[key];\n }\n }\n\n /**\n * Reads one name. A line that is present but empty - `KEY=`, or padded to `KEY= ` by a hand\n * edit - is a pipeline that forgot to export the value, not a value: it is normalised to\n * `undefined` so `defaultValue` applies, and `transform` is handed that `undefined` rather than\n * the empty string.\n *\n * The normalisation runs ONLY when the caller supplied a `defaultValue`, because that call site\n * has already declared what it wants when the name carries nothing. A caller without one still\n * receives `''` unchanged, so no existing read changes shape. `'0'` and `'false'` are values and\n * are never normalised.\n */\n get<ReturnType, BeforeTransformType = unknown>(\n key: string,\n opts?: {\n defaultValue?: ReturnType;\n transform?: (value: BeforeTransformType) => ReturnType;\n },\n ): ReturnType {\n const raw = this.arguments[key];\n\n const isBlank = raw === undefined || raw === null || (typeof raw === 'string' && !raw.trim());\n const rs = opts?.defaultValue !== undefined && isBlank ? undefined : raw;\n\n if (!opts?.transform) {\n return (rs ?? opts?.defaultValue) as ReturnType;\n }\n\n const transformed = opts.transform(rs);\n return (transformed ?? opts?.defaultValue) as ReturnType;\n }\n\n set<ValueType>(key: string, value: ValueType) {\n this.arguments[key] = value;\n }\n\n merge(opts: { envs: Record<string, string> }) {\n const envsEntries = Object.entries(opts.envs);\n for (const [key, value] of envsEntries) {\n this.arguments[key] = value;\n }\n }\n\n isDevelopment() {\n return Environment.ambient === 'development';\n }\n\n keys() {\n return Object.keys(this.arguments);\n }\n}\n\n/** A process can carry two copies of this module - an application's ESM import beside a CommonJS require. The instance lives in this globalThis slot so a `set()` through one copy is read through the other. */\nconst INSTANCE_SLOT = Symbol.for('ignis:application-environment');\n\nconst resolveApplicationEnvironment = (): ApplicationEnvironment => {\n const shared: ApplicationEnvironment | undefined = Reflect.get(globalThis, INSTANCE_SLOT);\n if (shared) {\n return shared;\n }\n\n const created = new ApplicationEnvironment({\n prefix:\n ParseUtility.blankToUndefined({ input: process.env.APPLICATION_ENV_PREFIX }) ?? 'APP_ENV',\n envs: process.env,\n });\n Reflect.set(globalThis, INSTANCE_SLOT, created);\n\n return created;\n};\n\nexport const applicationEnvironment = resolveApplicationEnvironment();\n\nexport const AppEnvs = applicationEnvironment;\n"]}
@@ -7,7 +7,8 @@ export interface IRedisSingleHelperProps {
7
7
  host: string;
8
8
  port: string | number;
9
9
  user?: string;
10
- password: string;
10
+ /** Omit it for a Redis with no password. */
11
+ password?: string;
11
12
  database?: number;
12
13
  autoConnect?: boolean;
13
14
  maxRetry?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/modules/redis/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC;AAE3C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,E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;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,cAAc,SAAS,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,yBACf,SAAQ,uBAAuB,EAAE,qBAAqB,EAAE,kBAAkB;CAAG;AAE/E,MAAM,WAAW,0BACf,SAAQ,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB;CAAG;AAEhF,MAAM,WAAW,2BACf,SAAQ,yBAAyB,EAAE,qBAAqB,EAAE,kBAAkB;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/redis/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Cluster, ClusterOptions, Redis, RedisOptions } from 'ioredis';\nimport type { TRedisSentinelRole } from './constants';\nimport type { IRedisHelper } from './interfaces';\n\nexport type TRedisClient = Redis | Cluster;\n\nexport interface IRedisSingleHelperProps {\n name: string;\n host: string;\n port: string | number;\n user?: string;\n password: string;\n database?: number;\n autoConnect?: boolean;\n maxRetry?: number;\n}\n\nexport interface IRedisClusterHelperProps {\n name: string;\n nodes: Array<{ host: string; port: string | number; password?: string }>;\n /** Same meaning as on single and sentinel: `false` holds the client open for a later `connect()`. */\n autoConnect?: boolean;\n clusterOptions?: ClusterOptions;\n}\n\nexport interface IRedisSentinelHelperProps {\n name: string;\n sentinels: Array<{ host: string; port?: string | number }>;\n masterName: string;\n role?: TRedisSentinelRole;\n password?: string;\n sentinelPassword?: string;\n sentinelUsername?: string;\n database?: number;\n autoConnect?: boolean;\n maxRetry?: number;\n redisOptions?: Partial<RedisOptions>;\n}\n\nexport interface IRedisHelperCallbacks {\n onInitialized?: (opts: { name: string; helper: IRedisHelper }) => void;\n onConnected?: (opts: { name: string; helper: IRedisHelper }) => void;\n onReady?: (opts: { name: string; helper: IRedisHelper }) => void;\n onError?: (opts: { name: string; helper: IRedisHelper; error: unknown }) => void;\n}\n\n/**\n * `ioredis` is an optional peer, loaded when a client is built. A `bun build --compile` binary\n * carries no `node_modules` to load it from: pass the module here, or register it once with\n * `ModuleUtility.register({ modules: { ioredis } })` at the entry.\n */\nexport interface IRedisModuleOption {\n module?: typeof import('ioredis');\n}\n\nexport interface IRedisSingleHelperOptions\n extends IRedisSingleHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n\nexport interface IRedisClusterHelperOptions\n extends IRedisClusterHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n\nexport interface IRedisSentinelHelperOptions\n extends IRedisSentinelHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/redis/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Cluster, ClusterOptions, Redis, RedisOptions } from 'ioredis';\nimport type { TRedisSentinelRole } from './constants';\nimport type { IRedisHelper } from './interfaces';\n\nexport type TRedisClient = Redis | Cluster;\n\nexport interface IRedisSingleHelperProps {\n name: string;\n host: string;\n port: string | number;\n user?: string;\n /** Omit it for a Redis with no password. */\n password?: string;\n database?: number;\n autoConnect?: boolean;\n maxRetry?: number;\n}\n\nexport interface IRedisClusterHelperProps {\n name: string;\n nodes: Array<{ host: string; port: string | number; password?: string }>;\n /** Same meaning as on single and sentinel: `false` holds the client open for a later `connect()`. */\n autoConnect?: boolean;\n clusterOptions?: ClusterOptions;\n}\n\nexport interface IRedisSentinelHelperProps {\n name: string;\n sentinels: Array<{ host: string; port?: string | number }>;\n masterName: string;\n role?: TRedisSentinelRole;\n password?: string;\n sentinelPassword?: string;\n sentinelUsername?: string;\n database?: number;\n autoConnect?: boolean;\n maxRetry?: number;\n redisOptions?: Partial<RedisOptions>;\n}\n\nexport interface IRedisHelperCallbacks {\n onInitialized?: (opts: { name: string; helper: IRedisHelper }) => void;\n onConnected?: (opts: { name: string; helper: IRedisHelper }) => void;\n onReady?: (opts: { name: string; helper: IRedisHelper }) => void;\n onError?: (opts: { name: string; helper: IRedisHelper; error: unknown }) => void;\n}\n\n/**\n * `ioredis` is an optional peer, loaded when a client is built. A `bun build --compile` binary\n * carries no `node_modules` to load it from: pass the module here, or register it once with\n * `ModuleUtility.register({ modules: { ioredis } })` at the entry.\n */\nexport interface IRedisModuleOption {\n module?: typeof import('ioredis');\n}\n\nexport interface IRedisSingleHelperOptions\n extends IRedisSingleHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n\nexport interface IRedisClusterHelperOptions\n extends IRedisClusterHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n\nexport interface IRedisSentinelHelperOptions\n extends IRedisSentinelHelperProps, IRedisHelperCallbacks, IRedisModuleOption {}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ignis-helpers",
3
- "version": "0.4.7-4",
3
+ "version": "0.4.7-6",
4
4
  "description": "Production-ready TypeScript utility library: pluggable logging (winston or pino behind one ILogger contract), Redis single/cluster/sentinel with pub/sub, BullMQ/MQTT/Kafka message queues, MinIO/Disk/Bun-S3 object storage, AES-256/RSA/ECDH cryptography, Snowflake UID generation, cron scheduling, Socket.IO/WebSocket, TCP/TLS/UDP networking, HTTP clients, secrets/Vault, worker thread pools, and environment management. Sub-path imports isolate optional peer dependencies so the root barrel never forces a peer into your bundle.",
5
5
  "keywords": [
6
6
  "aes",
@@ -176,7 +176,7 @@
176
176
  "force-update": "sh ../../scripts/build/force-update.sh"
177
177
  },
178
178
  "dependencies": {
179
- "@venizia/ignis-inversion": "0.4.6-1",
179
+ "@venizia/ignis-inversion": "0.4.6-2",
180
180
  "reflect-metadata": "^0.2.2",
181
181
  "zod": "^4.6.7"
182
182
  },
@@ -188,7 +188,7 @@
188
188
  "@socket.io/redis-emitter": "^5.1.0",
189
189
  "@types/bun": "^1.4.3",
190
190
  "@types/luxon": "^3.7.6",
191
- "@venizia/dev-configs": "0.4.7-4",
191
+ "@venizia/dev-configs": "0.4.7-5",
192
192
  "axios": "^1.20.0",
193
193
  "bullmq": "^6.4.0",
194
194
  "cron": "^4.4.0",
@@ -1,41 +0,0 @@
1
- import { type AESAlgorithmType } from './aes.constants.js';
2
- import { BaseCryptoAlgorithm } from './base.algorithm.js';
3
- interface IAESExtraOptions {
4
- iv?: Buffer;
5
- inputEncoding?: BufferEncoding;
6
- outputEncoding?: BufferEncoding;
7
- doThrow?: boolean;
8
- }
9
- /**
10
- * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never
11
- * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no
12
- * salt to override, so the option would type-check and silently do nothing.
13
- * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.
14
- */
15
- export declare class LegacyAES extends BaseCryptoAlgorithm<AESAlgorithmType, string, string, string, Promise<string>, Promise<string>, IAESExtraOptions> {
16
- constructor(opts: {
17
- algorithm: AESAlgorithmType;
18
- });
19
- static withAlgorithm(algorithm: AESAlgorithmType): LegacyAES;
20
- encrypt(opts: {
21
- message: string;
22
- secret: string;
23
- opts?: IAESExtraOptions;
24
- }): Promise<string>;
25
- encryptFile(opts: {
26
- absolutePath: string;
27
- secret: string;
28
- }): Promise<string>;
29
- decrypt(opts: {
30
- message: string;
31
- secret: string;
32
- opts?: IAESExtraOptions;
33
- }): Promise<string>;
34
- decryptFile(opts: {
35
- absolutePath: string;
36
- secret: string;
37
- }): Promise<string>;
38
- private normalizeSecretKeyLegacy;
39
- }
40
- export {};
41
- //# sourceMappingURL=aes-legacy.algorithm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-legacy.algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes-legacy.algorithm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,mBAAmB,CAChD,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,EACf,OAAO,CAAC,MAAM,CAAC,EACf,gBAAgB,CACjB;gBACa,IAAI,EAAE;QAAE,SAAS,EAAE,gBAAgB,CAAA;KAAE;IAIjD,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB;IAI1C,OAAO,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuCb,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAY5E,OAAO,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCb,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlF,OAAO,CAAC,wBAAwB;CASjC"}
@@ -1,107 +0,0 @@
1
- import { ObjectUtility } from '@venizia/ignis-inversion';
2
- import fs from 'node:fs';
3
- import { DEFAULT_PAD_END } from '../common/index.js';
4
- import { AESAlgorithms } from './aes.constants.js';
5
- import { AesEngine } from './aes.engine.js';
6
- import { BaseCryptoAlgorithm } from './base.algorithm.js';
7
- const DEFAULT_LENGTH = 16;
8
- /**
9
- * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never
10
- * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no
11
- * salt to override, so the option would type-check and silently do nothing.
12
- * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.
13
- */
14
- export class LegacyAES extends BaseCryptoAlgorithm {
15
- constructor(opts) {
16
- super({ scope: LegacyAES.name, ...opts });
17
- }
18
- static withAlgorithm(algorithm) {
19
- return new LegacyAES({ algorithm });
20
- }
21
- async encrypt(opts) {
22
- const { message, secret } = opts;
23
- const { iv = Buffer.from(crypto.getRandomValues(new Uint8Array(DEFAULT_LENGTH))), inputEncoding = 'utf-8', outputEncoding = 'base64', doThrow = true, } = opts.opts ?? {};
24
- try {
25
- const secretKey = this.normalizeSecretKeyLegacy({
26
- secret,
27
- length: this.getAlgorithmKeySize(),
28
- });
29
- const { cipherText, authTag } = await AesEngine.seal({
30
- algorithm: this.algorithm,
31
- key: Buffer.from(secretKey),
32
- iv,
33
- plain: Buffer.from(message, inputEncoding),
34
- });
35
- const parts = [iv];
36
- if (authTag !== null) {
37
- parts.push(authTag);
38
- }
39
- parts.push(cipherText);
40
- return Buffer.concat(parts).toString(outputEncoding);
41
- }
42
- catch (error) {
43
- if (doThrow) {
44
- throw error;
45
- }
46
- return message;
47
- }
48
- }
49
- async encryptFile(opts) {
50
- const { absolutePath, secret } = opts;
51
- if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {
52
- return '';
53
- }
54
- const buffer = fs.readFileSync(absolutePath);
55
- const fileContent = buffer?.toString('utf-8');
56
- return this.encrypt({ message: fileContent, secret });
57
- }
58
- async decrypt(opts) {
59
- const { message, secret } = opts;
60
- const { inputEncoding = 'base64', outputEncoding = 'utf-8', doThrow = true } = opts.opts ?? {};
61
- try {
62
- const raw = Buffer.from(message, inputEncoding);
63
- const iv = opts.opts?.iv ?? raw.subarray(0, DEFAULT_LENGTH);
64
- let messageIndex = iv.length;
65
- const secretKey = this.normalizeSecretKeyLegacy({
66
- secret,
67
- length: this.getAlgorithmKeySize(),
68
- });
69
- let authTag = null;
70
- if (this.algorithm === AESAlgorithms.AES_256_GCM) {
71
- authTag = raw.subarray(iv.length, iv.length + DEFAULT_LENGTH);
72
- messageIndex += authTag.length;
73
- }
74
- const plain = await AesEngine.open({
75
- algorithm: this.algorithm,
76
- key: Buffer.from(secretKey),
77
- iv,
78
- cipherText: raw.subarray(messageIndex),
79
- authTag,
80
- });
81
- return Buffer.from(plain).toString(outputEncoding);
82
- }
83
- catch (error) {
84
- if (doThrow) {
85
- throw error;
86
- }
87
- return message;
88
- }
89
- }
90
- async decryptFile(opts) {
91
- const { absolutePath, secret } = opts;
92
- if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {
93
- return '';
94
- }
95
- const buffer = fs.readFileSync(absolutePath);
96
- const fileContent = buffer?.toString('utf-8');
97
- return this.decrypt({ message: fileContent, secret });
98
- }
99
- normalizeSecretKeyLegacy(opts) {
100
- const { secret, length, padEnd = DEFAULT_PAD_END } = opts;
101
- if (secret.length > length) {
102
- return secret.slice(0, length);
103
- }
104
- return secret.padEnd(length, padEnd);
105
- }
106
- }
107
- //# sourceMappingURL=aes-legacy.algorithm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-legacy.algorithm.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes-legacy.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,cAAc,GAAG,EAAE,CAAC;AAS1B;;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AAO,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;IAEO,wBAAwB,CAAC,IAAyD;QACxF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,IAAI,CAAC;QAE1D,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import { ObjectUtility } from '@venizia/ignis-inversion';\nimport fs from 'node:fs';\nimport { DEFAULT_PAD_END } from '../common';\nimport { AESAlgorithms, type AESAlgorithmType } from './aes.constants';\nimport { AesEngine } from './aes.engine';\nimport { BaseCryptoAlgorithm } from './base.algorithm';\n\nconst DEFAULT_LENGTH = 16;\n\ninterface IAESExtraOptions {\n iv?: Buffer;\n inputEncoding?: BufferEncoding;\n outputEncoding?: BufferEncoding;\n doThrow?: boolean;\n}\n\n/**\n * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never\n * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no\n * salt to override, so the option would type-check and silently do nothing.\n * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.\n */\nexport class LegacyAES extends BaseCryptoAlgorithm<\n AESAlgorithmType,\n string,\n string,\n string,\n Promise<string>,\n Promise<string>,\n IAESExtraOptions\n> {\n constructor(opts: { algorithm: AESAlgorithmType }) {\n super({ scope: LegacyAES.name, ...opts });\n }\n\n static withAlgorithm(algorithm: AESAlgorithmType) {\n return new LegacyAES({ algorithm });\n }\n\n async encrypt(opts: {\n message: string;\n secret: string;\n opts?: IAESExtraOptions;\n }): Promise<string> {\n const { message, secret } = opts;\n const {\n iv = Buffer.from(crypto.getRandomValues(new Uint8Array(DEFAULT_LENGTH))),\n inputEncoding = 'utf-8',\n outputEncoding = 'base64',\n doThrow = true,\n } = opts.opts ?? {};\n\n try {\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n\n const { cipherText, authTag } = await AesEngine.seal({\n algorithm: this.algorithm,\n key: Buffer.from(secretKey),\n iv,\n plain: Buffer.from(message, inputEncoding),\n });\n\n const parts: Uint8Array[] = [iv];\n\n if (authTag !== null) {\n parts.push(authTag);\n }\n parts.push(cipherText);\n\n return Buffer.concat(parts).toString(outputEncoding);\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n async encryptFile(opts: { absolutePath: string; secret: string }): Promise<string> {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n return this.encrypt({ message: fileContent, secret });\n }\n\n async decrypt(opts: {\n message: string;\n secret: string;\n opts?: IAESExtraOptions;\n }): Promise<string> {\n const { message, secret } = opts;\n const { inputEncoding = 'base64', outputEncoding = 'utf-8', doThrow = true } = opts.opts ?? {};\n\n try {\n const raw = Buffer.from(message, inputEncoding);\n const iv = opts.opts?.iv ?? raw.subarray(0, DEFAULT_LENGTH);\n let messageIndex = iv.length;\n\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n\n let authTag: Uint8Array | null = null;\n if (this.algorithm === AESAlgorithms.AES_256_GCM) {\n authTag = raw.subarray(iv.length, iv.length + DEFAULT_LENGTH);\n messageIndex += authTag.length;\n }\n\n const plain = await AesEngine.open({\n algorithm: this.algorithm,\n key: Buffer.from(secretKey),\n iv,\n cipherText: raw.subarray(messageIndex),\n authTag,\n });\n return Buffer.from(plain).toString(outputEncoding);\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n async decryptFile(opts: { absolutePath: string; secret: string }): Promise<string> {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n return this.decrypt({ message: fileContent, secret });\n }\n\n private normalizeSecretKeyLegacy(opts: { secret: string; length: number; padEnd?: string }) {\n const { secret, length, padEnd = DEFAULT_PAD_END } = opts;\n\n if (secret.length > length) {\n return secret.slice(0, length);\n }\n\n return secret.padEnd(length, padEnd);\n }\n}\n"]}