-
Notifications
You must be signed in to change notification settings - Fork 182
/
ProofPredicateInfo.ts
44 lines (36 loc) · 1.2 KB
/
ProofPredicateInfo.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
import { Expose, Type } from 'class-transformer'
import { IsArray, IsEnum, IsInstance, IsInt, IsOptional, IsString, ValidateNested } from 'class-validator'
import { RevocationInterval } from '../../credentials'
import { AttributeFilter } from './AttributeFilter'
import { PredicateType } from './PredicateType'
export class ProofPredicateInfo {
public constructor(options: ProofPredicateInfo) {
if (options) {
this.name = options.name
this.nonRevoked = options.nonRevoked
this.restrictions = options.restrictions
this.predicateType = options.predicateType
this.predicateValue = options.predicateValue
}
}
@IsString()
public name!: string
@Expose({ name: 'p_type' })
@IsEnum(PredicateType)
public predicateType!: PredicateType
@Expose({ name: 'p_value' })
@IsInt()
public predicateValue!: number
@Expose({ name: 'non_revoked' })
@ValidateNested()
@Type(() => RevocationInterval)
@IsOptional()
@IsInstance(RevocationInterval)
public nonRevoked?: RevocationInterval
@ValidateNested({ each: true })
@Type(() => AttributeFilter)
@IsOptional()
@IsInstance(AttributeFilter, { each: true })
@IsArray()
public restrictions?: AttributeFilter[]
}