Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 27b6ecf

Browse files
authored
Merge pull request #290 from frostyfrog/feature/revocation-support
Feature/revocation support
2 parents 61aa95d + e0fbb5f commit 27b6ecf

File tree

5 files changed

+91
-3
lines changed

5 files changed

+91
-3
lines changed

src/renderer/components/CredentialIssuance/CredDefList.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
</el-option>
6464
</el-select>
6565
</el-form-item>
66+
<el-form-item label="Revocable?" :label-width="formLabelWidth">
67+
<el-checkbox id="support_revocation" v-model="createForm.support_revocation" />
68+
</el-form-item>
69+
<el-form-item label="Revocation Registry Size" :label-width="formLabelWidth">
70+
<el-input-number id="revocation_registry_size" v-model="createForm.revocation_registry_size" :disabled="!createForm.support_revocation" min=4 max=32769 />
71+
</el-form-item>
6672
</el-form>
6773
<span slot="footer" class="dialog-footer">
6874
<el-button @click="deactivate()">Cancel</el-button>
@@ -111,10 +117,12 @@ export default {
111117
expanded_items:[],
112118
createFormActive: false,
113119
createForm: {
114-
schema_id: ''
120+
schema_id: '',
121+
support_revocation: false,
122+
revocation_registry_size: 100
115123
},
116124
retrieve_cred_def_id: '',
117-
formLabelWidth: '100px'
125+
formLabelWidth: '95px'
118126
}
119127
},
120128
created: async function() {
@@ -126,10 +134,16 @@ export default {
126134
let query_msg = {
127135
"@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-credential-definitions/0.1/send-credential-definition",
128136
"schema_id": this.createForm.schema_id,
137+
"support_revocation": this.createForm.support_revocation,
129138
};
139+
if (this.createForm.support_revocation) {
140+
query_msg["revocation_registry_size"] = this.createForm.revocation_registry_size;
141+
}
130142
this.send_message(query_msg);
131143
this.createFormActive = false;
132144
this.createForm.schema_id = '';
145+
this.createForm.support_revocation = false;
146+
this.createForm.revocation_registry_size = 100;
133147
},
134148
get_cred_def: function() {
135149
let query_msg = {
@@ -147,6 +161,8 @@ export default {
147161
deactivate: function() {
148162
this.createFormActive = false;
149163
this.createForm.schema_id = '';
164+
this.createForm.support_revocation = false;
165+
this.createForm.revocation_registry_size = 100;
150166
},
151167
}
152168
}

src/renderer/components/CredentialIssuance/IssuedCredList.vue

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@
3939
</vue-json-pretty>
4040
</div>
4141
<el-button v-on:click="collapse_expanded(issued_credential)">^</el-button>
42+
<el-button v-on:click="activateRevokeForm(issued_credential)">Revoke</el-button>
4243
</el-row>
4344
</el-collapse-item>
4445
</ul>
4546
</el-collapse>
47+
<el-dialog title="Revoke Credential" :visible.sync="revokeFormActive" @close="deActivateRevokeForm()">
48+
<el-descriptions :title.sync="revokeForm.title" border=true column=1>
49+
<el-descriptions-item label="Exchange ID">{{revokeForm.credential_exchange_id}}</el-descriptions-item>
50+
<el-descriptions-item label="Creation Date">{{revokeForm.created_at}}</el-descriptions-item>
51+
</el-descriptions>
52+
<span slot="footer" class="dialog-footer">
53+
<el-button @click="deActivateRevokeForm()">Cancel</el-button>
54+
<el-button :disabled="!revokeForm.credential_exchange_id" type="primary" @click="revoke">Confirm</el-button>
55+
</span>
56+
</el-dialog>
4657
<el-dialog title="Issue Credential" :visible.sync="issueFormActive" @close="deActivateForm()">
4758
<el-form :model="issueForm">
4859
<el-form-item label="Connection:" :label-width="formLabelWidth">
@@ -132,8 +143,15 @@ export default {
132143
comment: '',
133144
attributes: []
134145
},
146+
revokeFormActive: false,
147+
revokeForm: {
148+
title: '',
149+
credential_exchange_id: null,
150+
created_at: null
151+
},
135152
retrieve_cred_def_id: '',
136-
formLabelWidth: '200px'
153+
formLabelWidth: '200px',
154+
revokeFormLabelWidth: '100px'
137155
}
138156
},
139157
computed: {
@@ -154,6 +172,22 @@ export default {
154172
item => item != creddef.credential_exchange_id
155173
);
156174
},
175+
activateRevokeForm: function(cred) {
176+
this.revokeFormActive = true;
177+
this.revokeForm = {
178+
title: `Are you sure that you want to revoke "${this.credential_title(cred)}"?`,
179+
credential_exchange_id: cred.credential_exchange_id,
180+
created_at: cred.created_at
181+
}
182+
},
183+
deActivateRevokeForm: function() {
184+
this.revokeFormActive = false;
185+
this.revokeForm = {
186+
title: '',
187+
credential_exchange_id: null,
188+
created_at: null
189+
}
190+
},
157191
deActivateForm: function() {
158192
this.issueFormActive = false;
159193
this.issueForm = {
@@ -163,6 +197,19 @@ export default {
163197
attributes: []
164198
};
165199
},
200+
revoke: function() {
201+
let values = {
202+
credential_exchange_id: this.revokeForm.credential_exchange_id,
203+
}
204+
this.revokeForm = {
205+
title: '',
206+
credential_exchange_id: null,
207+
created_at: null
208+
}
209+
210+
this.$emit('revoke', values);
211+
this.revokeFormActive = false;
212+
},
166213
issue: function() {
167214
let values = {
168215
connection_id: this.issueForm.connection_id,

src/renderer/components/CredentialIssuance/index.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
v-bind:connections="active_connections"
2020
v-bind:cred_defs="issuer_cred_defs"
2121
@issue="issue_credential"
22+
@revoke="revoke_credential"
2223
@issue-cred-refresh="fetch_issued_credentials">
2324
</issued-cred-list>
2425
</el-row>
@@ -163,6 +164,13 @@ export default {
163164
};
164165
this.send_message(query_msg);
165166
},
167+
revoke_credential: function(form) {
168+
let query_msg = {
169+
"@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-issuer/0.1/revoke-credential",
170+
"credential_exchange_id": form.credential_exchange_id,
171+
};
172+
this.send_message(query_msg);
173+
},
166174
}
167175
}
168176
</script>

