From 57291497e6a559182425b5da3b9a2e173fe55e4c Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 2 Oct 2023 08:45:39 -0300 Subject: [PATCH] Sequence.GetAttestation() --- ots.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ots.go b/ots.go index 5947d67..29ecaf2 100644 --- a/ots.go +++ b/ots.go @@ -71,6 +71,17 @@ type Instruction struct { type Sequence []Instruction +func (seq Sequence) GetAttestation() Attestation { + if len(seq) == 0 { + return Attestation{} + } + att := seq[len(seq)-1] + if att.Attestation == nil { + return Attestation{} + } + return *att.Attestation +} + func (seq Sequence) Compute(initial []byte) []byte { current := initial for _, inst := range seq {