forked from bitpay/bitcore
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuser.ts
More file actions
61 lines (53 loc) · 1.41 KB
/
user.ts
File metadata and controls
61 lines (53 loc) · 1.41 KB
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
export interface IUser {
id: number | string;
version: string;
createdOn: number;
name: string;
dateOfBirth: Date;
address: string;
mobileNumber: number;
document: string;
verified: boolean;
publicSharingKey: string;
}
export class User {
id: number | string;
version: string;
createdOn: number;
name: string;
dateOfBirth: Date;
address: string;
mobileNumber: number;
document: string;
verified: boolean;
publicSharingKey: string;
static create(opts) {
opts = opts || {};
const x = new User();
x.version = '1.0.0';
x.createdOn = Math.floor(Date.now() / 1000);
x.id = opts.id;
x.name = opts.name;
x.dateOfBirth = opts.dateOfBirth;
x.address = opts.address;
x.mobileNumber = opts.mobileNumber;
x.document = opts.document;
x.verified = opts.verified;
x.publicSharingKey = opts.publicSharingKey;
return x;
}
static fromObj(obj) {
const x = new User();
x.version = obj.version;
x.createdOn = obj.createdOn;
x.id = obj.id;
x.name = obj.name;
x.dateOfBirth = obj.dateOfBirth;
x.address = obj.address;
x.mobileNumber = obj.mobileNumber;
x.document = obj.document;
x.verified = obj.verified;
x.publicSharingKey = obj.publicSharingKey;
return x;
}
}