src/renderer/components/Verifications/Verification.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
type="textarea"></el-input>
7575
</el-form-item>
7676

77+
<el-form-item label="Exclude Revoked:">
78+
<el-checkbox v-model="requestForm.non_revoked" />
79+
</el-form-item>
80+
7781
<!-- Dynamic Attributes -->
7882
<el-form-item
7983
v-for="(attribute, index) in requestForm.attributes"
@@ -221,6 +225,7 @@ export default {
221225
connection_id: '', // Who
222226
comment: '', // Optional comment
223227
name: '',
228+
non_revoked: false,
224229
attributes: [
225230
// Key: (can be whatever) property name,
226231
// {
@@ -309,6 +314,9 @@ export default {
309314
predicates: this.requestForm.predicates
310315
}
311316
this.requestFormActive = false;
317+
if (this.requestForm.non_revoked) {
318+
values.non_revoked = true;
319+
}
312320
313321
this.requestForm.connection_id = '';
314322
this.requestForm.name = '';

src/renderer/components/Verifications/index.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ export default {
9696
if (attribute.restrictions.cred_def) {
9797
transmuted_attr.restrictions[0].cred_def_id = attribute.restrictions.cred_def.cred_def_id;
9898
}
99+
if (attribute.restrictions.trusted_issuer) {
100+
transmuted_attr.restrictions[0].issuer_did = attribute.restrictions.trusted_issuer;
101+
}
99102
acc[attribute.name] = transmuted_attr;
100103
return acc;
101104
}, {}),
@@ -112,11 +115,17 @@ export default {
112115
if (predicate.restrictions.cred_def) {
113116
transmuted_pred.restrictions[0].cred_def_id = predicate.restrictions.cred_def.cred_def_id;
114117
}
118+
if (predicate.restrictions.trusted_issuer) {
119+
transmuted_pred.restrictions[0].issuer_did = predicate.restrictions.trusted_issuer;
120+
}
115121
acc[predicate.name] = transmuted_pred;
116122
return acc;
117123
}, {}),
118124
},
119125
};
126+
if (form.non_revoked) {
127+
query_msg.proof_request.non_revoked = {"to": new Date().getTime()};
128+
}
120129
this.send_message(query_msg);
121130
},
122131
},

0 commit comments

Comments
 (0)