@authup/server-kit 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/crypto/hash/compare.d.ts +2 -0
  4. package/dist/crypto/hash/compare.d.ts.map +1 -0
  5. package/dist/crypto/hash/hash.d.ts +2 -0
  6. package/dist/crypto/hash/hash.d.ts.map +1 -0
  7. package/dist/crypto/hash/index.d.ts +3 -0
  8. package/dist/crypto/hash/index.d.ts.map +1 -0
  9. package/dist/crypto/index.d.ts +4 -0
  10. package/dist/crypto/index.d.ts.map +1 -0
  11. package/dist/crypto/json-web-token/decode.d.ts +15 -0
  12. package/dist/crypto/json-web-token/decode.d.ts.map +1 -0
  13. package/dist/crypto/json-web-token/index.d.ts +5 -0
  14. package/dist/crypto/json-web-token/index.d.ts.map +1 -0
  15. package/dist/crypto/json-web-token/sign.d.ts +4 -0
  16. package/dist/crypto/json-web-token/sign.d.ts.map +1 -0
  17. package/dist/crypto/json-web-token/type.d.ts +34 -0
  18. package/dist/crypto/json-web-token/type.d.ts.map +1 -0
  19. package/dist/crypto/json-web-token/utils.d.ts +3 -0
  20. package/dist/crypto/json-web-token/utils.d.ts.map +1 -0
  21. package/dist/crypto/json-web-token/verify.d.ts +15 -0
  22. package/dist/crypto/json-web-token/verify.d.ts.map +1 -0
  23. package/dist/crypto/key-pair/constants.d.ts +5 -0
  24. package/dist/crypto/key-pair/constants.d.ts.map +1 -0
  25. package/dist/crypto/key-pair/create.d.ts +3 -0
  26. package/dist/crypto/key-pair/create.d.ts.map +1 -0
  27. package/dist/crypto/key-pair/delete.d.ts +3 -0
  28. package/dist/crypto/key-pair/delete.d.ts.map +1 -0
  29. package/dist/crypto/key-pair/index.d.ts +9 -0
  30. package/dist/crypto/key-pair/index.d.ts.map +1 -0
  31. package/dist/crypto/key-pair/load.d.ts +3 -0
  32. package/dist/crypto/key-pair/load.d.ts.map +1 -0
  33. package/dist/crypto/key-pair/module.d.ts +3 -0
  34. package/dist/crypto/key-pair/module.d.ts.map +1 -0
  35. package/dist/crypto/key-pair/save.d.ts +3 -0
  36. package/dist/crypto/key-pair/save.d.ts.map +1 -0
  37. package/dist/crypto/key-pair/type.d.ts +65 -0
  38. package/dist/crypto/key-pair/type.d.ts.map +1 -0
  39. package/dist/crypto/key-pair/utils/check.d.ts +4 -0
  40. package/dist/crypto/key-pair/utils/check.d.ts.map +1 -0
  41. package/dist/crypto/key-pair/utils/file-name.d.ts +4 -0
  42. package/dist/crypto/key-pair/utils/file-name.d.ts.map +1 -0
  43. package/dist/crypto/key-pair/utils/index.d.ts +5 -0
  44. package/dist/crypto/key-pair/utils/index.d.ts.map +1 -0
  45. package/dist/crypto/key-pair/utils/options.d.ts +3 -0
  46. package/dist/crypto/key-pair/utils/options.d.ts.map +1 -0
  47. package/dist/crypto/key-pair/utils/private-key.d.ts +4 -0
  48. package/dist/crypto/key-pair/utils/private-key.d.ts.map +1 -0
  49. package/dist/domain-event/index.d.ts +5 -0
  50. package/dist/domain-event/index.d.ts.map +1 -0
  51. package/dist/domain-event/publish.d.ts +4 -0
  52. package/dist/domain-event/publish.d.ts.map +1 -0
  53. package/dist/domain-event/redis/index.d.ts +2 -0
  54. package/dist/domain-event/redis/index.d.ts.map +1 -0
  55. package/dist/domain-event/redis/publish.d.ts +4 -0
  56. package/dist/domain-event/redis/publish.d.ts.map +1 -0
  57. package/dist/domain-event/socket/index.d.ts +3 -0
  58. package/dist/domain-event/socket/index.d.ts.map +1 -0
  59. package/dist/domain-event/socket/publish.d.ts +4 -0
  60. package/dist/domain-event/socket/publish.d.ts.map +1 -0
  61. package/dist/domain-event/socket/singleton.d.ts +4 -0
  62. package/dist/domain-event/socket/singleton.d.ts.map +1 -0
  63. package/dist/domain-event/socket/type.d.ts +5 -0
  64. package/dist/domain-event/socket/type.d.ts.map +1 -0
  65. package/dist/domain-event/type.d.ts +7 -0
  66. package/dist/domain-event/type.d.ts.map +1 -0
  67. package/dist/domain-event/utils.d.ts +4 -0
  68. package/dist/domain-event/utils.d.ts.map +1 -0
  69. package/dist/index.cjs +715 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.d.ts +7 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.mjs +684 -0
  74. package/dist/index.mjs.map +1 -0
  75. package/dist/logger/index.d.ts +4 -0
  76. package/dist/logger/index.d.ts.map +1 -0
  77. package/dist/logger/module.d.ts +4 -0
  78. package/dist/logger/module.d.ts.map +1 -0
  79. package/dist/logger/presets/index.d.ts +2 -0
  80. package/dist/logger/presets/index.d.ts.map +1 -0
  81. package/dist/logger/presets/void.d.ts +16 -0
  82. package/dist/logger/presets/void.d.ts.map +1 -0
  83. package/dist/logger/type.d.ts +14 -0
  84. package/dist/logger/type.d.ts.map +1 -0
  85. package/dist/proxy/index.d.ts +3 -0
  86. package/dist/proxy/index.d.ts.map +1 -0
  87. package/dist/proxy/module.d.ts +24 -0
  88. package/dist/proxy/module.d.ts.map +1 -0
  89. package/dist/proxy/utils.d.ts +8 -0
  90. package/dist/proxy/utils.d.ts.map +1 -0
  91. package/dist/smtp/config/index.d.ts +2 -0
  92. package/dist/smtp/config/index.d.ts.map +1 -0
  93. package/dist/smtp/config/singleton.d.ts +5 -0
  94. package/dist/smtp/config/singleton.d.ts.map +1 -0
  95. package/dist/smtp/index.d.ts +5 -0
  96. package/dist/smtp/index.d.ts.map +1 -0
  97. package/dist/smtp/module.d.ts +4 -0
  98. package/dist/smtp/module.d.ts.map +1 -0
  99. package/dist/smtp/singleton.d.ts +3 -0
  100. package/dist/smtp/singleton.d.ts.map +1 -0
  101. package/dist/smtp/type.d.ts +14 -0
  102. package/dist/smtp/type.d.ts.map +1 -0
  103. package/dist/utils/has-property.d.ts +2 -0
  104. package/dist/utils/has-property.d.ts.map +1 -0
  105. package/dist/utils/index.d.ts +2 -0
  106. package/dist/utils/index.d.ts.map +1 -0
  107. package/package.json +77 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Peter Placzek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @authup/server-kit 🛠
