Skip to content

Commit 254ea45

Browse files
committed
doc: Fix example.
Signed-off-by: Markus Sabadello <[email protected]>
1 parent fb9bf60 commit 254ea45

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

examples-ldp.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,23 @@ Verifiable Credentials with Linked Data Proofs:
4040
LinkedHashMap<String, Object> jsonLdDriversLicense = new LinkedHashMap<String, Object> ();
4141
jsonLdDriversLicense.put("licenseClass", "trucks");
4242
jsonLdCredentialSubject.put("driversLicense", jsonLdDriversLicense);
43-
44-
URI creator = URI.create("did:sov:1yvXbmgPoUm4dl66D7KhyD#keys-1");
45-
String created = "2018-01-01T21:19:10Z";
46-
String domain = null;
47-
String nonce = "c0ae1c8e-c7e7-469f-b252-86e6a0e7387e";
48-
49-
RsaSignature2018LdSigner signer = new RsaSignature2018LdSigner(creator, created, domain, nonce, TestUtil.testRSAPrivateKey);
50-
LdSignature ldSignature = signer.sign(verifiableCredential.getJsonLdObject());
51-
52-
System.out.println(JsonUtils.toString(verifiableCredential.getJsonLdObject()));
43+
44+
byte[] testEd25519PrivateKey = Hex.decodeHex("984b589e121040156838303f107e13150be4a80fc5088ccba0b0bdc9b1d89090de8777a28f8da1a74e7a13090ed974d879bf692d001cddee16e4cc9f84b60580".toCharArray());
45+
46+
JsonLDObject jsonLdObject = JsonLDObject.fromJson(new FileReader("input.jsonld"));
47+
String verificationMethod = "https://example.com/jdoe/keys/1";
48+
String domain = "example.com";
49+
String nonce = null;
50+
51+
Ed25519Signature2018LdSigner signer = new Ed25519Signature2018LdSigner(testEd25519PrivateKey);
52+
signer.setCreated(new Date());
53+
signer.setProofPurpose(LDSecurityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
54+
signer.setVerificationMethod(verificationMethod);
55+
signer.setDomain(domain);
56+
signer.setNonce(nonce);
57+
LdProof ldProof = signer.sign(jsonLdObject);
58+
59+
System.out.println(ldProof.toJson(true));
5360

5461
### Example code (verifying)
5562

0 commit comments

Comments
 (0)