From 5afda80c1a35c33ff602abc6072bbd2235101436 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 18 Sep 2023 16:31:05 -0300 Subject: [PATCH] bring examples so tests pass. --- client/bitcoin_test.go | 4 ++-- detached_timestamp_test.go | 4 ++-- examples/bad-stamp.txt | 2 ++ examples/bad-stamp.txt.ots | Bin 0 -> 688 bytes examples/empty | 0 examples/empty.ots | Bin 0 -> 3812 bytes examples/hello-world.txt | 1 + examples/hello-world.txt.ots | Bin 0 -> 688 bytes examples/incomplete.txt | 1 + examples/incomplete.txt.ots | Bin 0 -> 175 bytes examples/known-and-unknown-notary.txt | 2 ++ examples/known-and-unknown-notary.txt.ots | Bin 0 -> 265 bytes examples/merkle1.txt | 2 ++ examples/merkle1.txt.ots | Bin 0 -> 335 bytes examples/merkle2.txt | 2 ++ examples/merkle2.txt.ots | Bin 0 -> 335 bytes examples/merkle3.txt | 2 ++ examples/merkle3.txt.ots | Bin 0 -> 300 bytes examples/two-calendars.txt | 1 + examples/two-calendars.txt.ots | Bin 0 -> 265 bytes examples/unknown-notary.txt | 1 + examples/unknown-notary.txt.ots | Bin 0 -> 175 bytes remote_calendar_test.go | 2 +- 23 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 examples/bad-stamp.txt create mode 100644 examples/bad-stamp.txt.ots create mode 100644 examples/empty create mode 100644 examples/empty.ots create mode 100644 examples/hello-world.txt create mode 100644 examples/hello-world.txt.ots create mode 100644 examples/incomplete.txt create mode 100644 examples/incomplete.txt.ots create mode 100644 examples/known-and-unknown-notary.txt create mode 100644 examples/known-and-unknown-notary.txt.ots create mode 100644 examples/merkle1.txt create mode 100644 examples/merkle1.txt.ots create mode 100644 examples/merkle2.txt create mode 100644 examples/merkle2.txt.ots create mode 100644 examples/merkle3.txt create mode 100644 examples/merkle3.txt.ots create mode 100644 examples/two-calendars.txt create mode 100644 examples/two-calendars.txt.ots create mode 100644 examples/unknown-notary.txt create mode 100644 examples/unknown-notary.txt.ots diff --git a/client/bitcoin_test.go b/client/bitcoin_test.go index ce8af27..c021f43 100644 --- a/client/bitcoin_test.go +++ b/client/bitcoin_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/fiatjaf/opentimestamps" "github.com/btcsuite/btcd/rpcclient" + "github.com/fiatjaf/opentimestamps" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -56,7 +56,7 @@ func TestVerifyHelloWorld(t *testing.T) { expectedTime := "2015-05-28T15:41:18Z" helloWorld, err := opentimestamps.NewDetachedTimestampFromPath( - "../../examples/hello-world.txt.ots", + "../examples/hello-world.txt.ots", ) require.NoError(t, err) ts := helloWorld.Timestamp diff --git a/detached_timestamp_test.go b/detached_timestamp_test.go index 38e6f8a..364eaa8 100644 --- a/detached_timestamp_test.go +++ b/detached_timestamp_test.go @@ -11,7 +11,7 @@ import ( ) func examplePaths() []string { - matches, err := filepath.Glob("../examples/*ots") + matches, err := filepath.Glob("./examples/*ots") if err != nil { panic(err) } @@ -31,7 +31,7 @@ func containsUnknownAttestation(ts *Timestamp) (res bool) { func TestDecodeHelloWorld(t *testing.T) { dts, err := NewDetachedTimestampFromPath( - "../examples/hello-world.txt.ots", + "./examples/hello-world.txt.ots", ) assert.NoError(t, err) diff --git a/examples/bad-stamp.txt b/examples/bad-stamp.txt new file mode 100644 index 0000000..82d7cfe --- /dev/null +++ b/examples/bad-stamp.txt @@ -0,0 +1,2 @@ +The timestamp on this file is well-formatted, but will fail Bitcoin block +header validation. diff --git a/examples/bad-stamp.txt.ots b/examples/bad-stamp.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..897b46dba45e4dbef2667d1323acad0ee1c431e6 GIT binary patch literal 688 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(>deJ=KT!B;b0^0^)Jv)_ zbnhMEMLpe{Pw35i=H0l(qlo$A2}VW+1_s6_O+PQ|ov~gPzHM%2gFtI_h-=jZ&&sC% zVLxm9j`rox04d7$FmPp3WY`qE_T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$=2D;L-0yHswZ|z8rU@i^yT$0b6b@x$#jS5|yV%*=ouMKqIqVa{YB zPL?g`6Z0NLY&r3rifSJ;A0OB0Bp*+5J`{dtZJdv7u5#B+(V?Y5u8_M0gYT&jGd)W8 zdxfHy`6Hj5OMG*F+nLE`IXR6D^4#{5GzAawnov>gfx^+rOxC#All>J9%nL|jgT%X} zdfM+{8k&$hma42`3&iid(C8}?7DIRCOGBf@*f`r&CwR~V+Os09%Cb~#G`>0$BUWtyzG0X#>C9sA79=4 wn?C%5F;2M*N7>j-X*(?Jo4h@?Is5ZkPLr0CiV8p;n{hSZ8ygAfp99MO0S>|-00000 literal 0 HcmV?d00001 diff --git a/examples/hello-world.txt b/examples/hello-world.txt new file mode 100644 index 0000000..980a0d5 --- /dev/null +++ b/examples/hello-world.txt @@ -0,0 +1 @@ +Hello World! diff --git a/examples/hello-world.txt.ots b/examples/hello-world.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..d8357eb50f9f26136a367bcc7e8365b2ddd7e0f5 GIT binary patch literal 688 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(n0G1o1zc2nlJ3J0$8tlj z<&bb%1=q(f)>pmE8?&=EJ1~Dd!N|zKz`*#V>E~s=GuF$(x6SQr5NNFqajlx*S=sbI z>}QSN(Z2i{AVt|82Chts44Z=2Uc7jILW{G-lF|kKAMH;*->ag{UZ(qs{cA$E?&EYO z1%^!-r{)+tZ7!R0mrY}$Va=WQ?W+z8Y-^31JGrxO_lq}-icGwHz5=z{#N?3~B`0|8U2@iSJSy$q6ND@C|JgkRy`y{yC|DKI`dbde$N z({lZeH4EB64uh!pz}B$_#OC1msIapAyVz0Vi8h8l6^~<0JABqmv0tLI#`DsqWAh!D zf5dly)Z9B7ZPNbm@pq*qvqP6x7>Ty2w|-f?X7i+$1j+BR$Gql()NDE>@ul@agL@xS z>}p##Z^s-yxzlNyC)fRXaYE6TMa77N!KlKEdYG}_qR5|LgVH!;D(eDC)K zC-0lz=Ccx<0aA0=`{0s=oc4c3dKk0i(%hXU`c0nqYoD*JX{zW%Z?&6`z-pd7Kire~ zZN18&eI~Ehc&OIhOMJtnxHCA;#aX@jF`FC6J?t~~x3N87PENPI*Q*zikmkCreL&%sKt<|5xGvEjvXY|GW0{`pon+ zgCAyoiDKGuFyww@&e=Lsc-LN+gxz<4yj8TTX)j)~@z*(nA8Y=8n7o~p TgM)#!V;XPqbxB6%@9#wc$N4w_ literal 0 HcmV?d00001 diff --git a/examples/incomplete.txt b/examples/incomplete.txt new file mode 100644 index 0000000..e641709 --- /dev/null +++ b/examples/incomplete.txt @@ -0,0 +1 @@ +The timestamp on this file is incomplete, and can be upgraded. diff --git a/examples/incomplete.txt.ots b/examples/incomplete.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..f49cd3595c50ed52d8ffada5f8f84ceb18f4c1ca GIT binary patch literal 175 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(SdV-YTk+J8SMsLC`Rkc& zzV$w551s0EpDnPyIn0~0>gNZ6=OOziH)PfATGsHs`huYM7mg1CTZ><`^8B5beDQM>N`02OH#`mp! zgFj6=W6!=}g7ASYJbksN=P-W|aJ%8OH@3O_!50O`eJA%WOXv9iLBLoiTz`&tZ|u&S z(<83*|2N_I$P)fyzQqTQ;$wGwdG=_2U}(Pom{;#7PoIuwK{$Hq^2dZCdlf$*2E literal 0 HcmV?d00001 diff --git a/examples/merkle2.txt b/examples/merkle2.txt new file mode 100644 index 0000000..a66a551 --- /dev/null +++ b/examples/merkle2.txt @@ -0,0 +1,2 @@ +This file is one of three different files that have been timestamped together +with a single merkle tree. (2/3) diff --git a/examples/merkle2.txt.ots b/examples/merkle2.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..9cadc72f8140290d0f5ae9a7e5cc71c8311f84ad GIT binary patch literal 335 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(y00$%Q0)?UXnNTFxUI61 z{#!Tk)O9xMwpZ`E%-b##q5nZ(n{B_MElbgi9jjfZuDS8_0>?*%b&;12T>AQcW$lm8 zXO_Q+aP8m`P%{6xY~hA2$Cj=x|1yQ+g91}>*z@W7OqK?3S`G=XeS3tJC1JXy>F!Hk z?%P&hy>~R8`e+vXnD4-+#=j z_mihjPdB5aq@dVJUq3M?GdWc+sU%r1IWZ?SFD0=^FCXZ|61W%j@{7_x2zaf!H%I?> otIheJ2g({RNdAQw{on&fn#=n_gTgW`xY0V=Fr$<5lL#3M0IC+5dH?_b literal 0 HcmV?d00001 diff --git a/examples/merkle3.txt b/examples/merkle3.txt new file mode 100644 index 0000000..2fd9fa0 --- /dev/null +++ b/examples/merkle3.txt @@ -0,0 +1,2 @@ +This file is one of three different files that have been timestamped together +with a single merkle tree. (3/3) diff --git a/examples/merkle3.txt.ots b/examples/merkle3.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..6bb674e6084ca2dedbd51e80f89773ffef20fe11 GIT binary patch literal 300 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(EYp_FKkOnf=`tQhs{h}QIKM3dvv2y*b5_shwDR*7`a_lpXk1XLgo9=($ z*!U?=FEo;+oT2&tV_vR}$Yt_9u`oCLk&i_16)_6hkFU05vA2`xn-WM7amTAF_*3pI;os^$M$Y21< CP=q!B literal 0 HcmV?d00001 diff --git a/examples/two-calendars.txt b/examples/two-calendars.txt new file mode 100644 index 0000000..47d79f5 --- /dev/null +++ b/examples/two-calendars.txt @@ -0,0 +1 @@ +This file has an (incomplete) timestamp with two different calendars. diff --git a/examples/two-calendars.txt.ots b/examples/two-calendars.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..1f3522c102e084a901db4c4c3bbfdf7b6ff1f098 GIT binary patch literal 265 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(-men(&v-hWwX`JR%lAtx zd$ogO{!04Jof0BZtf=YWd;5bx^91vEUp(&}yLDLU)O3>?SC0Q51hO5Jx4pf*;N5G^ zr`IKltmkojWC_2LD*A!r)!np>8NHz;49)i+^XmQN>C@BAC@Co@w$j&6%*jkn)k`W# z)=N&zNzF@1EYiydI<5rnIKBL$^bZ1y*A~eA{K#s$!ZTy*%DJr#5TnIDaHLdEcqOgQ SH63oWjyBBbr2Hg81_J;t$8;0` literal 0 HcmV?d00001 diff --git a/examples/unknown-notary.txt b/examples/unknown-notary.txt new file mode 100644 index 0000000..42a7a43 --- /dev/null +++ b/examples/unknown-notary.txt @@ -0,0 +1 @@ +This file's timestamp has a single attestation from an unknown notary. diff --git a/examples/unknown-notary.txt.ots b/examples/unknown-notary.txt.ots new file mode 100644 index 0000000000000000000000000000000000000000..af149ef8c8c1a74c80382b1b0eb6926a5088a001 GIT binary patch literal 175 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(?i`Ypm3LZVwrD~9Nzr=; ze78t9pP11S>2dg4%CqP5pkcXNCYn73Cq_I^am&6nY? o{NzjWUvYe734bwH;{(TEjcW>O#u70Mj7-cdtZeKYdKDxA0L6VxJpcdz literal 0 HcmV?d00001 diff --git a/remote_calendar_test.go b/remote_calendar_test.go index b6825ba..ce50af1 100644 --- a/remote_calendar_test.go +++ b/remote_calendar_test.go @@ -34,7 +34,7 @@ func newTestDigest(in string) []byte { func TestRemoteCalendarExample(t *testing.T) { dts, err := NewDetachedTimestampFromPath( - "../examples/two-calendars.txt.ots", + "./examples/two-calendars.txt.ots", ) require.NoError(t, err)