-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from adorsys/sync-develop
Sync develop with main
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,11 @@ | |
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertThrows; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Francis Pouatcha</a> | ||
*/ | ||
|
@@ -167,7 +170,7 @@ public void testS6_2_PresentationNegative() throws JOSEException, ParseException | |
// Verify with wrong public key from settings (issuer) | ||
presenteSdJwtVP.getKeyBindingJWT().get().verifySignature(testSettings.issuerVerifierContext.verifier); | ||
} | ||
|
||
@Test | ||
public void testS6_2_PresentationPartialDisclosure() throws ParseException, JOSEException { | ||
String jwsType = "vc+sd-jwt"; | ||
|
@@ -186,4 +189,23 @@ public void testS6_2_PresentationPartialDisclosure() throws ParseException, JOSE | |
.verifySignature(TestSettings.verifierContextFrom(presenteSdJwtVP.getCnfClaim(), "ES256")); | ||
} | ||
|
||
} | ||
@Test | ||
public void testOf_validInput() { | ||
String sdJwtString = TestUtils.readFileAsString(getClass(), "sdjwt/s6.2-presented-sdjwtvp.txt"); | ||
SdJwtVP sdJwtVP = SdJwtVP.of(sdJwtString); | ||
|
||
assertNotNull(sdJwtVP); | ||
assertEquals(4, sdJwtVP.getDisclosures().size()); | ||
} | ||
|
||
@Test | ||
public void testOf_MalformedSdJwt_ThrowsIllegalArgumentException() { | ||
// Given | ||
String malformedSdJwt = "issuer-signed-jwt"; // missing delimiter at the end | ||
|
||
// When & Then | ||
var exception = assertThrows(IllegalArgumentException.class, () -> SdJwtVP.of(malformedSdJwt)); | ||
assertEquals("SD-JWT is malformed, expected to end with ~", exception.getMessage()); | ||
} | ||
|
||
} |