Skip to content

Commit

Permalink
converts statusListIndex from number to string
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Oct 25, 2023
1 parent ad0b934 commit dd82272
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ console.log(credentialWithStatus);
id: 'https://university-xyz.github.io/credential-status/V27UAUYPNR#1',
type: 'StatusList2021Entry',
statusPurpose: 'revocation',
statusListIndex: 1,
statusListIndex: '1',
statusListCredential: 'https://university-xyz.github.io/credential-status/V27UAUYPNR'
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/credential-status-manager-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export abstract class BaseCredentialStatusManager {
id: credentialStatusId,
type: CREDENTIAL_STATUS_TYPE,
statusPurpose,
statusListIndex: credentialStatusIndex,
statusListIndex: credentialStatusIndex.toString(),
statusListCredential: statusCredentialUrl
};

Expand Down Expand Up @@ -243,7 +243,7 @@ export abstract class BaseCredentialStatusManager {
id: credentialStatusId,
type: CREDENTIAL_STATUS_TYPE,
statusPurpose,
statusListIndex: credentialStatusIndex,
statusListIndex: credentialStatusIndex.toString(),
statusListCredential: statusCredentialUrl
};

Expand Down Expand Up @@ -331,7 +331,7 @@ export abstract class BaseCredentialStatusManager {
// extract relevant data from credential status
const {
statusListCredential: statusCredentialUrl,
statusListIndex: credentialStatusIndex
statusListIndex
} = credentialWithStatus.credentialStatus;

// retrieve status credential ID from status credential URL
Expand All @@ -346,7 +346,7 @@ export abstract class BaseCredentialStatusManager {
credentialState: CredentialState.Active,
verificationMethod,
statusCredentialId,
credentialStatusIndex
credentialStatusIndex: parseInt(statusListIndex)
};
eventLog.push(statusLogEntry);

Expand Down
2 changes: 1 addition & 1 deletion test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function checkLocalCredentialStatus(
expect(credentialWithStatus.credentialStatus).to.have.property('statusListCredential');
expect(credentialWithStatus.credentialStatus.type).to.equal('StatusList2021Entry');
expect(credentialWithStatus.credentialStatus.statusPurpose).to.equal('revocation');
expect(credentialWithStatus.credentialStatus.statusListIndex).to.equal(credentialStatusIndex);
expect(credentialWithStatus.credentialStatus.statusListIndex).to.equal(credentialStatusIndex.toString());
expect(credentialWithStatus.credentialStatus.id.startsWith(statusCredentialUrl)).to.be.true;
expect(credentialWithStatus.credentialStatus.statusListCredential.startsWith(statusCredentialUrl)).to.be.true;
}
Expand Down

0 comments on commit dd82272

Please sign in to comment.