-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
114 lines (109 loc) · 2.89 KB
/
index.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
105
106
107
108
109
110
111
112
113
114
import { ICredentialRequestInput } from '@veramo/selective-disclosure';
/**
* Interface that captures the DAG architecture of JSON-LD documents.
*/
export interface ISchemaNode {
key: string;
name?: string;
url?: string;
children?: ISchemaNode[];
dataType?: DataType;
}
/**
* Data types that are used in the claim context.
*/
export type DataType = 'NUMBER' | 'DATE' | 'BOOLEAN' | 'TEXT';
/**
* Schemas that create a common context among different parties.
* Used to quickly bootstrap verifiable credentials, presentations and selective disclosure requests.
* TODO: add additional schemas from schema.org and others.
*/
export const schemas: [ISchemaNode] = [
{
key: 'https://schema.org',
children: [
{
key: 'Person',
url: 'https://schema.org/Person',
children: [
{
key: 'birthDate',
url: 'https://schema.org/birthDate',
dataType: 'DATE',
},
{
key: 'PostalAddress',
url: 'https://schema.org/Person',
children: [
{
key: 'postalCode',
url: 'https://schema.org/postalCode',
dataType: 'TEXT',
},
],
},
],
},
{
key: 'Ticket',
url: 'https://schema.org/Ticket',
children: [
{
key: 'dateIssued',
url: 'https://schema.org/dateIssued',
dataType: 'DATE',
},
{
key: 'ticketNumber',
url: 'https://schema.org/ticketNumber',
dataType: 'TEXT',
},
{
key: 'totalPrice',
url: 'https://schema.org/totalPrice',
dataType: 'NUMBER',
},
],
},
{
key: 'VoteAction',
url: 'https://schema.org/VoteAction',
children: [
{
key: 'name',
url: 'https://schema.org/name',
dataType: 'TEXT',
},
],
},
{
key: 'Place',
url: 'https://schema.org/Place',
children: [
{
key: 'publicAccess',
url: 'https://schema.org/publicAccess',
dataType: 'BOOLEAN',
},
],
},
],
},
];
/**
* Interface that captures a constraint configuration.
* The `js` string is a JS expression that can be evaluated with `eval()`.
*/
export interface IConstraint {
js: string;
desc: string;
}
/**
* Interface that captures a combination of a claim and a constraint.
* The claim is used to create selective disclouse requets in the authentication process. (ex. reveal your brithDate)
* The constraint is used to evaluate the value that is revealed in the authentication process. (ex. is your birthDay before some date)
*/
export interface IClaimConstraintConfig {
claim: ICredentialRequestInput;
constraint: IConstraint;
}