Skip to content

Commit

Permalink
Lint fix and minor refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Apr 11, 2024
1 parent 9e3a646 commit a8de837
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/utils/revocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,23 @@ export function getCredentialStatus(expanded) {
return status;
}

const ldTypeGen = (typ) => [typ, `${LD_SEC_TERM}${typ}`, `/${typ}`];
const REV_REG_LD_TYPES = [RevRegType].flatMap(ldTypeGen);
const ACCUMULATOR_LD_TYPES = [VB_ACCUMULATOR_22, KB_UNI_ACCUMULATOR_24].flatMap(ldTypeGen);

/**
* Returns `true` if supplied status is a registry revocation status.
* @param status
* @returns {boolean}
*/
export const isRegistryRevocationStatus = ({ [credentialTypeField]: type }) => type.includes(RevRegType) || type.includes(`${LD_SEC_TERM}${RevRegType}`) || type.includes(`/${RevRegType}`);
export const isRegistryRevocationStatus = ({ [credentialTypeField]: type }) => REV_REG_LD_TYPES.some((t) => type.includes(t));

/**
* Returns `true` if supplied status is a accumulator revocation status.
* @param status
* @returns {boolean}
*/
export const isAccumulatorRevocationStatus = ({ [credentialTypeField]: type }) => type.includes(VB_ACCUMULATOR_22)
|| type.includes(`${LD_SEC_TERM}${VB_ACCUMULATOR_22}`)
|| type.includes(`/${VB_ACCUMULATOR_22}`)
|| type.includes(KB_UNI_ACCUMULATOR_24)
|| type.includes(`${LD_SEC_TERM}${KB_UNI_ACCUMULATOR_24}`)
|| type.includes(`/${KB_UNI_ACCUMULATOR_24}`);
export const isAccumulatorRevocationStatus = ({ [credentialTypeField]: type }) => ACCUMULATOR_LD_TYPES.some((t) => type.includes(t));

/**
* Checks if a credential status has a registry revocation.
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/resolvers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ describe('Resolvers', () => {
statusListCred = await StatusList2021Credential.create(
ownerKey,
statusListCredId,
{},
);await expect(
{},
); await expect(
dock.statusListCredential.createStatusListCredential(
statusListCredId,
statusListCred,
Expand Down

0 comments on commit a8de837

Please sign in to comment.