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

Update use of "proofPurpose" and "challenge" in Danube Tech implementation. #12

Merged
Merged
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 @@ -70,7 +70,7 @@ static JWK readJwk(Map<String, Object> keyMap, boolean privateKeyJwk) throws IOE
return keyJwk;
}

static void create(String input, String key, String outputFilename) throws JsonLDException, GeneralSecurityException, IOException {
static void create(String input, String key, String outputFilename, String proofPurpose) throws JsonLDException, GeneralSecurityException, IOException {
JsonLDObject jsonLDObject = JsonLDObject.fromJson(input);
Map<String, Object> keyMap = readKeyMap(key);
URI verificationMethod = readVerificationMethod(keyMap);
Expand All @@ -82,19 +82,20 @@ static void create(String input, String key, String outputFilename) throws JsonL
JsonWebSignature2020LdSigner jsonWebSignature2020LdSigner = new JsonWebSignature2020LdSigner();
jsonWebSignature2020LdSigner.setVerificationMethod(verificationMethod);
jsonWebSignature2020LdSigner.setCreated(new Date());
jsonWebSignature2020LdSigner.setProofPurpose(LDSecurityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
jsonWebSignature2020LdSigner.setProofPurpose(proofPurpose);
jsonWebSignature2020LdSigner.setSigner(byteSigner);
jsonWebSignature2020LdSigner.setChallenge("123");
jsonWebSignature2020LdSigner.sign(jsonLDObject, true, false);
String output = jsonLDObject.toJson(true);
writeFile(outputFilename, output);
}

static void credentialCreate(String input, String key, String outputFilename) throws JsonLDException, GeneralSecurityException, IOException {
create(input, key, outputFilename);
create(input, key, outputFilename, LDSecurityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
}

static void presentationCreate(String input, String key, String outputFilename) throws JsonLDException, GeneralSecurityException, IOException {
create(input, key, outputFilename);
create(input, key, outputFilename, LDSecurityKeywords.JSONLD_TERM_AUTHENTICATION);
}

public static void main(String[] args) throws Throwable {
Expand Down