checkpoint

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeTlogSize = "text/x.tlog.size"
)

Variables

View Source
var ErrUnwantedSignature = errors.New("unwanted signature")

Functions

func WriteEd25519Signature

func WriteEd25519Signature(w io.Writer, origin string, keyId KeyId, signature *crypto.Signature) error

Types

type Checkpoint

type Checkpoint struct {
	types.SignedTreeHead
	Origin string // Checkpoint origin
	KeyId  KeyId  // The key id associated with SignedTreeHead.Signature

}

Represents only the log's own signature on the checkpoint, i.e., a signature line where the key name equals the checkpoint origin.

func (*Checkpoint) Cosign added in v0.9.0

func (cp *Checkpoint) Cosign(signer crypto.Signer, timestamp uint64) (types.Cosignature, error)

func (*Checkpoint) FromASCII

func (cp *Checkpoint) FromASCII(r io.Reader) error

func (*Checkpoint) Parse added in v0.10.0

func (cp *Checkpoint) Parse(p *ascii.LineReader) error

func (*Checkpoint) ToASCII

func (cp *Checkpoint) ToASCII(w io.Writer) error

func (*Checkpoint) Verify

func (cp *Checkpoint) Verify(publicKey *crypto.PublicKey) error

func (*Checkpoint) VerifyCosignature added in v0.9.0

func (cp *Checkpoint) VerifyCosignature(publicKey *crypto.PublicKey, cosignature *types.Cosignature) bool

func (*Checkpoint) VerifyCosignatureByKey added in v0.9.0

func (cp *Checkpoint) VerifyCosignatureByKey(signatures []CosignatureLine, publicKey *crypto.PublicKey) (types.Cosignature, error)

Returns a verified cosignature identified by public key. The key name on the signature line is ignored, except that it is used to construct the key id.

type CosignatureLine added in v0.9.0

type CosignatureLine struct {
	KeyName string
	KeyId   KeyId
	types.Cosignature
}

Represents a checkpoint cosignature line.

func CosignatureLinesFromASCII added in v0.9.0

func CosignatureLinesFromASCII(r io.Reader) ([]CosignatureLine, error)

func (*CosignatureLine) ToASCII added in v0.9.0

func (csl *CosignatureLine) ToASCII(w io.Writer) error

type KeyId

type KeyId [4]byte

func NewKeyId added in v0.10.0

func NewKeyId(keyName string, sigType SignatureType, publicKey *crypto.PublicKey) (res KeyId)

func NewLogKeyId

func NewLogKeyId(keyName string, publicKey *crypto.PublicKey) (res KeyId)

func NewWitnessKeyId

func NewWitnessKeyId(keyName string, publicKey *crypto.PublicKey) (res KeyId)

func ParseEd25519SignatureLine

func ParseEd25519SignatureLine(line, keyName string) (KeyId, crypto.Signature, error)

Input is a single signature line, with no trailing newline character. If the line carries the right keyName and has a size consistent with an Ed25519 signature line, returns the keyId and signature. If line is syntactically valid but doesn't match these requirements, ErrUnwantedSignature is returned.

type NoteVerifier added in v0.10.0

type NoteVerifier struct {
	Name      string
	KeyId     KeyId
	Type      SignatureType
	PublicKey crypto.PublicKey
}

func NewNoteVerifier added in v0.10.0

func NewNoteVerifier(keyName string, keyType SignatureType, publicKey *crypto.PublicKey) NoteVerifier

func (*NoteVerifier) FromString added in v0.10.0

func (nv *NoteVerifier) FromString(in string) error

A note verifier should be parsed as <name>+<hash>+<keydata> according to https://pkg.go.dev/golang.org/x/mod/sumdb/note. Note that this functions uses the hash as is as the KeyId, no checks that it is consistent with the key name and key data.

func (*NoteVerifier) String added in v0.10.0

func (nv *NoteVerifier) String() string

type SignatureType added in v0.10.0

type SignatureType byte

See https://github.com/C2SP/C2SP/blob/signed-note/v1.0.0-rc.1/signed-note.md

const (
	SigTypeEd25519     SignatureType = 0x01
	SigTypeCosignature SignatureType = 0x04
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL