Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class LdpPresentationGenerator implements PresentationGenerator<JsonObjec

public static final String TYPE_ADDITIONAL_DATA = "types";
public static final String HOLDER_PROPERTY = "holder";
public static final URI ASSERTION_METHOD = URI.create("https://w3id.org/security#assertionMethod");
public static final URI AUTHENTICATION = URI.create("https://w3id.org/security#authentication");
public static final URI JSON_WEB_KEY_2020 = URI.create("https://w3id.org/security#JsonWebKey2020");
private final PrivateKeyResolver privateKeyResolver;
private final SignatureSuiteRegistry signatureSuiteRegistry;
Expand Down Expand Up @@ -193,7 +193,7 @@ private JsonObject signPresentation(JsonObject presentationObject, SignatureSuit

var now = clock.instant();
var proofDraft = Jws2020ProofDraft.Builder.newInstance()
.proofPurpose(ASSERTION_METHOD)
.proofPurpose(AUTHENTICATION)
.verificationMethod(new JsonWebKeyPair(keyIdUri, JSON_WEB_KEY_2020, controllerUri, null))
.created(now)
.expires(now.plus(vpLifetime))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ public boolean isAccepted(URI id) {
assertThat(verifier.verify(presentation.toString(), VerifierContext.Builder.newInstance().verifier(verifier).build())).isSucceeded();
}

@Test
void createPresentation_proofPurposeIsAuthentication() {
var result = creator.generatePresentation(participantContextId, List.of(), PRIVATE_KEY_ALIAS, PUBLIC_KEY_ID, issuerId, ADDITIONAL_DATA);

var purpose = proof(result).getJsonArray(SECURITY_VOCAB + "proofPurpose").getJsonObject(0);
assertThat(purpose.getString("@id")).isEqualTo(SECURITY_VOCAB + "authentication");
}

@Test
void createPresentation_proofHasNoChallenge() {
var result = creator.generatePresentation(participantContextId, List.of(), PRIVATE_KEY_ALIAS, PUBLIC_KEY_ID, issuerId, ADDITIONAL_DATA);
Expand Down
Loading