@nocobase/plugin-multi-app-manager 1.2.13-alpha → 1.3.0-alpha.20240710084543

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 (175) hide show
  1. package/package.json +2 -2
  2. package/dist/client/AppManager.d.ts +0 -10
  3. package/dist/client/AppNameInput.d.ts +0 -10
  4. package/dist/client/MultiAppManagerProvider.d.ts +0 -10
  5. package/dist/client/MultiAppManagerProvider.style.d.ts +0 -13
  6. package/dist/client/Settings.d.ts +0 -10
  7. package/dist/client/index.d.ts +0 -14
  8. package/dist/client/index.js +0 -10
  9. package/dist/client/settings/schemas/applications.d.ts +0 -18
  10. package/dist/client/utils.d.ts +0 -12
  11. package/dist/externalVersion.js +0 -25
  12. package/dist/index.d.ts +0 -10
  13. package/dist/index.js +0 -48
  14. package/dist/locale/en-US.json +0 -11
  15. package/dist/locale/es-ES.json +0 -9
  16. package/dist/locale/index.d.ts +0 -9
  17. package/dist/locale/index.js +0 -36
  18. package/dist/locale/ko_KR.json +0 -11
  19. package/dist/locale/pt-BR.json +0 -9
  20. package/dist/locale/zh-CN.json +0 -14
  21. package/dist/node_modules/mariadb/LICENSE +0 -502
  22. package/dist/node_modules/mariadb/callback.js +0 -41
  23. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
  24. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  25. package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
  26. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
  27. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
  28. package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
  29. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
  30. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
  34. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
  35. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
  36. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
  37. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
  38. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
  39. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  40. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  41. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +0 -74
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
  43. package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
  44. package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
  45. package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
  46. package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
  47. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  48. package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
  49. package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
  50. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  51. package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
  52. package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
  53. package/dist/node_modules/mariadb/lib/connection.js +0 -1460
  54. package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
  55. package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
  56. package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
  57. package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
  58. package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
  59. package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
  60. package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
  61. package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
  62. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  63. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  64. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +0 -141
  65. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
  66. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
  67. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
  68. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
  69. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
  70. package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
  71. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  72. package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
  73. package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
  74. package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
  75. package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
  76. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  77. package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
  78. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  79. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
  80. package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
  81. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
  82. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
  83. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
  84. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
  85. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
  86. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
  87. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
  88. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
  89. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
  90. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
  91. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
  92. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
  93. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
  94. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
  95. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
  96. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
  97. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
  98. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
  99. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
  100. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
  101. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
  102. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
  103. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
  104. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
  105. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
  106. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
  107. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
  108. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
  109. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
  110. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
  111. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
  112. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
  113. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
  114. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
  115. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
  116. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
  117. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
  118. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
  119. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
  120. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
  121. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
  122. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
  123. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
  124. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
  125. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
  126. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
  127. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
  128. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
  129. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
  130. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
  131. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
  132. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
  133. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  134. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  135. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  136. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  137. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  138. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +0 -8
  139. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  140. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  141. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  142. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +0 -23
  143. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +0 -198
  144. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  145. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  146. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  147. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  148. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  149. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  150. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  151. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  152. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  153. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  154. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  155. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +0 -197
  156. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +0 -319
  157. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +0 -290
  158. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  159. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +0 -41
  160. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +0 -180
  161. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +0 -109
  162. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +0 -44
  163. package/dist/node_modules/mariadb/package.json +0 -1
  164. package/dist/node_modules/mariadb/promise.js +0 -34
  165. package/dist/node_modules/mariadb/types/index.d.ts +0 -870
  166. package/dist/server/collections/applications.d.ts +0 -10
  167. package/dist/server/collections/applications.js +0 -75
  168. package/dist/server/index.d.ts +0 -11
  169. package/dist/server/index.js +0 -40
  170. package/dist/server/models/application.d.ts +0 -18
  171. package/dist/server/models/application.js +0 -50
  172. package/dist/server/server.d.ts +0 -26
  173. package/dist/server/server.js +0 -310
  174. package/dist/swagger/index.d.ts +0 -195
  175. package/dist/swagger/index.js +0 -226
