ptype

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package ptype holds the frozen registry of proof type integer codes used by Truestamp proof bundles. The registry discriminates both subject types (bundle["t"]) and external commitment chain types (bundle["cx"][].t).

The registry is a long-lived contract:

  • Existing codes are never reused or renumbered.
  • New codes claim unused integers in the appropriate category.

Category ranges (blocks of 10):

10-19  subject: block family  (10 = block, 11 = beacon)
20-29  subject: item
30-39  subject: entropy sources
40-49  external commitment chains
50+    reserved for future categories

Beacon (t=11) shares the block structural shape — no `s`, no `ip`, same `b` + `cx` — but is a distinct type code for domain separation. Because `t` is part of the signing payload, a t=10 and t=11 bundle for the same block produce different signatures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Humanize

func Humanize(c Code) string

Humanize returns a display-friendly label for a code, used in the pretty verify output.

func IsBlockLikeSubject

func IsBlockLikeSubject(c Code) bool

IsBlockLikeSubject reports whether c is a block-family subject type — either a plain block (t=10) or a beacon (t=11). The two share the same wire shape: no `s`, no `ip`, `subject_hash == block_hash`. Verification branches that skip subject / inclusion-proof / subject-hash-derivation steps should key off this helper rather than `c == Block`.

func IsEntropySubject

func IsEntropySubject(c Code) bool

IsEntropySubject reports whether c is one of the entropy subject types.

func IsValidExternalCommitment

func IsValidExternalCommitment(c Code) bool

IsValidExternalCommitment reports whether c is a registered external commitment type code.

func IsValidSubject

func IsValidSubject(c Code) bool

IsValidSubject reports whether c is a registered subject type code.

func Name

func Name(c Code) string

Name returns the lowercase atom-style name for a code, matching the reference Elixir implementation. Used as the JSON subject_type value and as an internal dispatch key. Returns "unknown" for unregistered codes.

Types

type Code

type Code uint16

Code is the integer type code used to identify the subject of a proof bundle or the chain of an external commitment. Codes are u16 on the wire (in the signed payload); all currently-registered codes fit in one byte.

const (
	Block          Code = 10
	Beacon         Code = 11
	Item           Code = 20
	EntropyNIST    Code = 30
	EntropyStellar Code = 31
	EntropyBitcoin Code = 32
)

Registered subject type codes.

const (
	CommitmentStellar Code = 40
	CommitmentBitcoin Code = 41
)

Registered external commitment type codes.

Jump to

Keyboard shortcuts

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