-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
credential_exchange_record_v2.go
134 lines (119 loc) · 5.7 KB
/
credential_exchange_record_v2.go
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
package acapy
// This thing is so big that it deserves it's own file
type CredentialExchangeRecordV2 struct {
CredentialExchangeID string `json:"cred_ex_id"`
CredentialExchangeIDStored string `json:"cred_id_stored"`
ConnectionID string `json:"conn_id"`
ThreadID string `json:"thread_id"`
ParentThreadID string `json:"parent_thread_id"`
State string `json:"state"`
CredentialPreview CredentialPreviewV2 `json:"cred_preview"`
CredentialOffer CredentialOfferV2 `json:"cred_offer"`
CredentialProposal CredentialProposalV2 `json:"cred_proposal"`
CredentialRequest CredentialRequestV2 `json:"cred_request"`
CredentialRequestMetadata CredentialRequestMetadataV2 `json:"cred_request_metadata"`
CredentialIssue CredentialIssue `json:"cred_issue"`
Role string `json:"role"`
Initiator string `json:"initiator"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ErrorMessage string `json:"error_msg"`
Trace bool `json:"trace"`
AutoOffer bool `json:"auto_offer"`
AutoIssue bool `json:"auto_issue"`
AutoRemove bool `json:"auto_remove"`
}
type CredentialExchangeRecordResult struct {
CredentialExchangeRecord CredentialExchangeRecordV2 `json:"cred_ex_record"`
DIF CredentialExchangeDIF `json:"dif"`
Indy CredentialExchangeIndy `json:"indy"`
}
func NewCredentialPreviewV2(attributes []CredentialPreviewAttributeV2) CredentialPreviewV2 {
return CredentialPreviewV2{
Type: "issue-credential/2.0/credential-preview",
Attributes: attributes,
}
}
type CredentialPreviewV2 struct {
Type string `json:"@type"` // did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/2.0/credential-preview
Attributes []CredentialPreviewAttributeV2 `json:"attributes"`
}
type CredentialPreviewAttributeV2 struct {
Name string `json:"name"`
MimeType string `json:"mime-type"` // optional
Value string `json:"value"`
}
type CredentialOfferV2 struct {
Type string `json:"@type"` // did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/2.0/offer-credential
ID string `json:"@id"`
Thread Thread `json:"~thread"`
CredentialPreview CredentialPreviewV2 `json:"credential_preview"`
OffersAttach []AttachDecorator `json:"offers~attach"`
Formats []Format `json:"formats"`
}
type AttachDecorator struct {
ID string `json:"@id"`
MimeType string `json:"mime-type"`
Data struct {
Base64 string `json:"base64"`
} `json:"data"`
}
type CredentialProposalV2 struct {
ID string `json:"@id"`
Type string `json:"@type"` // did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/2.0/propose-credential
FiltersAttach []FilterAttach `json:"filters~attach"`
Comment string `json:"comment"`
CredentialPreview CredentialPreviewV2 `json:"credential_proposal"`
Formats []Format `json:"formats"`
}
type Format struct {
AttachID string `json:"attach_id"` // dif or indy
Format string `json:"format"` // dif/credential-manifest@v1.0 or hlindy-zkp-v1.0
}
type FilterAttach struct {
ID string `json:"@id"` // dif or indy
MimeType string `json:"mime-type"`
Data struct {
Base64 string `json:"base64"`
} `json:"data"`
}
type CredentialRequestV2 struct {
Type string `json:"@type"` // did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/2.0/request-credential
ID string `json:"@id"`
Thread Thread `json:"~thread"`
RequestsAttach []AttachDecorator `json:"requests~attach"`
Formats []Format `json:"formats"`
}
type CredentialRequestMetadataV2 struct {
Description string `json:"description"`
}
type CredentialIssue struct {
Type string `json:"@type"` // did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/2.0/issue-credential
ID string `json:"@id"`
CredentialsAttach []AttachDecorator `json:"credentials~attach"`
Formats []Format `json:"formats"`
Comment string `json:"comment"`
}
type CredentialExchangeDIF struct {
CredentialExchangeDIFID string `json:"cred_ex_dif_id"`
CreatedAt string `json:"created_at"`
CredentialExchangeID string `json:"cred_ex_id"`
Item string `json:"item"`
State string `json:"state"`
UpdatedAt string `json:"updated_at"`
}
type CredentialExchangeIndy struct {
CredentialExchangeIndyID string `json:"cred_ex_indy_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CredentialExchangeID string `json:"cred_ex_id"`
RevocationRegistryID string `json:"rev_reg_id"`
CredentialRequestMetadata struct {
MasterSecretBlindingData struct {
VPrime string `json:"v_prime"`
VrPrime interface{} `json:"vr_prime"`
} `json:"master_secret_blinding_data"`
Nonce string `json:"nonce"`
MasterSecretName string `json:"master_secret_name"`
} `json:"cred_request_metadata"`
}