Skip to content

Commit

Permalink
fix(jsonQuery): allowedIssuers with null & '*' (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmatos authored Feb 6, 2024
1 parent 6965be6 commit 2adee59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/storage/filters/jsonQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export const StandardJSONCredentialsQueryFilter = (query: ProofQuery): FilterQue
case 'claimId':
return acc.concat(new FilterQuery('id', comparatorOptions.$eq, queryValue));
case 'allowedIssuers': {
const [first] = queryValue || [];
if (first && first === '*') {
const queryValueParam = queryValue || ['*'];
if (queryValueParam.includes('*')) {
return acc;
}
return acc.concat(new FilterQuery('issuer', comparatorOptions.$in, queryValue));
Expand Down
12 changes: 12 additions & 0 deletions tests/credentials/credential-wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,18 @@ const credentialFlow = async (storage: IDataStorage) => {
}
},
expected: []
},
{
query: {
allowedIssuers: undefined,
},
expected: [cred1, cred2, cred3, cred4]
},
{
query: {
allowedIssuers: ['issuer1', '*'],
},
expected: [cred1, cred2, cred3, cred4]
}
];

Expand Down

0 comments on commit 2adee59

Please sign in to comment.