@riocrypto/common-server 1.0.1337 → 1.0.1339
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.
|
@@ -11,6 +11,8 @@ declare class ClusterClient {
|
|
|
11
11
|
limit: number;
|
|
12
12
|
used: number;
|
|
13
13
|
}>;
|
|
14
|
+
sendSMSCode(phoneNumber: string): Promise<void>;
|
|
15
|
+
verifySMSCode(phoneNumber: string, code: string): Promise<void>;
|
|
14
16
|
}
|
|
15
17
|
export declare const buildClusterClient: () => Promise<ClusterClient>;
|
|
16
18
|
export {};
|
|
@@ -107,6 +107,24 @@ class ClusterClient {
|
|
|
107
107
|
return response.data;
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
+
sendSMSCode(phoneNumber) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
yield this.axios.post(`${this.baseUrl}/api/auth/send-code`, { phoneNumber }, {
|
|
113
|
+
headers: {
|
|
114
|
+
"x-cluster-api-key": this.clusterApiKey,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
verifySMSCode(phoneNumber, code) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
yield this.axios.post(`${this.baseUrl}/api/auth/verify-code`, { phoneNumber, code }, {
|
|
122
|
+
headers: {
|
|
123
|
+
"x-cluster-api-key": this.clusterApiKey,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
110
128
|
}
|
|
111
129
|
const buildClusterClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
130
|
// Retrieve secrets asynchronously
|
package/build/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export * from "./models/bitso-mxn-withdrawal";
|
|
|
40
40
|
export * from "./models/circle-address-book-recipient";
|
|
41
41
|
export * from "./models/circle-payout";
|
|
42
42
|
export * from "./models/market-data";
|
|
43
|
+
export * from "./models/telegram-session";
|
|
43
44
|
export * from "./clients/bitstamp-client";
|
|
44
45
|
export * from "./clients/ccxt-client";
|
|
45
46
|
export * from "./clients/kushki-client";
|
package/build/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __exportStar(require("./models/bitso-mxn-withdrawal"), exports);
|
|
|
56
56
|
__exportStar(require("./models/circle-address-book-recipient"), exports);
|
|
57
57
|
__exportStar(require("./models/circle-payout"), exports);
|
|
58
58
|
__exportStar(require("./models/market-data"), exports);
|
|
59
|
+
__exportStar(require("./models/telegram-session"), exports);
|
|
59
60
|
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
60
61
|
__exportStar(require("./clients/ccxt-client"), exports);
|
|
61
62
|
__exportStar(require("./clients/kushki-client"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
interface TelegramSessionAttrs {
|
|
3
|
+
createdAt: Date;
|
|
4
|
+
authId: string;
|
|
5
|
+
telgramUsername: string;
|
|
6
|
+
telgramChatId: string;
|
|
7
|
+
isVerified: boolean;
|
|
8
|
+
state: string;
|
|
9
|
+
}
|
|
10
|
+
interface TelegramSessionDoc extends mongoose.Document {
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
authId: string;
|
|
13
|
+
telgramUsername: string;
|
|
14
|
+
telgramChatId: string;
|
|
15
|
+
isVerified: boolean;
|
|
16
|
+
state: string;
|
|
17
|
+
}
|
|
18
|
+
interface TelegramSessionModel extends mongoose.Model<TelegramSessionDoc> {
|
|
19
|
+
build(attrs: TelegramSessionAttrs): TelegramSessionDoc;
|
|
20
|
+
}
|
|
21
|
+
declare const buildTelegramSession: (mongoose: typeof mongoose) => TelegramSessionModel;
|
|
22
|
+
export { buildTelegramSession, TelegramSessionDoc };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildTelegramSession = void 0;
|
|
4
|
+
const buildTelegramSession = (mongoose) => {
|
|
5
|
+
// if model is already defined, return it
|
|
6
|
+
if (mongoose.models.TelegramSession) {
|
|
7
|
+
return mongoose.model("TelegramSession");
|
|
8
|
+
}
|
|
9
|
+
const TelegramSessionSchema = new mongoose.Schema({
|
|
10
|
+
createdAt: {
|
|
11
|
+
type: Date,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
authId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
telgramUsername: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
telgramChatId: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
isVerified: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
state: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
}, {
|
|
35
|
+
toJSON: {
|
|
36
|
+
transform(doc, ret) {
|
|
37
|
+
ret.id = ret._id;
|
|
38
|
+
delete ret._id;
|
|
39
|
+
delete ret.__v;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
TelegramSessionSchema.statics.build = (attrs) => {
|
|
44
|
+
return new TelegramSession(attrs);
|
|
45
|
+
};
|
|
46
|
+
const TelegramSession = mongoose.model("TelegramSession", TelegramSessionSchema);
|
|
47
|
+
return TelegramSession;
|
|
48
|
+
};
|
|
49
|
+
exports.buildTelegramSession = buildTelegramSession;
|