-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenPassportVerifierReport.ts
60 lines (52 loc) · 1.21 KB
/
OpenPassportVerifierReport.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
import { hexToUUID } from './conversion'
export class OpenPassportVerifierReport {
scope: boolean = true
merkle_root: boolean = true
attestation_id: boolean = true
current_date: boolean = true
issuing_state: boolean = true
name: boolean = true
passport_number: boolean = true
nationality: boolean = true
date_of_birth: boolean = true
gender: boolean = true
expiry_date: boolean = true
older_than: boolean = true
owner_of: boolean = true
proof: boolean = true
dsc: boolean = true
valid: boolean = true
public user_identifier: string | undefined
public nullifier: string | undefined
constructor() {}
exposeAttribute(
attribute: keyof OpenPassportVerifierReport,
value: any = '',
expectedValue: any = '',
) {
console.error(
"%c attributes don't match",
'color: red',
attribute,
'value:',
value,
'expectedValue:',
expectedValue,
)
;(this[attribute] as boolean) = false
this.valid = false
}
toString() {
return JSON.stringify(this)
}
getUUID() {
// @ts-ignore
return hexToUUID(this.user_identifier)
}
getHexUUID() {
return this.user_identifier
}
getNullifier() {
return this.nullifier
}
}