-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphone_password.d.ts
104 lines (83 loc) · 2.72 KB
/
phone_password.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
type MethodCallback = (
error?:
| import('meteor/meteor').global_Error
| import('meteor/meteor').Meteor.Error
| import('meteor/meteor').Meteor.TypedError,
result?: any
) => void;
declare module 'meteor/meteor' {
namespace Meteor {
interface User {
phone: {
number: string;
verified: boolean;
};
services?: {
phone?: {
bcrypt?: string;
verify?: {
numOfRetries: number;
code: string;
phone: string;
lastRetry: Date;
};
};
};
}
function loginWithPhoneAndPassword(
user: { phone: string } | { id: string } | string,
password: string,
callback?: MethodCallback
): void;
}
}
type FieldSelector = { fields?: import('meteor/mongo').Mongo.FieldSpecifier | undefined };
declare module 'meteor/accounts-base' {
namespace Accounts {
const _options: {
bcryptRounds: number;
verificationWaitTime: number;
verificationMaxRetries: number;
verificationRetriesWaitTime: number;
verificationCodeLength: number;
adminPhoneNumbers: string;
phoneVerificationMasterCode: string;
};
let _checkPasswordUserFields: {
_id: number;
services: number;
};
function _addDefaultFieldSelector(options?: FieldSelector): FieldSelector;
function _bcryptRounds(): number;
function _checkPhonePasswordAsync(
user: import('meteor/meteor').Meteor.User,
password: string | HashPassword
): Promise<{ userId: string; error?: any }>;
function _handleError(message: string): never;
function _getLoginToken(id: string): string;
function _setLoginToken(
id: string,
connection: import('meteor/meteor').Meteor.Connection,
oldToken: string | null
): string;
function _loginMethod(
methodInvocation: any,
methodName: string,
methodArgs: any[],
type: string,
fn: () => void
): Promise<any>;
function _clearAllLoginTokens(userId: string): Promise<void>;
function insertUserDoc(
options: { phone: string; password?: string },
user: import('meteor/meteor').Meteor.User
): Promise<string>;
function requestPhoneVerification(phone: string, callback?: MethodCallback): void;
function verifyPhone(phone: string, code: string, newPassword: string, callback: MethodCallback): void;
function isPhoneVerified(): boolean;
function changePassword(oldPassword: string, newPassword: string, callback: MethodCallback): void;
function sendSms(phone: string, code: string): void;
function sendPhoneVerificationCodeAsync(userId: string, phone?: string): void;
}
}
type HashPassword = { digest: string; algorithm: string };