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

feat: revocation improvement #1472

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion app/src/request-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
return { ...restriction }
})

const now = () => Math.floor(new Date().getTime() / 1000)

const proofRequestTemplates: Array<ProofRequestTemplate> = [
{
id: 'BC:5:PracticingLawyerAndPhoto:0.0.1:indy',
Expand All @@ -66,7 +68,11 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
schema: personSchema,
requestedAttributes: [
{ names: ['given_names', 'family_name', 'picture'], restrictions: verifiedPersonRestrictions },
{
names: ['given_names', 'family_name', 'picture'],
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
Copy link
Contributor

@bryce-mcmath bryce-mcmath Sep 18, 2023

Choose a reason for hiding this comment

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

If a user has first opened the wallet and then afterwards a credential is revoked, will it still be accepted because it's after the now()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now() gets called whenever the template is fetched, so any time the QR code is refreshed the time will be updated. I've tested the changes and it seems to be working as expected, if a credential is revoked before receiving a proof then it will not be valid. I've added the functionality so support this in my bifold PR.

},
],
},
{
Expand All @@ -75,6 +81,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
names: ['Given Name', 'Surname', 'Member Status', 'Member Status Code'],
restrictions: memberCardCodeRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -95,10 +102,12 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
name: 'given_names',
restrictions: useDevRestrictions ? personRestrictions : verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
{
name: 'family_name',
restrictions: useDevRestrictions ? personRestrictions : verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -119,6 +128,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
names: ['given_names', 'family_name'],
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
requestedPredicates: [
Expand All @@ -127,6 +137,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
predicateType: '<=',
predicateValue: calculatePreviousYear(19),
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -149,6 +160,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
predicateType: '<=',
predicateValue: calculatePreviousYear(19),
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -169,6 +181,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
names: ['Given Name', 'Surname', 'PPID', 'Member Status'],
restrictions: memberCardRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -189,6 +202,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
names: ['given_names', 'family_name'],
restrictions: useDevRestrictions ? personRestrictions : verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -198,6 +212,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
names: ['Given Name', 'Surname', 'PPID', 'Member Status'],
restrictions: memberCardRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -221,6 +236,7 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
predicateValue: calculatePreviousYear(19),
parameterizable: true,
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -242,14 +258,17 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
name: 'given_names',
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
{
name: 'family_name',
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
{
name: 'picture',
restrictions: verifiedPersonRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -271,10 +290,12 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
name: 'given_names',
restrictions: openvpRestrictions,
nonRevoked: { to: now() },
},
{
name: 'family_name',
restrictions: openvpRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand All @@ -296,14 +317,17 @@ export const useProofRequestTemplates = (useDevRestrictions: boolean) => {
{
name: 'given_names',
restrictions: openvpRestrictions,
nonRevoked: { to: now() },
},
{
name: 'family_name',
restrictions: openvpRestrictions,
nonRevoked: { to: now() },
},
{
name: 'birthdate',
restrictions: openvpRestrictions,
nonRevoked: { to: now() },
},
],
},
Expand Down
Loading