// Copyright 2024 Matthew Rich . All rights reserved. package folio import ( "decl/internal/data" "decl/internal/signature" "errors" "encoding/hex" ) var ( ErrInvalidSignature error = errors.New("Invalid signature") ) type Signature []byte func (s Signature) Verify(res data.ContentHasher) error { i := &signature.Ident{} return i.VerifySum(res.Hash(), s) } func (s *Signature) SetHexString(sig string) error { if v, e := hex.DecodeString(sig); e == nil { *s = v } else { return e } return nil } func (s *Signature) String() string { return hex.EncodeToString(*s) }