From 26527b6ca5d639d2730f059ceb38ea3e22e77538 Mon Sep 17 00:00:00 2001 From: youssef Date: Tue, 15 Sep 2020 17:37:00 +0000 Subject: [PATCH] code example updated --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4293d89..1205c24 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ $ java -jar target/OtsCli.jar info examples/merkle2.txt.ots Create timestamp with the aid of remote calendars. ```java -DetachedTimestampFile detached = DetachedTimestampFile.from( new OpSHA256(), file ) +DetachedTimestampFile detached = DetachedTimestampFile.from(new OpSHA256(), file); Timestamp stampResult = OpenTimestamps.stamp(detached); String infoResult = OpenTimestamps.info(detached); System.out.println(infoResult); @@ -140,14 +140,14 @@ Verify the timestamp attestations. byte[] file = Utils.hexToBytes("48656c6c6f20576f726c64210a"); byte[] fileOts = Utils.hexToBytes("004f70656e54696d657374616d7073000050726f6f6600bf89e2e884e89294010803ba204e50d126e4674c005e04d82e84c21366780af1f43bd54a37816b6ab34003f1c8010100000001e482f9d32ecc3ba657b69d898010857b54457a90497982ff56f97c4ec58e6f98010000006b483045022100b253add1d1cf90844338a475a04ff13fc9e7bd242b07762dea07f5608b2de367022000b268ca9c3342b3769cdd062891317cdcef87aac310b6855e9d93898ebbe8ec0121020d8e4d107d2b339b0050efdd4b4a09245aa056048f125396374ea6a2ab0709c6ffffffff026533e605000000001976a9140bf057d40fbba6744862515f5b55a2310de5772f88aca0860100000000001976a914f00688ac000000000808f120a987f716c533913c314c78e35d35884cac943fa42cac49d2b2c69f4003f85f880808f120dec55b3487e1e3f722a49b55a7783215862785f4a3acb392846019f71dc64a9d0808f120b2ca18f485e080478e025dab3d464b416c0e1ecb6629c9aefce8c8214d0424320808f02011b0e90661196ff4b0813c3eda141bab5e91604837bdf7a0c9df37db0e3a11980808f020c34bc1a4a1093ffd148c016b1e664742914e939efabe4d3d356515914b26d9e20808f020c3e6e7c38c69f6af24c2be34ebac48257ede61ec0a21b9535e4443277be306460808f1200798bf8606e00024e5d5d54bf0c960f629dfb9dad69157455b6f2652c0e8de810808f0203f9ada6d60baa244006bb0aad51448ad2fafb9d4b6487a0999cff26b91f0f5360808f120c703019e959a8dd3faef7489bb328ba485574758e7091f01464eb65872c975c80808f020cbfefff513ff84b915e3fed6f9d799676630f8364ea2a6c7557fad94a5b5d7880808f1200be23709859913babd4460bbddf8ed213e7c8773a4b1face30f8acfdf093b7050808000588960d73d7190103f7ef15"); -DetachedTimestampFile detached = DetachedTimestampFile.from( new OpSHA256(), file ) +DetachedTimestampFile detached = DetachedTimestampFile.from(new OpSHA256(), file); DetachedTimestampFile detachedOts = DetachedTimestampFile.deserialize(fileOts); -HashMap result = OpenTimestamps.verify(detachedOts,detached); +HashMap result = OpenTimestamps.verify(detachedOts,detached); if (result == null || result.isEmpty()) { System.out.println("Pending or Bad attestation"); } else { - result.forEach((k, v) -> System.out.println("Success! " + k + " attests data existed as of "+ new Date(v.longValue() * 1000))); + result.forEach((k, v) -> System.out.println("Success! " + k + " attests data existed as of "+ new Date(v.timestamp * 1000))); } ```