forked from accordproject/apap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotocol.cto
200 lines (171 loc) · 6.52 KB
/
protocol.cto
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
@description("Accord Project Agreement Protocol")
namespace [email protected]
import [email protected].{Property,ConceptDeclaration,Model} from https://models.accordproject.org/concerto/[email protected]
import [email protected] from https://models.accordproject.org/markdown/[email protected]
import [email protected].{Party} from https://models.accordproject.org/accordproject/[email protected]
scalar JSON extends String
scalar FullyQualifiedTypeName extends String
@description("Bytes and mime type for a blob of data, such as images, files, etc.")
concept Blob {
o String base64
o String mimeType // e.g. "image/jpeg", "application/pdf", "audio/mpeg", "video/mp4", etc...
}
@description("The text for a template")
concept Text {
o Document templateMark
}
@description("The concept declaration associated with a template")
concept TemplateModel {
o FullyQualifiedTypeName typeName // name of the type for this template
--> SharedModel sharedModel optional // reference to a shared model
o Model model optional // an inline model
}
@description("A shared data model")
@resource
concept SharedModel identified by modelId {
o String modelId
o Model model
}
@description("The type (language) of code")
enum CodeType {
o ES2015
o WASM_BYTES
}
@description("Code encoding scheme")
enum CodeEncodingType {
o PLAIN_TEXT
o BASE64
}
@description("Executable code")
concept Code {
o CodeType type
o CodeEncodingType encoding
o String value
}
@description("A function for a template")
concept Function identified by name {
o String name
o FullyQualifiedTypeName requestType
o FullyQualifiedTypeName responseType optional
o FullyQualifiedTypeName[] emittedTypes optional
o Code code
}
@description("The functions for a template")
concept Logic {
o FullyQualifiedTypeName stateType optional
o Function[] functions
}
@resource
@description("An Accord Project template")
concept Template identified by name {
o String name
o String author
o String displayName optional
o String version
o String description optional
o String license
o String[] keywords optional
o Blob logo optional
o TemplateModel templateModel
o Text text
o Logic logic optional
}
@description("A key/value pair")
concept KeyValue {
o String key
o String value
}
@description("Generic metadata comprised of key/value pairs")
concept Metadata {
o KeyValue[] values
}
@resource
@description("An Accord Project Agreement, an instance of a template")
concept Agreement identified by agreementId {
o String agreementId
o JSON data // Data for the agreement (an instance of the data for its template)
o JSON state optional // Runtime state of the agreement
--> Template template // Template for the the agreement
o AgreementParty[] agreementParties // Parties to the agreement
o Signature[] signatures // Signatures of the parties to the agreement
o AgreementStatusType agreementStatus // Current status of agreement
o HistoryEntry[] historyEntries // History of document state and details.
o Blob[] attachments // Pdfs, images, multimedia, etc. that form part of the agreement
o String[] references // uri/urls to external references relevant to agreement
o Metadata metadata // Additional data that may be relevant to the agreement
}
@description("A Party to an Agreement")
participant AgreementParty extends Party {
o String name
o Boolean signatory // Sometimes a party named on an agreement are not required to sign (e.g. beneficiary)
o String role optional // Role of AgreementParty (e.g. "Owner", "Company Director", etc..)
o String email optional
o String phone optional
o String company optional
o String network optional
o Address address optional
}
@description("An Address of an Agreement Party")
concept Address {
o String[] streetRoad
o String suburbTownCity optional
o String stateTerritoryRegion optional
o String postalCode optional
o String country optional
}
@description("A history entry for an Agreement")
transaction HistoryEntry {
o AgreementStatusType agreementStatus // Status at time of change
o JSON data // Data at time of change
o Metadata metadata // Additional data that may be relevant to the agreement at time of change
}
@description("A signature of an Agreement Party")
concept Signature {
o AgreementParty signatory // The Agreement Party signing the Agreement
o DateTime signedAt optional // When the signing occurred
o Metadata metadata // Geolocation data, IP address, etc.
o Blob[] signatureImage // Selfie, proof-of-id, sign-on-glass image
}
@description("Abstract conversion options")
abstract concept ConversionOptions {
}
@description("PDF conversion options")
concept PdfConversionOptions extends ConversionOptions {
o JSON styles optional
}
@description("Server feature identifiers")
enum FeatureType {
// note: crud operations on templates is required
o TEMPLATE_VERIFY_SIGNATURES // verify a signed template
o TEMPLATE_LOGIC // templates with logic
o TEMPLATE_STATEFUL // stateful templates
o AGREEMENT_MANAGE // crud operations on agreements
o AGREEMENT_TRIGGER // trigger agreements
o AGREEMENT_STATE // get the state of an agreement
o AGREEMENT_CONVERT_PDF // convert agreement to PDF
// o AGREEMENT_SIGNING
o SHARED_MODEL_MANAGE // manage shared models
}
@description("Server capabilities")
concept Capabilities {
o FeatureType[] features
}
@description("Trigger a function with a JSON payload")
concept TriggerRequest {
o String functionName
o JSON payload
}
@description("Response of triggering a function")
concept TriggerResponse {
o JSON result optional
o Boolean isError
o String errorMessage optional
o String errorDetails optional
}
@description("Runtime status of an agreement")
enum AgreementStatusType {
o DRAFT // No signatories have signed yet
o SIGNNG // Signed by some but not all signatories
o COMPLETED // Signing by all signatories completed
o SUPERSEDED // Superseded by subsequent agreement
}