Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add revocation to js issuer and disclose functions #33

Merged
merged 12 commits into from
May 10, 2021
Merged

Conversation

AshHalliwell
Copy link
Contributor

No description provided.

@@ -26,7 +28,7 @@ function irmaDiscloseOrSign(attributes, header = 'Disclosing attribute with', la
});
}

function irmaIssueCredential(credential, attributes, header = 'Issuing credential with', disclosePayload = null) {
function irmaIssueCredential(credential, attributes, header = 'Issuing credential with', disclosePayload = null, revocationKey = None) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revocationKey = null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I think would be better to have a specific method called irmaIssueRevocableCredential instead, as this could be more meaningful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I've separated the irmaIssueRevocableCredential and irmaIssueCredential functions, but IrmaDiscloseOrSign is still handling both the original disclosure and disclosure with revocation. Does that sound sensible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what part of the front end needs to be changed to use this? Or should we hold off making those changes until we know revocation is working?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that disclosure or sign seems to fit better into a single function.

@AshHalliwell AshHalliwell marked this pull request as ready for review April 16, 2021 03:42
Comment on lines 55 to 69
let validity = {};
if (attributes.validity) {
validity = {validity: attributes.validity};
delete attributes.validity;
}
const request = {
'@context': 'https://irma.app/ld/request/issuance/v2',
'credentials': [{
credential: credential,
attributes: attributes,
revocationKey: revocationKey,
...validity,
}],
'disclose': disclosePayload,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a part we can extract from both functions into a third function to create the request based on the arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also fold it back into a single function, giving it the same treatment as validity? I think that might actually be tidier than two functions, if revocationKey can be passed in attributes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can do that.

@rafaelbernard
Copy link
Contributor

Also what part of the front end needs to be changed to use this? Or should we hold off making those changes until we know revocation is working?

No need to apply right now. Let´s wait on Ehsan´s research to revocation being fully working before applying to the UI, but we need to be sure that is backwards compatible with the current usage of the UI. So, please, just go through the flow to be sure everything remains working and we will be fine.

@@ -223,6 +223,7 @@
},
saveIdCard: function () {
console.log('saveIdCard');
this.idCardToIssue['revocationKey'] = `${luxon.DateTime.now().ts}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not be better to use as a key something like version1 or pocSS or something that is really a key that is repeatable? I think we do a better use of the key if we identify it as some "group" or "cluster" of the given credential issued by this key.

That use above is more suited to the issued attribute.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so! The key should be something unique, otherwise, you won't be able to revoke it! as current irma cli subcommand doesn't accept issued! So, for example, if issue all your credential with the same key, when you want to revoke one of them, you would revoke all of them!
BTW, issued is generated by irma server!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to do more tests about that, but I am not sure that it must always have a totally unique value as we have alternatives. Document says:

For example, the following RevocationRequest instructs the server to revoke the irma-demo.MijnOverheid.root instance to which it previously assigned bsn-12345 as revocationKey during issuance, and which was issued at Unix nano timestamp 1583765731750425000. If issued is not specified, all previously issued credentials with matching revocationKey are revoked.

I can see that is expected to have revocationKey to revoke a set of credentials with the same key and a more particular credential using the key and issued properties. If we use the key as a group, we can, for instance, make demos showing that we can revoke the IDNZ card from 2021 if we create a key name v2021. And, at the same time, we can show that we can revoke a specific IDNZ card from a member that decided to cancel his card using the key and the issued property that we have stored on database.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read my comment again!!

as current irma cli subcommand doesn't accept issued!

So if issue credential with non-unique keys, we won't be able to revoke them individually, at least for now! Does it make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we would rely on irma-front-end, right? We have an endpoint that accepts both revocationKey and issued.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That endpoint doesn't work either! I've already mentioned that here:https://internetnz.atlassian.net/wiki/spaces/RCENG/pages/1011581103/IRMA+-+Feature+-+Revocation#revoking-credential
The error is known to IRMA and they are working on that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, so we are here considering not a full implementation of revocation, but a very limited revocation structure aiming to work with the only parts that are working now. If that is the case, that is fine, because we can work of what we have, despite its best usage. I would add a comment about the usage we "would like to but cannot use" and, maybe, just use this.idCardToIssue.revocationKey = this.idCardToIssue.number as this is already unique enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that's been the plan since we knew what parts of it are working and what parts are not! But I would say the overall feature is not production-ready yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I see you. No problem. As the title says add revocation and we did not necessarily mention the limitations on the implementation, I wanted to be sure about what exactly we are implementing (and what we are not).

Symptoms of working with something at the edge. :-D

@ehsan-fj ehsan-fj merged commit 4eaf258 into master May 10, 2021
@ehsan-fj ehsan-fj deleted the revocation branch May 10, 2021 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants