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

Fix credential layout expiry #499

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/Credentials/CredentialLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const CredentialLayout = ({ children, title = null }) => {
if (vcEntity) {
setZeroSigCount(vcEntity.instances.filter(instance => instance.sigCount === 0).length || 0);
setSigTotal(vcEntity.instances.length);
setIsExpired(CheckExpired(vcEntity.parsedCredential.beautifiedForm.expiry_date ?? vcEntity.parsedCredential.beautifiedForm.expiry_date))
setIsExpired(CheckExpired(vcEntity.parsedCredential.beautifiedForm))
setCredentialFriendlyName(vcEntity.parsedCredential.credentialFriendlyName);

}
Expand Down
8 changes: 3 additions & 5 deletions src/functions/CheckExpired.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// CheckExpired.js
export function CheckExpired(data) {

if (!data.exp || typeof data.exp != 'number') {
export function CheckExpired(claims) {
if (!claims || !claims.exp || typeof claims.exp != 'number') {
return false;
}
const parsedExpiryDate = new Date(data.exp * 1000);
console.log("Parsed expiry date = ", parsedExpiryDate)
const parsedExpiryDate = new Date(claims.exp * 1000);
return parsedExpiryDate < new Date();
};
Loading