@jayfong/x-server 2.64.0 → 2.66.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.
package/lib/_cjs/index.js CHANGED
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ var _ctx_storage = require("./core/ctx_storage");
5
+ Object.keys(_ctx_storage).forEach(function (key) {
6
+ if (key === "default" || key === "__esModule") return;
7
+ if (key in exports && exports[key] === _ctx_storage[key]) return;
8
+ exports[key] = _ctx_storage[key];
9
+ });
4
10
  var _define_bus = require("./core/define_bus");
5
11
  Object.keys(_define_bus).forEach(function (key) {
6
12
  if (key === "default" || key === "__esModule") return;
@@ -145,6 +151,12 @@ Object.keys(_captcha).forEach(function (key) {
145
151
  if (key in exports && exports[key] === _captcha[key]) return;
146
152
  exports[key] = _captcha[key];
147
153
  });
154
+ var _crypto = require("./services/crypto");
155
+ Object.keys(_crypto).forEach(function (key) {
156
+ if (key === "default" || key === "__esModule") return;
157
+ if (key in exports && exports[key] === _crypto[key]) return;
158
+ exports[key] = _crypto[key];
159
+ });
148
160
  var _db_value = require("./services/db_value");
149
161
  Object.keys(_db_value).forEach(function (key) {
150
162
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.CryptoService = void 0;
6
+ var _nodeCrypto = _interopRequireDefault(require("node:crypto"));
7
+ class CryptoService {
8
+ constructor() {
9
+ this.serviceName = 'crypto';
10
+ }
11
+ /**
12
+ * 将给定的文本转换为 Base64 编码的字符串
13
+ *
14
+ * @param text 需要编码的原始文本
15
+ * @returns 返回 Base64 编码后的字符串
16
+ */
17
+ base64Encode(text) {
18
+ return Buffer.from(text).toString('base64');
19
+ }
20
+
21
+ /**
22
+ * 将 Base64 编码的字符串转换为 UTF-8 编码的字符串
23
+ *
24
+ * @param text Base64 编码的字符串
25
+ * @returns 转换后的 UTF-8 编码的字符串
26
+ */
27
+ base64Decode(text) {
28
+ return Buffer.from(text, 'base64').toString('utf8');
29
+ }
30
+
31
+ /**
32
+ * 将字符串文本编码为Base64 URL格式
33
+ *
34
+ * 此函数的目的是将输入的字符串转换为Base64编码,并进一步转换为URL安全的格式
35
+ * Base64标准字符集中的'+'和'/'在URL中有特殊意义,因此需要被替换为'-'和'_'
36
+ * 此外,Base64编码中用于填充的'='字符在URL中通常被视为不必要的,因此也会被移除
37
+ *
38
+ * @param text 需要被编码的字符串文本
39
+ * @returns 编码后的Base64 URL安全字符串
40
+ */
41
+ base64UrlEncode(text) {
42
+ // 将输入文本转换为Buffer对象,并进一步将其转换为Base64编码的字符串
43
+ let base64 = Buffer.from(text).toString('base64');
44
+
45
+ // 将Base64编码中的'+'替换为'-',以适应URL安全要求
46
+ base64 = base64.replace(/\+/g, '-');
47
+
48
+ // 将Base64编码中的'/'替换为'_',以适应URL安全要求
49
+ base64 = base64.replace(/\//g, '_');
50
+
51
+ // 移除Base64编码中用于填充的'='字符,以适应URL安全要求
52
+ base64 = base64.replace(/=/g, '');
53
+
54
+ // 返回经过URL安全处理的Base64编码字符串
55
+ return base64;
56
+ }
57
+
58
+ /**
59
+ * 解码base64url格式的字符串
60
+ * base64url是一种用于URL的base64编码变体,它将标准base64中的'+'和'/'字符替换为'-'和'_',以避免URL编码
61
+ * 此函数的作用是将base64url编码的字符串解码回原始字符串
62
+ *
63
+ * @param text 需要解码的base64url格式的字符串
64
+ * @returns 解码后的原始字符串
65
+ */
66
+ base64UrlDecode(text) {
67
+ // 将base64url编码中的'-'和'_'替换回标准base64编码中的'+'和'/'
68
+ // 然后使用Node.js的Buffer对象从base64编码转换为utf8格式的字符串
69
+ return Buffer.from(text.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf8');
70
+ }
71
+
72
+ /**
73
+ * 使用MD5算法对文本进行哈希处理
74
+ *
75
+ * @param text 需要进行哈希处理的文本
76
+ * @returns 返回经过MD5哈希处理后的字符串
77
+ */
78
+ md5(text) {
79
+ return _nodeCrypto.default.createHash('md5').update(text).digest('hex');
80
+ }
81
+
82
+ /**
83
+ * 使用SHA-1算法对文本进行哈希处理
84
+ *
85
+ * SHA-1是一种安全散列算法,它接收一个输入(在此例中为文本字符串),
86
+ * 并返回一个固定大小的160位散列值,通常以40位的十六进制数字表示
87
+ * 此函数用于将给定的文本转换为SHA-1散列值,常用于数据完整性校验或存储密码的散列值
88
+ *
89
+ * @param text 待哈希处理的文本字符串
90
+ * @returns 返回文本的SHA-1散列值,以十六进制字符串形式表示
91
+ */
92
+ sha1(text) {
93
+ return _nodeCrypto.default.createHash('sha1').update(text).digest('hex');
94
+ }
95
+
96
+ /**
97
+ * 使用SHA-256算法对文本进行哈希处理
98
+ *
99
+ * @param text 输入的文本字符串
100
+ * @returns 返回经过SHA-256哈希处理后的十六进制字符串
101
+ */
102
+ sha256(text) {
103
+ return _nodeCrypto.default.createHash('sha256').update(text).digest('hex');
104
+ }
105
+
106
+ /**
107
+ * 使用SHA-512算法对文本进行哈希处理
108
+ *
109
+ * @param text 输入的文本字符串
110
+ * @returns 返回经过SHA-512哈希处理后的字符串
111
+ */
112
+ sha512(text) {
113
+ return _nodeCrypto.default.createHash('sha512').update(text).digest('hex');
114
+ }
115
+
116
+ /**
117
+ * 使用给定的密钥对给定的字符串执行 AES 加密(加密模式为 ECB,填充方式为 PKCS7)。
118
+ *
119
+ * @param text - 要加密的字符串。
120
+ * @param key - 用于加密的密钥(仅支持16字节的密钥)。
121
+ */
122
+ aesEncrypt(text, key) {
123
+ const cipher = _nodeCrypto.default.createCipheriv('aes-128-ecb', key, null);
124
+ let encrypted = cipher.update(text, 'utf8', 'base64');
125
+ encrypted += cipher.final('base64');
126
+ return encrypted;
127
+ }
128
+
129
+ /**
130
+ * 使用给定的密钥对给定的字符串执行 AES 解密(解密模式为 ECB,填充方式为 PKCS7)。
131
+ *
132
+ * @param text - 要解密的字符串。
133
+ * @param key - 用于解密的密钥(仅支持16字节的密钥)。
134
+ */
135
+ aesDecrypt(text, key) {
136
+ const decipher = _nodeCrypto.default.createDecipheriv('aes-128-ecb', key, null);
137
+ let decrypted = decipher.update(text, 'base64', 'utf8');
138
+ decrypted += decipher.final('utf8');
139
+ return decrypted;
140
+ }
141
+
142
+ /**
143
+ * 使用AES加密算法对JSON数据进行加密
144
+ *
145
+ * 该方法首先将payload参数序列化为JSON字符串,然后使用指定的密钥进行AES加密
146
+ * 主要用于在传输敏感信息前,对数据进行加密处理,以确保数据的安全性
147
+ *
148
+ * @param payload 任何类型的对象,代表需要加密的原始数据
149
+ * @param key 字符串类型的密钥,用于AES加密算法
150
+ * 密钥需要符合AES加密算法的长度要求
151
+ * @returns 返回加密后的字符串数据
152
+ * 加密后的数据可以安全地进行网络传输或存储
153
+ */
154
+ aesEncryptJson(payload, key) {
155
+ // 将payload对象序列化为JSON字符串,以便进行加密处理
156
+ // 使用指定的密钥对序列化后的JSON字符串进行AES加密
157
+ // 返回加密后的数据,确保数据在传输或存储过程中的安全性
158
+ return this.aesEncrypt(JSON.stringify(payload), key);
159
+ }
160
+
161
+ /**
162
+ * 使用AES算法解密给定的文本,并将解密后的结果解析为JSON对象
163
+ *
164
+ * @param text 需要解密的加密文本
165
+ * @param key 解密用的密钥,必须与加密时使用的密钥相同
166
+ * @returns 返回解密后的JSON对象,类型为泛型T,根据调用时指定的类型解析
167
+ */
168
+ aesDecryptJson(text, key) {
169
+ // 使用指定的密钥对给定的加密数据进行AES解密
170
+ // 将解密后的数据反序列化为JSON对象,以便后续的处理
171
+ // 返回解密后的数据,确保数据在传输或存储过程中的安全性
172
+ return JSON.parse(this.aesDecrypt(text, key));
173
+ }
174
+ }
175
+ exports.CryptoService = CryptoService;
package/lib/_cjs/x.js CHANGED
@@ -7,6 +7,7 @@ var _os = _interopRequireDefault(require("os"));
7
7
  var _path = _interopRequireDefault(require("path"));
8
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
9
9
  var _ctx_storage = require("./core/ctx_storage");
10
+ var _crypto = require("./services/crypto");
10
11
  var _db_value = require("./services/db_value");
11
12
  var _dispose = require("./services/dispose");
12
13
  var _emoji = require("./services/emoji");
@@ -29,4 +30,4 @@ const x = exports.x = {
29
30
  _fsExtra.default.ensureDirSync(x.dataDir);
30
31
  x.register(new _dispose.DisposeService({
31
32
  disposeOnExit: true
32
- }), new _log.LogService(), new _emoji.EmojiService(), new _db_value.DbValueService());
33
+ }), new _log.LogService(), new _emoji.EmojiService(), new _db_value.DbValueService(), new _crypto.CryptoService());
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './core/ctx_storage';
1
2
  export * from './core/define_bus';
2
3
  export * from './core/define_cron';
3
4
  export * from './core/define_handler';
@@ -22,6 +23,7 @@ export * from './plugins/xml_parser';
22
23
  export * from './services/base';
23
24
  export * from './services/cache';
24
25
  export * from './services/captcha';
26
+ export * from './services/crypto';
25
27
  export * from './services/db_value';
26
28
  export * from './services/dingtalk';
27
29
  export * from './services/dispose';
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // @index(['./**/*.ts', '!**/*.test.ts', '!./cli/**', '!**/_*'], f => `export * from '${f.path}';`)
2
+ export * from "./core/ctx_storage";
2
3
  export * from "./core/define_bus";
3
4
  export * from "./core/define_cron";
4
5
  export * from "./core/define_handler";
@@ -23,6 +24,7 @@ export * from "./plugins/xml_parser";
23
24
  export * from "./services/base";
24
25
  export * from "./services/cache";
25
26
  export * from "./services/captcha";
27
+ export * from "./services/crypto";
26
28
  export * from "./services/db_value";
27
29
  export * from "./services/dingtalk";
28
30
  export * from "./services/dispose";
@@ -0,0 +1,110 @@
1
+ import { BaseService } from './base';
2
+ export declare class CryptoService implements BaseService {
3
+ serviceName: string;
4
+ /**
5
+ * 将给定的文本转换为 Base64 编码的字符串
6
+ *
7
+ * @param text 需要编码的原始文本
8
+ * @returns 返回 Base64 编码后的字符串
9
+ */
10
+ base64Encode(text: string): string;
11
+ /**
12
+ * 将 Base64 编码的字符串转换为 UTF-8 编码的字符串
13
+ *
14
+ * @param text Base64 编码的字符串
15
+ * @returns 转换后的 UTF-8 编码的字符串
16
+ */
17
+ base64Decode(text: string): string;
18
+ /**
19
+ * 将字符串文本编码为Base64 URL格式
20
+ *
21
+ * 此函数的目的是将输入的字符串转换为Base64编码,并进一步转换为URL安全的格式
22
+ * Base64标准字符集中的'+'和'/'在URL中有特殊意义,因此需要被替换为'-'和'_'
23
+ * 此外,Base64编码中用于填充的'='字符在URL中通常被视为不必要的,因此也会被移除
24
+ *
25
+ * @param text 需要被编码的字符串文本
26
+ * @returns 编码后的Base64 URL安全字符串
27
+ */
28
+ base64UrlEncode(text: string): string;
29
+ /**
30
+ * 解码base64url格式的字符串
31
+ * base64url是一种用于URL的base64编码变体,它将标准base64中的'+'和'/'字符替换为'-'和'_',以避免URL编码
32
+ * 此函数的作用是将base64url编码的字符串解码回原始字符串
33
+ *
34
+ * @param text 需要解码的base64url格式的字符串
35
+ * @returns 解码后的原始字符串
36
+ */
37
+ base64UrlDecode(text: string): string;
38
+ /**
39
+ * 使用MD5算法对文本进行哈希处理
40
+ *
41
+ * @param text 需要进行哈希处理的文本
42
+ * @returns 返回经过MD5哈希处理后的字符串
43
+ */
44
+ md5(text: string): string;
45
+ /**
46
+ * 使用SHA-1算法对文本进行哈希处理
47
+ *
48
+ * SHA-1是一种安全散列算法,它接收一个输入(在此例中为文本字符串),
49
+ * 并返回一个固定大小的160位散列值,通常以40位的十六进制数字表示
50
+ * 此函数用于将给定的文本转换为SHA-1散列值,常用于数据完整性校验或存储密码的散列值
51
+ *
52
+ * @param text 待哈希处理的文本字符串
53
+ * @returns 返回文本的SHA-1散列值,以十六进制字符串形式表示
54
+ */
55
+ sha1(text: string): string;
56
+ /**
57
+ * 使用SHA-256算法对文本进行哈希处理
58
+ *
59
+ * @param text 输入的文本字符串
60
+ * @returns 返回经过SHA-256哈希处理后的十六进制字符串
61
+ */
62
+ sha256(text: string): string;
63
+ /**
64
+ * 使用SHA-512算法对文本进行哈希处理
65
+ *
66
+ * @param text 输入的文本字符串
67
+ * @returns 返回经过SHA-512哈希处理后的字符串
68
+ */
69
+ sha512(text: string): string;
70
+ /**
71
+ * 使用给定的密钥对给定的字符串执行 AES 加密(加密模式为 ECB,填充方式为 PKCS7)。
72
+ *
73
+ * @param text - 要加密的字符串。
74
+ * @param key - 用于加密的密钥(仅支持16字节的密钥)。
75
+ */
76
+ aesEncrypt(text: string, key: string): string;
77
+ /**
78
+ * 使用给定的密钥对给定的字符串执行 AES 解密(解密模式为 ECB,填充方式为 PKCS7)。
79
+ *
80
+ * @param text - 要解密的字符串。
81
+ * @param key - 用于解密的密钥(仅支持16字节的密钥)。
82
+ */
83
+ aesDecrypt(text: string, key: string): string;
84
+ /**
85
+ * 使用AES加密算法对JSON数据进行加密
86
+ *
87
+ * 该方法首先将payload参数序列化为JSON字符串,然后使用指定的密钥进行AES加密
88
+ * 主要用于在传输敏感信息前,对数据进行加密处理,以确保数据的安全性
89
+ *
90
+ * @param payload 任何类型的对象,代表需要加密的原始数据
91
+ * @param key 字符串类型的密钥,用于AES加密算法
92
+ * 密钥需要符合AES加密算法的长度要求
93
+ * @returns 返回加密后的字符串数据
94
+ * 加密后的数据可以安全地进行网络传输或存储
95
+ */
96
+ aesEncryptJson(payload: any, key: string): string;
97
+ /**
98
+ * 使用AES算法解密给定的文本,并将解密后的结果解析为JSON对象
99
+ *
100
+ * @param text 需要解密的加密文本
101
+ * @param key 解密用的密钥,必须与加密时使用的密钥相同
102
+ * @returns 返回解密后的JSON对象,类型为泛型T,根据调用时指定的类型解析
103
+ */
104
+ aesDecryptJson<T>(text: string, key: string): T;
105
+ }
106
+ declare module '../x' {
107
+ interface X {
108
+ crypto: CryptoService;
109
+ }
110
+ }
@@ -0,0 +1,169 @@
1
+ import crypto from 'node:crypto';
2
+ export class CryptoService {
3
+ constructor() {
4
+ this.serviceName = 'crypto';
5
+ }
6
+ /**
7
+ * 将给定的文本转换为 Base64 编码的字符串
8
+ *
9
+ * @param text 需要编码的原始文本
10
+ * @returns 返回 Base64 编码后的字符串
11
+ */
12
+ base64Encode(text) {
13
+ return Buffer.from(text).toString('base64');
14
+ }
15
+
16
+ /**
17
+ * 将 Base64 编码的字符串转换为 UTF-8 编码的字符串
18
+ *
19
+ * @param text Base64 编码的字符串
20
+ * @returns 转换后的 UTF-8 编码的字符串
21
+ */
22
+ base64Decode(text) {
23
+ return Buffer.from(text, 'base64').toString('utf8');
24
+ }
25
+
26
+ /**
27
+ * 将字符串文本编码为Base64 URL格式
28
+ *
29
+ * 此函数的目的是将输入的字符串转换为Base64编码,并进一步转换为URL安全的格式
30
+ * Base64标准字符集中的'+'和'/'在URL中有特殊意义,因此需要被替换为'-'和'_'
31
+ * 此外,Base64编码中用于填充的'='字符在URL中通常被视为不必要的,因此也会被移除
32
+ *
33
+ * @param text 需要被编码的字符串文本
34
+ * @returns 编码后的Base64 URL安全字符串
35
+ */
36
+ base64UrlEncode(text) {
37
+ // 将输入文本转换为Buffer对象,并进一步将其转换为Base64编码的字符串
38
+ let base64 = Buffer.from(text).toString('base64');
39
+
40
+ // 将Base64编码中的'+'替换为'-',以适应URL安全要求
41
+ base64 = base64.replace(/\+/g, '-');
42
+
43
+ // 将Base64编码中的'/'替换为'_',以适应URL安全要求
44
+ base64 = base64.replace(/\//g, '_');
45
+
46
+ // 移除Base64编码中用于填充的'='字符,以适应URL安全要求
47
+ base64 = base64.replace(/=/g, '');
48
+
49
+ // 返回经过URL安全处理的Base64编码字符串
50
+ return base64;
51
+ }
52
+
53
+ /**
54
+ * 解码base64url格式的字符串
55
+ * base64url是一种用于URL的base64编码变体,它将标准base64中的'+'和'/'字符替换为'-'和'_',以避免URL编码
56
+ * 此函数的作用是将base64url编码的字符串解码回原始字符串
57
+ *
58
+ * @param text 需要解码的base64url格式的字符串
59
+ * @returns 解码后的原始字符串
60
+ */
61
+ base64UrlDecode(text) {
62
+ // 将base64url编码中的'-'和'_'替换回标准base64编码中的'+'和'/'
63
+ // 然后使用Node.js的Buffer对象从base64编码转换为utf8格式的字符串
64
+ return Buffer.from(text.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf8');
65
+ }
66
+
67
+ /**
68
+ * 使用MD5算法对文本进行哈希处理
69
+ *
70
+ * @param text 需要进行哈希处理的文本
71
+ * @returns 返回经过MD5哈希处理后的字符串
72
+ */
73
+ md5(text) {
74
+ return crypto.createHash('md5').update(text).digest('hex');
75
+ }
76
+
77
+ /**
78
+ * 使用SHA-1算法对文本进行哈希处理
79
+ *
80
+ * SHA-1是一种安全散列算法,它接收一个输入(在此例中为文本字符串),
81
+ * 并返回一个固定大小的160位散列值,通常以40位的十六进制数字表示
82
+ * 此函数用于将给定的文本转换为SHA-1散列值,常用于数据完整性校验或存储密码的散列值
83
+ *
84
+ * @param text 待哈希处理的文本字符串
85
+ * @returns 返回文本的SHA-1散列值,以十六进制字符串形式表示
86
+ */
87
+ sha1(text) {
88
+ return crypto.createHash('sha1').update(text).digest('hex');
89
+ }
90
+
91
+ /**
92
+ * 使用SHA-256算法对文本进行哈希处理
93
+ *
94
+ * @param text 输入的文本字符串
95
+ * @returns 返回经过SHA-256哈希处理后的十六进制字符串
96
+ */
97
+ sha256(text) {
98
+ return crypto.createHash('sha256').update(text).digest('hex');
99
+ }
100
+
101
+ /**
102
+ * 使用SHA-512算法对文本进行哈希处理
103
+ *
104
+ * @param text 输入的文本字符串
105
+ * @returns 返回经过SHA-512哈希处理后的字符串
106
+ */
107
+ sha512(text) {
108
+ return crypto.createHash('sha512').update(text).digest('hex');
109
+ }
110
+
111
+ /**
112
+ * 使用给定的密钥对给定的字符串执行 AES 加密(加密模式为 ECB,填充方式为 PKCS7)。
113
+ *
114
+ * @param text - 要加密的字符串。
115
+ * @param key - 用于加密的密钥(仅支持16字节的密钥)。
116
+ */
117
+ aesEncrypt(text, key) {
118
+ const cipher = crypto.createCipheriv('aes-128-ecb', key, null);
119
+ let encrypted = cipher.update(text, 'utf8', 'base64');
120
+ encrypted += cipher.final('base64');
121
+ return encrypted;
122
+ }
123
+
124
+ /**
125
+ * 使用给定的密钥对给定的字符串执行 AES 解密(解密模式为 ECB,填充方式为 PKCS7)。
126
+ *
127
+ * @param text - 要解密的字符串。
128
+ * @param key - 用于解密的密钥(仅支持16字节的密钥)。
129
+ */
130
+ aesDecrypt(text, key) {
131
+ const decipher = crypto.createDecipheriv('aes-128-ecb', key, null);
132
+ let decrypted = decipher.update(text, 'base64', 'utf8');
133
+ decrypted += decipher.final('utf8');
134
+ return decrypted;
135
+ }
136
+
137
+ /**
138
+ * 使用AES加密算法对JSON数据进行加密
139
+ *
140
+ * 该方法首先将payload参数序列化为JSON字符串,然后使用指定的密钥进行AES加密
141
+ * 主要用于在传输敏感信息前,对数据进行加密处理,以确保数据的安全性
142
+ *
143
+ * @param payload 任何类型的对象,代表需要加密的原始数据
144
+ * @param key 字符串类型的密钥,用于AES加密算法
145
+ * 密钥需要符合AES加密算法的长度要求
146
+ * @returns 返回加密后的字符串数据
147
+ * 加密后的数据可以安全地进行网络传输或存储
148
+ */
149
+ aesEncryptJson(payload, key) {
150
+ // 将payload对象序列化为JSON字符串,以便进行加密处理
151
+ // 使用指定的密钥对序列化后的JSON字符串进行AES加密
152
+ // 返回加密后的数据,确保数据在传输或存储过程中的安全性
153
+ return this.aesEncrypt(JSON.stringify(payload), key);
154
+ }
155
+
156
+ /**
157
+ * 使用AES算法解密给定的文本,并将解密后的结果解析为JSON对象
158
+ *
159
+ * @param text 需要解密的加密文本
160
+ * @param key 解密用的密钥,必须与加密时使用的密钥相同
161
+ * @returns 返回解密后的JSON对象,类型为泛型T,根据调用时指定的类型解析
162
+ */
163
+ aesDecryptJson(text, key) {
164
+ // 使用指定的密钥对给定的加密数据进行AES解密
165
+ // 将解密后的数据反序列化为JSON对象,以便后续的处理
166
+ // 返回解密后的数据,确保数据在传输或存储过程中的安全性
167
+ return JSON.parse(this.aesDecrypt(text, key));
168
+ }
169
+ }
package/lib/x.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { XHandler } from './core/types';
2
2
  import { BaseService } from './services/base';
3
+ import './services/crypto';
3
4
  import './services/db_value';
4
5
  import './services/dispose';
5
6
  import './services/emoji';
package/lib/x.js CHANGED
@@ -2,6 +2,7 @@ import os from 'os';
2
2
  import path from 'path';
3
3
  import fs from 'fs-extra';
4
4
  import { ctxStorage } from "./core/ctx_storage";
5
+ import { CryptoService } from "./services/crypto";
5
6
  import { DbValueService } from "./services/db_value";
6
7
  import { DisposeService } from "./services/dispose";
7
8
  import { EmojiService } from "./services/emoji";
@@ -24,4 +25,4 @@ export const x = {
24
25
  fs.ensureDirSync(x.dataDir);
25
26
  x.register(new DisposeService({
26
27
  disposeOnExit: true
27
- }), new LogService(), new EmojiService(), new DbValueService());
28
+ }), new LogService(), new EmojiService(), new DbValueService(), new CryptoService());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.64.0",
3
+ "version": "2.66.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",