Skip to content

fix: restore SD+JWT credentials from backup - #623

Open
A-Chronicle wants to merge 3 commits into
hyperledger-identus:mainfrom
A-Chronicle:fix/issue-458-sdjwt-backup-restore
Open

fix: restore SD+JWT credentials from backup#623
A-Chronicle wants to merge 3 commits into
hyperledger-identus:mainfrom
A-Chronicle:fix/issue-458-sdjwt-backup-restore

Conversation

@A-Chronicle

@A-Chronicle A-Chronicle commented May 12, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #458 - Backup/restore was broken for SD+JWT credentials. The backup function stored only the JWT ID field instead of the full SDJWT JWS (jwtdisclosure1disclosure2~...), causing restore to fail since SDJWTCredential.fromJWS() needs the complete JWS including disclosures to properly recreate the credential.

Alternatives Considered (optional)

N/A

Checklist

  • My PR follows the contribution guidelines of this project
  • My PR is free of third-party dependencies that don't comply with the Allowlist
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked the PR title to follow the conventional commit specification

@A-Chronicle
A-Chronicle requested a review from a team as a code owner May 12, 2026 18:29
@A-Chronicle
A-Chronicle force-pushed the fix/issue-458-sdjwt-backup-restore branch 4 times, most recently from 6f38838 to e524e26 Compare May 12, 2026 18:42
elribonazo
elribonazo previously approved these changes May 13, 2026
@elribonazo
elribonazo enabled auto-merge May 13, 2026 08:08
auto-merge was automatically disabled May 14, 2026 08:08

Head branch was pushed to by a user without write access

@elribonazo
elribonazo self-requested a review May 19, 2026 12:50

@elribonazo elribonazo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please respect the PR template, its mandatory

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 75.537% (+0.1%) from 75.409% — A-Chronicle:fix/issue-458-sdjwt-backup-restore into hyperledger-identus:main

@A-Chronicle

Copy link
Copy Markdown
Contributor Author

Please respect the PR template, its mandatory

@elribonazo Apologies , I would be extra vigilant regarding pr template now onwards.

…s#458)

When backing up SD+JWT credentials, only the JWT ID field was being
stored instead of the full SDJWT JWS. This caused restore to fail
because SDJWTCredential.fromJWS() expects the complete JWS including
disclosures.

Changes:
- Modified Backup.ts to reconstruct full SDJWT JWS from JWT + disclosures
- Updated tests to use correct data format for SDJWT restore
- Added SDJWT to round-trip backup/restore test
- Exported credential JWS strings from fixtures for test use

Fixes hyperledger-identus#458

Signed-off-by: A-Chronicle <chaubeyanshika319@gmail.com>
The import path was incorrect - ../../../ only goes back to pluto/,
but we need ../../../../ to reach src/ and then access pollux/.

Signed-off-by: A-Chronicle <chaubeyanshika319@gmail.com>
…g backup

- Add proper type assertions and validation for credential data
- Handle disclosure objects with _encoded property format
- Improve SDJWT JWS reconstruction logic
- Add SDJWT with disclosures test fixture and test coverage
- Replace import type with runtime import for Domain error classes

Signed-off-by: A-Chronicle <chaubeyanshika319@gmail.com>
@A-Chronicle
A-Chronicle force-pushed the fix/issue-458-sdjwt-backup-restore branch from a754494 to 60dec1d Compare May 21, 2026 07:32
@A-Chronicle

Copy link
Copy Markdown
Contributor Author

@elribonazo I've addressed all the feedback:

  1. PR template - Updated the PR description to follow the mandatory template format with Description, Alternatives Considered, and Checklist sections with proper links.

  2. Rebased on latest main - Branch is up to date with no conflicts.

  3. New commit - Added SDJWT disclosure handling with type-safe error validation and improved test coverage for credentials with disclosures.

This is ready for re-review. Thanks!

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backup restore doesn't work with SD+JWT credential

3 participants