@@ -1,55 +0,0 @@
1
- 'use strict';
2
-
3
- const PluginAuth = require('./plugin-auth');
4
- const Crypto = require('crypto');
5
-
6
- /**
7
- * Standard authentication plugin
8
- */
9
- class NativePasswordAuth extends PluginAuth {
10
- constructor(packSeq, compressPackSeq, pluginData, resolve, reject, multiAuthResolver) {
11
- super(resolve, reject, multiAuthResolver);
12
- this.pluginData = pluginData;
13
- this.sequenceNo = packSeq;
14
- this.compressSequenceNo = compressPackSeq;
15
- }
16
-
17
- start(out, opts, info) {
18
- //seed is ended with a null byte value.
19
- const data = this.pluginData.slice(0, 20);
20
- let authToken = NativePasswordAuth.encryptPassword(opts.password, data, 'sha1');
21
-
22
- out.startPacket(this);
23
- if (authToken.length > 0) {
24
- out.writeBuffer(authToken, 0, authToken.length);
25
- out.flushBuffer(true);
26
- } else {
27
- out.writeEmptyPacket(true);
28
- }
29
- this.emit('send_end');
30
- this.onPacketReceive = this.successSend;
31
- }
32
-
33
- static encryptPassword(password, seed, algorithm) {
34
- if (!password) return Buffer.alloc(0);
35
-
36
- let hash = Crypto.createHash(algorithm);
37
- let stage1 = hash.update(password, 'utf8').digest();
38
- hash = Crypto.createHash(algorithm);
39
-
40
- let stage2 = hash.update(stage1).digest();
41
- hash = Crypto.createHash(algorithm);
42
-
43
- hash.update(seed);
44
- hash.update(stage2);
45
-
46
- let digest = hash.digest();
47
- let returnBytes = Buffer.allocUnsafe(digest.length);
48
- for (let i = 0; i < digest.length; i++) {
49
- returnBytes[i] = stage1[i] ^ digest[i];
50
- }
51
- return returnBytes;
52
- }
53
- }
54
-
55
- module.exports = NativePasswordAuth;
@@ -1,58 +0,0 @@
1
- const PluginAuth = require('./plugin-auth');
2
-
3
- /**
4
- * Use PAM authentication
5
- */
6
- class PamPasswordAuth extends PluginAuth {
7
- constructor(packSeq, compressPackSeq, pluginData, resolve, reject, multiAuthResolver) {
8
- super(resolve, reject, multiAuthResolver);
9
- this.pluginData = pluginData;
10
- this.sequenceNo = packSeq;
11
- this.counter = 0;
12
- }
13
-
14
- start(out, opts, info) {
15
- this.exchange(this.pluginData, out, opts, info);
16
- this.onPacketReceive = this.response;
17
- }
18
-
19
- exchange(buffer, out, opts, info) {
20
- //conversation is :
21
- // - first byte is information tell if question is a password (4) or clear text (2).
22
- // - other bytes are the question to user
23
-
24
- out.startPacket(this);
25
-
26
- let pwd;
27
- if (Array.isArray(opts.password)) {
28
- pwd = opts.password[this.counter];
29
- this.counter++;
30
- } else {
31
- pwd = opts.password;
32
- }
33
-
34
- if (pwd) out.writeString(pwd);
35
- out.writeInt8(0);
36
- out.flushBuffer(true);
37
- }
38
-
39
- response(packet, out, opts, info) {
40
- const marker = packet.peek();
41
- switch (marker) {
42
- //*********************************************************************************************************
43
- //* OK_Packet and Err_Packet ending packet
44
- //*********************************************************************************************************
45
- case 0x00:
46
- case 0xff:
47
- this.emit('send_end');
48
- return this.successSend(packet, out, opts, info);
49
-
50
- default:
51
- let promptData = packet.readBuffer();
52
- this.exchange(promptData, out, opts, info);
53
- this.onPacketReceive = this.response;
54
- }
55
- }
56
- }
57
-
58
- module.exports = PamPasswordAuth;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- const Command = require('../../command');
4
-
5
- /**
6
- * Base authentication plugin
7
- */
8
- class PluginAuth extends Command {
9
- constructor(resolve, reject, multiAuthResolver) {
10
- super(resolve, reject);
11
- this.multiAuthResolver = multiAuthResolver;
12
- }
13
-
14
- successSend(packet, out, opts, info) {
15
- this.multiAuthResolver(packet, out, opts, info);
16
- }
17
- }
18
-
19
- module.exports = PluginAuth;
@@ -1,142 +0,0 @@
1
- const PluginAuth = require('./plugin-auth');
2
- const fs = require('fs');
3
- const crypto = require('crypto');
4
- const Errors = require('../../../misc/errors');
5
-
6
- /**
7
- * Use Sha256 authentication
8
- */
9
- class Sha256PasswordAuth extends PluginAuth {
10
- constructor(packSeq, compressPackSeq, pluginData, resolve, reject, multiAuthResolver) {
11
- super(resolve, reject, multiAuthResolver);
12
- this.pluginData = pluginData;
13
- this.sequenceNo = packSeq;
14
- this.counter = 0;
15
- this.initialState = true;
16
- }
17
-
18
- start(out, opts, info) {
19
- this.exchange(this.pluginData, out, opts, info);
20
- this.onPacketReceive = this.response;
21
- }
22
-
23
- exchange(buffer, out, opts, info) {
24
- if (this.initialState) {
25
- if (!opts.password) {
26
- out.startPacket(this);
27
- out.writeEmptyPacket(true);
28
- return;
29
- } else if (opts.ssl) {
30
- // using SSL, so sending password in clear
31
- out.startPacket(this);
32
- if (opts.password) {
33
- out.writeString(opts.password);
34
- }
35
- out.writeInt8(0);
36
- out.flushBuffer(true);
37
- return;
38
- } else {
39
- // retrieve public key from configuration or from server
40
- if (opts.rsaPublicKey) {
41
- try {
42
- let key = opts.rsaPublicKey;
43
- if (!key.includes('-----BEGIN')) {
44
- // rsaPublicKey contain path
45
- key = fs.readFileSync(key, 'utf8');
46
- }
47
- this.publicKey = Sha256PasswordAuth.retreivePublicKey(key);
48
- } catch (err) {
49
- return this.throwError(err, info);
50
- }
51
- } else {
52
- if (!opts.allowPublicKeyRetrieval) {
53
- return this.throwError(
54
- Errors.createError(
55
- 'RSA public key is not available client side. Either set option `rsaPublicKey` to indicate' +
56
- ' public key path, or allow public key retrieval with option `allowPublicKeyRetrieval`',
57
- null,
58
- true,
59
- info,
60
- '08S01',
61
- Errors.ER_CANNOT_RETRIEVE_RSA_KEY
62
- ),
63
- info
64
- );
65
- }
66
- this.initialState = false;
67
-
68
- // ask public Key Retrieval
69
- out.startPacket(this);
70
- out.writeInt8(0x01);
71
- out.flushBuffer(true);
72
- return;
73
- }
74
- }
75
-
76
- // send Sha256Password Packet
77
- Sha256PasswordAuth.sendSha256PwdPacket(
78
- this,
79
- this.pluginData,
80
- this.publicKey,
81
- opts.password,
82
- out
83
- );
84
- } else {
85
- // has request public key
86
- this.publicKey = Sha256PasswordAuth.retreivePublicKey(buffer.toString('utf8', 1));
87
- Sha256PasswordAuth.sendSha256PwdPacket(
88
- this,
89
- this.pluginData,
90
- this.publicKey,
91
- opts.password,
92
- out
93
- );
94
- }
95
- }
96
-
97
- static retreivePublicKey(key) {
98
- return key.replace('(-+BEGIN PUBLIC KEY-+\\r?\\n|\\n?-+END PUBLIC KEY-+\\r?\\n?)', '');
99
- }
100
-
101
- static sendSha256PwdPacket(cmd, pluginData, publicKey, password, out) {
102
- const truncatedSeed = pluginData.slice(0, pluginData.length - 1);
103
- out.startPacket(cmd);
104
- const enc = Sha256PasswordAuth.encrypt(truncatedSeed, password, publicKey);
105
- out.writeBuffer(enc, 0, enc.length);
106
- out.flushBuffer(cmd);
107
- }
108
-
109
- // encrypt password with public key
110
- static encrypt(seed, password, publicKey) {
111
- const nullFinishedPwd = Buffer.from(password + '\0');
112
- const xorBytes = Buffer.allocUnsafe(nullFinishedPwd.length);
113
- const seedLength = seed.length;
114
- for (let i = 0; i < xorBytes.length; i++) {
115
- xorBytes[i] = nullFinishedPwd[i] ^ seed[i % seedLength];
116
- }
117
- return crypto.publicEncrypt(
118
- { key: publicKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING },
119
- xorBytes
120
- );
121
- }
122
-
123
- response(packet, out, opts, info) {
124
- const marker = packet.peek();
125
- switch (marker) {
126
- //*********************************************************************************************************
127
- //* OK_Packet and Err_Packet ending packet
128
- //*********************************************************************************************************
129
- case 0x00:
130
- case 0xff:
131
- this.emit('send_end');
132
- return this.successSend(packet, out, opts, info);
133
-
134
- default:
135
- let promptData = packet.readBufferRemaining();
136
- this.exchange(promptData, out, opts, info);
137
- this.onPacketReceive = this.response;
138
- }
139
- }
140
- }
141
-
142
- module.exports = Sha256PasswordAuth;
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- const Capabilities = require('../../const/capabilities');
4
-
5
- /**
6
- * Initialize client capabilities according to options and server capabilities
7
- *
8
- * @param opts options
9
- * @param info information
10
- */
11
- module.exports.init = function (opts, info) {
12
- let capabilities =
13
- Capabilities.IGNORE_SPACE |
14
- Capabilities.PROTOCOL_41 |
15
- Capabilities.TRANSACTIONS |
16
- Capabilities.SECURE_CONNECTION |
17
- Capabilities.MULTI_RESULTS |
18
- Capabilities.PS_MULTI_RESULTS |
19
- Capabilities.SESSION_TRACK |
20
- Capabilities.PLUGIN_AUTH_LENENC_CLIENT_DATA;
21
-
22
- if ((info.serverCapabilities & Capabilities.MYSQL) === BigInt(0)) {
23
- capabilities |= Capabilities.MARIADB_CLIENT_EXTENDED_TYPE_INFO;
24
- }
25
-
26
- if (info.serverCapabilities & Capabilities.PLUGIN_AUTH) {
27
- capabilities |= Capabilities.PLUGIN_AUTH;
28
- }
29
-
30
- if (opts.connectAttributes && info.serverCapabilities & Capabilities.CONNECT_ATTRS) {
31
- capabilities |= Capabilities.CONNECT_ATTRS;
32
- }
33
-
34
- if (opts.foundRows) {
35
- capabilities |= Capabilities.FOUND_ROWS;
36
- }
37
-
38
- if (opts.permitLocalInfile) {
39
- capabilities |= Capabilities.LOCAL_FILES;
40
- }
41
-
42
- if (opts.multipleStatements) {
43
- capabilities |= Capabilities.MULTI_STATEMENTS;
44
- }
45
-
46
- info.eofDeprecated = (info.serverCapabilities & Capabilities.DEPRECATE_EOF) > 0;
47
- if (info.eofDeprecated) {
48
- capabilities |= Capabilities.DEPRECATE_EOF;
49
- }
50
-
51
- if (opts.database && info.serverCapabilities & Capabilities.CONNECT_WITH_DB) {
52
- capabilities |= Capabilities.CONNECT_WITH_DB;
53
- }
54
-
55
- // use compression only if requested by client and supported by server
56
- if (opts.compress) {
57
- if (info.serverCapabilities & Capabilities.COMPRESS) {
58
- capabilities |= Capabilities.COMPRESS;
59
- } else {
60
- opts.compress = false;
61
- }
62
- }
63
-
64
- if (opts.bulk) {
65
- if (info.serverCapabilities & Capabilities.MARIADB_CLIENT_STMT_BULK_OPERATIONS) {
66
- capabilities |= Capabilities.MARIADB_CLIENT_STMT_BULK_OPERATIONS;
67
- }
68
- }
69
-
70
- if (opts.permitConnectionWhenExpired) {
71
- capabilities |= Capabilities.CAN_HANDLE_EXPIRED_PASSWORDS;
72
- }
73
- info.clientCapabilities = capabilities;
74
- };
@@ -1,126 +0,0 @@
1
- 'use strict';
2
-
3
- const Capabilities = require('../../const/capabilities');
4
- const Iconv = require('iconv-lite');
5
- const NativePasswordAuth = require('./auth/native-password-auth');
6
- const Ed25519PasswordAuth = require('./auth/ed25519-password-auth');
7
- const driverVersion = require('../../../package.json').version;
8
- const os = require('os');
9
-
10
- /**
11
- * Send Handshake response packet
12
- * see https://mariadb.com/kb/en/library/1-connecting-connecting/#handshake-response-packet
13
- *
14
- * @param cmd current handshake command
15
- * @param out output writer
16
- * @param opts connection options
17
- * @param pluginName plugin name
18
- * @param info connection information
19
- */
20
- module.exports.send = function send(cmd, out, opts, pluginName, info) {
21
- out.startPacket(cmd);
22
- info.defaultPluginName = pluginName;
23
- const pwd = Array.isArray(opts.password) ? opts.password[0] : opts.password;
24
- let authToken;
25
- let authPlugin;
26
- switch (pluginName) {
27
- case 'client_ed25519':
28
- authToken = Ed25519PasswordAuth.encryptPassword(pwd, info.seed);
29
- authPlugin = 'client_ed25519';
30
- break;
31
-
32
- case 'mysql_clear_password':
33
- authToken = Buffer.from(pwd);
34
- authPlugin = 'mysql_clear_password';
35
- break;
36
-
37
- default:
38
- authToken = NativePasswordAuth.encryptPassword(pwd, info.seed, 'sha1');
39
- authPlugin = 'mysql_native_password';
40
- break;
41
- }
42
- out.writeInt32(Number(info.clientCapabilities & BigInt(0xffffffff)));
43
- out.writeInt32(1024 * 1024 * 1024); // max packet size
44
- out.writeInt8(opts.collation.index);
45
- for (let i = 0; i < 19; i++) {
46
- out.writeInt8(0);
47
- }
48
-
49
- out.writeInt32(Number(info.clientCapabilities >> BigInt(32)));
50
-
51
- //null encoded user
52
- out.writeString(opts.user || '');
53
- out.writeInt8(0);
54
-
55
- if (info.serverCapabilities & Capabilities.PLUGIN_AUTH_LENENC_CLIENT_DATA) {
56
- out.writeLengthCoded(authToken.length);
57
- out.writeBuffer(authToken, 0, authToken.length);
58
- } else if (info.serverCapabilities & Capabilities.SECURE_CONNECTION) {
59
- out.writeInt8(authToken.length);
60
- out.writeBuffer(authToken, 0, authToken.length);
61
- } else {
62
- out.writeBuffer(authToken, 0, authToken.length);
63
- out.writeInt8(0);
64
- }
65
-
66
- if (info.clientCapabilities & Capabilities.CONNECT_WITH_DB) {
67
- out.writeString(opts.database);
68
- out.writeInt8(0);
69
- info.database = opts.database;
70
- }
71
-
72
- if (info.clientCapabilities & Capabilities.PLUGIN_AUTH) {
73
- out.writeString(authPlugin);
74
- out.writeInt8(0);
75
- }
76
-
77
- if (info.clientCapabilities & Capabilities.CONNECT_ATTRS) {
78
- out.writeInt8(0xfc);
79
- let initPos = out.pos; //save position, assuming connection attributes length will be less than 2 bytes length
80
- out.writeInt16(0);
81
-
82
- const encoding = opts.collation.charset;
83
-
84
- writeParam(out, '_client_name', encoding);
85
- writeParam(out, 'MariaDB connector/Node', encoding);
86
-
87
- writeParam(out, '_client_version', encoding);
88
- writeParam(out, driverVersion, encoding);
89
-
90
- const address = cmd.getSocket().address().address;
91
- if (address) {
92
- writeParam(out, '_server_host', encoding);
93
- writeParam(out, address, encoding);
94
- }
95
-
96
- writeParam(out, '_os', encoding);
97
- writeParam(out, process.platform, encoding);
98
-
99
- writeParam(out, '_client_host', encoding);
100
- writeParam(out, os.hostname(), encoding);
101
-
102
- writeParam(out, '_node_version', encoding);
103
- writeParam(out, process.versions.node, encoding);
104
-
105
- if (opts.connectAttributes !== true) {
106
- let attrNames = Object.keys(opts.connectAttributes);
107
- for (let k = 0; k < attrNames.length; ++k) {
108
- writeParam(out, attrNames[k], encoding);
109
- writeParam(out, opts.connectAttributes[attrNames[k]], encoding);
110
- }
111
- }
112
-
113
- //write end size
114
- out.writeInt16AtPos(initPos);
115
- }
116
-
117
- out.flushBuffer(true);
118
- };
119
-
120
- function writeParam(out, val, encoding) {
121
- let param = Buffer.isEncoding(encoding)
122
- ? Buffer.from(val, encoding)
123
- : Iconv.encode(val, encoding);
124
- out.writeLengthCoded(param.length);
125
- out.writeBuffer(param, 0, param.length);
126
- }