2
+
3
+ [![npm version](https://badge.fury.io/js/@authup%2Fserver-core.svg)](https://badge.fury.io/js/@authup%2Fserver-core)
4
+ [![main](https://github.com/authup/authup/actions/workflows/main.yml/badge.svg)](https://github.com/authup/authup/actions/workflows/main.yml)
5
+ [![codecov](https://codecov.io/gh/authup/authup/branch/master/graph/badge.svg?token=FHE347R1NW)](https://codecov.io/gh/authup/authup)
6
+ [![Known Vulnerabilities](https://snyk.io/test/github/authup/authup/badge.svg)](https://snyk.io/test/github/authup/authup)
7
+
8
+ The main propose of this package, is to provide general utilities for server side services.
9
+
10
+ **Table of Contents**
11
+
12
+ - [Documentation](#documentation)
13
+ - [License](#license)
14
+
15
+ ## Documentation
16
+
17
+ To read the docs, visit [https://authup.org/](https://authup.org/)
18
+
19
+ ## License
20
+
21
+ Made with 💚
22
+
23
+ Published under [MIT License](./LICENSE).
@@ -0,0 +1,2 @@
1
+ export declare function compare(value: string, hashedValue: string): Promise<boolean>;
2
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/crypto/hash/compare.ts"],"names":[],"mappings":"AASA,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC,CAEnF"}
@@ -0,0 +1,2 @@
1
+ export declare function hash(str: string, saltOrRounds?: number | string): Promise<string>;
2
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/crypto/hash/hash.ts"],"names":[],"mappings":"AASA,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,GAAG,MAAW,GAAI,OAAO,CAAC,MAAM,CAAC,CAE5F"}
@@ -0,0 +1,3 @@
1
+ export * from './compare';
2
+ export * from './hash';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crypto/hash/index.ts"],"names":[],"mappings":"AAOA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './hash';
2
+ export * from './key-pair';
3
+ export * from './json-web-token';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Jwt, JwtPayload } from 'jsonwebtoken';
2
+ import type { TokenDecodeOptions } from './type';
3
+ /**
4
+ * Decode a JWT token with no verification.
5
+ *
6
+ * @param token
7
+ * @param options
8
+ *
9
+ * @throws TokenError
10
+ */
11
+ export declare function decodeToken(token: string, options: TokenDecodeOptions & {
12
+ complete: true;
13
+ }): Jwt;
14
+ export declare function decodeToken(token: string, options?: TokenDecodeOptions): JwtPayload | string;
15
+ //# sourceMappingURL=decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/decode.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,GAAG,EACH,UAAU,EACb,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG,GAAG,CAAC;AAClG,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,GAAG,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './decode';
2
+ export * from './sign';
3
+ export * from './type';
4
+ export * from './verify';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import type { TokenSignOptions } from './type';
3
+ export declare function signToken(payload: string | object | Buffer | Record<string, any>, context: TokenSignOptions): Promise<string>;
4
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/sign.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C,wBAAsB,SAAS,CAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvD,OAAO,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA4BjB"}
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ import type { DecodeOptions, Jwt, SignOptions, VerifyOptions } from 'jsonwebtoken';
3
+ import type { KeyType } from '@authup/core';
4
+ import type { KeyPair, KeyPairOptions } from '../key-pair';
5
+ export { Jwt, };
6
+ export type TokenSignOptions = ({
7
+ type: `${KeyType.RSA}` | KeyType.RSA;
8
+ algorithm?: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512';
9
+ keyPair: KeyPair | Partial<KeyPairOptions> | string;
10
+ } | {
11
+ type: `${KeyType.EC}` | KeyType.EC;
12
+ algorithm?: 'ES256' | 'ES384' | 'ES512';
13
+ keyPair: KeyPair | Partial<KeyPairOptions> | string;
14
+ } | {
15
+ type: `${KeyType.OCT}` | KeyType.OCT;
16
+ algorithm?: 'HS256' | 'HS384' | 'HS512';
17
+ secret: string | Buffer;
18
+ }) & Omit<SignOptions, 'algorithm'>;
19
+ export type TokenVerifyRSAlgorithm = 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512';
20
+ export type TokenVerifyOptions = ({
21
+ type: `${KeyType.RSA}` | KeyType.RSA;
22
+ algorithms?: TokenVerifyRSAlgorithm[];
23
+ keyPair: Omit<KeyPair, 'privateKey'> | KeyPair | Partial<KeyPairOptions> | string;
24
+ } | {
25
+ type: `${KeyType.EC}` | KeyType.EC;
26
+ algorithms?: ('ES256' | 'ES384' | 'ES512')[];
27
+ keyPair: Omit<KeyPair, 'privateKey'> | KeyPair | Partial<KeyPairOptions> | string;
28
+ } | {
29
+ type: `${KeyType.OCT}` | KeyType.OCT;
30
+ algorithms?: ('HS256' | 'HS384' | 'HS512')[];
31
+ secret: string | Buffer;
32
+ }) & Omit<VerifyOptions, 'algorithms'>;
33
+ export type TokenDecodeOptions = DecodeOptions;
34
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/type.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EACR,aAAa,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EACjD,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EACH,GAAG,GACN,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC;IAC5B,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GACvC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5B,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAA;CACtD,GAAG;IACA,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAA;CACtD,GAAG;IACA,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAChE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5B,MAAM,MAAM,kBAAkB,GAAG,CAAC;IAC9B,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrC,UAAU,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACtC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAA;CACpF,GAAG;IACA,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC;IAC7C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAA;CACpF,GAAG;IACA,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC;IAC7C,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TokenError } from '@authup/core';
2
+ export declare function createErrorForJWTError(e: unknown): TokenError;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,OAAO,GAAI,UAAU,CA8B9D"}
@@ -0,0 +1,15 @@
1
+ import type { Jwt, JwtPayload } from 'jsonwebtoken';
2
+ import type { TokenVerifyOptions } from './type';
3
+ /**
4
+ * Verify JWT.
5
+ *
6
+ * @param token
7
+ * @param context
8
+ *
9
+ * @throws TokenError
10
+ */
11
+ export declare function verifyToken(token: string, context: TokenVerifyOptions & {
12
+ complete: true;
13
+ }): Promise<string | Jwt>;
14
+ export declare function verifyToken(token: string, context: TokenVerifyOptions): Promise<JwtPayload | string>;
15
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/crypto/json-web-token/verify.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjD;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AAC1H,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare enum KeyPairKind {
2
+ PRIVATE = "private",
3
+ PUBLIC = "public"
4
+ }
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,WAAW;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CACpB"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPair, KeyPairOptions } from './type';
2
+ export declare function createKeyPair(context?: Partial<KeyPairOptions>): Promise<KeyPair>;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/create.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAItD,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,OAAO,CAAC,CA2DxF"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPairOptions } from './type';
2
+ export declare function deleteKeyPair(context?: Partial<KeyPairOptions>): Promise<void>;
3
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/delete.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAI7C,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,IAAI,CAAC,CAiBrF"}
@@ -0,0 +1,9 @@
1
+ export * from './constants';
2
+ export * from './create';
3
+ export * from './delete';
4
+ export * from './load';
5
+ export * from './module';
6
+ export * from './save';
7
+ export * from './type';
8
+ export * from './utils';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPair, KeyPairOptions } from './type';
2
+ export declare function loadKeyPair(context?: Partial<KeyPairOptions>): Promise<KeyPair | undefined>;
3
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/load.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAKtD,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CA4DlG"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPair, KeyPairOptions } from './type';
2
+ export declare function useKeyPair(value?: Partial<KeyPairOptions> | string): Promise<KeyPair>;
3
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/module.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAOtD,wBAAsB,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC,CAuB5F"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPair, KeyPairOptions } from './type';
2
+ export declare function saveKeyPair(keyPair: KeyPair, context?: KeyPairOptions): Promise<KeyPair>;
3
+ //# sourceMappingURL=save.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/save.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAItD,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAI,OAAO,CAAC,OAAO,CAAC,CAoB/F"}
@@ -0,0 +1,65 @@
1
+ /// <reference types="node" />
2
+ import type { DSAKeyPairOptions, ECKeyPairOptions, RSAKeyPairOptions, RSAPSSKeyPairOptions } from 'node:crypto';
3
+ export type KeyPair = {
4
+ privateKey: string;
5
+ publicKey: string;
6
+ };
7
+ export type RSAKeyPairGenerator = {
8
+ type: 'rsa';
9
+ } & RSAKeyPairOptions<'pem', 'pem'>;
10
+ export type RSAPSSKeyPairGenerator = {
11
+ type: 'rsa-pss';
12
+ } & RSAPSSKeyPairOptions<'pem', 'pem'>;
13
+ export type DSAKeyPairGenerator = {
14
+ type: 'dsa';
15
+ } & DSAKeyPairOptions<'pem', 'pem'>;
16
+ export type ECKeyPairGenerator = {
17
+ type: 'ec';
18
+ } & ECKeyPairOptions<'pem', 'pem'>;
19
+ export type KeyPairGenerator = DSAKeyPairGenerator | RSAKeyPairGenerator | RSAPSSKeyPairGenerator | ECKeyPairGenerator;
20
+ export type KeyPairBaseOptions = {
21
+ /**
22
+ * Directory where to save key-pair.
23
+ *
24
+ * default: process.cwd()
25
+ */
26
+ directory: string;
27
+ /**
28
+ * Private key name
29
+ *
30
+ * default: private
31
+ */
32
+ privateName: string;
33
+ /**
34
+ * Extension for private key.
35
+ *
36
+ * default: pem
37
+ */
38
+ privateExtension: string;
39
+ /**
40
+ * Public key name
41
+ *
42
+ * default: public
43
+ */
44
+ publicName: string;
45
+ /**
46
+ * Extension for public key.
47
+ *
48
+ * default: pem
49
+ */
50
+ publicExtension: string;
51
+ /**
52
+ * Passphrase for private key.
53
+ *
54
+ * default: undefined
55
+ */
56
+ passphrase: string;
57
+ /**
58
+ * Save key-pair to file system.
59
+ *
60
+ * default: false
61
+ */
62
+ save: boolean;
63
+ };
64
+ export type KeyPairOptions = KeyPairBaseOptions & KeyPairGenerator;
65
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/crypto/key-pair/type.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EACR,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,OAAO,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,KAAK,CAAA;CACd,GAAG,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,SAAS,CAAC;CACnB,GAAG,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,KAAK,CAAA;CACd,GAAG,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,IAAI,CAAC;CACd,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEnC,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAClD,mBAAmB,GACnB,sBAAsB,GACtB,kBAAkB,CAAC;AAEnB,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,OAAO,CAAA;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { KeyPair } from '../type';
2
+ export declare function isKeyPair(data: unknown): data is KeyPair;
3
+ export declare function isKeyPairWithPublicKey(data: unknown): data is Omit<KeyPair, 'privateKey'>;
4
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-pair/utils/check.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAI,IAAI,IAAI,OAAO,CAIzD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAI,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAG1F"}
@@ -0,0 +1,4 @@
1
+ import { KeyPairKind } from '../constants';
2
+ import type { KeyPairOptions } from '../type';
3
+ export declare function buildKeyFileName(type: `${KeyPairKind}`, context?: Partial<KeyPairOptions>): string;
4
+ //# sourceMappingURL=file-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-name.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-pair/utils/file-name.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,GAAG,WAAW,EAAE,EACtB,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,UA8CpC"}
@@ -0,0 +1,5 @@
1
+ export * from './check';
2
+ export * from './options';
3
+ export * from './file-name';
4
+ export * from './private-key';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-pair/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { KeyPairOptions } from '../type';
2
+ export declare function extendKeyPairOptions(options?: Partial<KeyPairOptions>): KeyPairOptions;
3
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-pair/utils/options.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,oBAAoB,CAChC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GACjC,cAAc,CAwCjB"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import type { KeyPairOptions } from '../type';
3
+ export declare function decryptRSAPrivateKey(context: KeyPairOptions, key: string | Buffer): string;
4
+ //# sourceMappingURL=private-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-key.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-pair/utils/private-key.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,MAAM,GAAG,MAAM,GACpB,MAAM,CAkBT"}
@@ -0,0 +1,5 @@
1
+ export * from './publish';
2
+ export * from './redis';
3
+ export * from './socket';
4
+ export * from './type';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain-event/index.ts"],"names":[],"mappings":"AAOA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DomainsEventContext } from '@authup/core';
2
+ import type { DomainEventDestinations } from './type';
3
+ export declare function publishDomainEvent(context: DomainsEventContext, destinations: DomainEventDestinations): Promise<void>;
4
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/domain-event/publish.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAEtD,wBAAsB,kBAAkB,CACpC,OAAO,EAAE,mBAAmB,EAC5B,YAAY,EAAE,uBAAuB,iBAIxC"}
@@ -0,0 +1,2 @@
1
+ export * from './publish';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain-event/redis/index.ts"],"names":[],"mappings":"AAOA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DomainsEventContext } from '@authup/core';
2
+ import type { DomainEventDestinations } from '../type';
3
+ export declare function publishDomainRedisEvent(context: DomainsEventContext, destinations: DomainEventDestinations): Promise<any>;
4
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/domain-event/redis/publish.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGvD,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,mBAAmB,EAC5B,YAAY,EAAE,uBAAuB,GACrC,OAAO,CAAC,GAAG,CAAC,CA4Bf"}
@@ -0,0 +1,3 @@
1
+ export * from './publish';
2
+ export * from './singleton';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain-event/socket/index.ts"],"names":[],"mappings":"AAOA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DomainsEventContext } from '@authup/core';
2
+ import type { DomainEventDestinations } from '../type';
3
+ export declare function publishDomainSocketEvent(context: DomainsEventContext, destinations: DomainEventDestinations): void;
4
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/domain-event/socket/publish.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIvD,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,mBAAmB,EAC5B,YAAY,EAAE,uBAAuB,QA+CxC"}
@@ -0,0 +1,4 @@
1
+ import { Emitter } from '@socket.io/redis-emitter';
2
+ import type { SocketServerToClientEvents } from './type';
3
+ export declare function useSocketEmitter(): Emitter<SocketServerToClientEvents>;
4
+ //# sourceMappingURL=singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../src/domain-event/socket/singleton.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAIzD,wBAAgB,gBAAgB,IAAK,OAAO,CAAC,0BAA0B,CAAC,CAQvE"}
@@ -0,0 +1,5 @@
1
+ import type { DomainEventFullName, DomainsEventContext, SocketServerToClientEventContext } from '@authup/core';
2
+ export type SocketServerToClientEvents = {
3
+ [K in DomainEventFullName]: (data: SocketServerToClientEventContext<DomainsEventContext>) => void;
4
+ };
5
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/domain-event/socket/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EACnC,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,0BAA0B,GAAG;KACpC,CAAC,IAAI,mBAAmB,GAAG,CAAC,IAAI,EAAE,gCAAgC,CAAC,mBAAmB,CAAC,KAAK,IAAI;CACpG,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type DomainEventChannelName = string | ((id?: string | number) => string);
2
+ export type DomainEventDestination = {
3
+ namespace?: string;
4
+ channel: DomainEventChannelName;
5
+ };
6
+ export type DomainEventDestinations = DomainEventDestination[];
7
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/domain-event/type.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,sBAAsB,CAAA;CAClC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DomainEventChannelName } from './type';
2
+ export declare function transformDomainEventData<T>(input: T): T;
3
+ export declare function buildDomainEventChannelName(input: DomainEventChannelName, id?: string | number): string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/domain-event/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAI,CAAC,CAYxD;AAED,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,sBAAsB,EAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GACpB,MAAM,CAMT"}