signing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package signing signs and checks versions of projects' settings (ADR-0018, risk R21, layer 2). Whoever controls the workspace server could otherwise make every agent of the team run what they like; with signatures an agent applies a version that runs new code only when a person the workspace's admin trusts made it.

  • Every device has an Ed25519 signing key, kept like its other keys.
  • The workspace's root of trust is the signing key of its admin's device. An agent pins it the first time it sees the workspace, and does not take another one from the server afterwards.
  • The admin certifies, with the root, the devices of the people who change settings: a certificate binds a key to a person and a device.
  • The author's device signs each version: the workspace, the project, the version number and the hash of the settings exactly as stored.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsigned  = errors.New("the version is not signed")
	ErrNoRoot    = errors.New("the workspace has no root of trust yet")
	ErrUntrusted = errors.New("signed by a device the workspace's admin has not certified")
	ErrSignature = errors.New("the signature does not match the settings")
)

Errors of Verify.

Functions

func DeployMessage

func DeployMessage(workspace, serverID, project string, version int32, config []byte) []byte

DeployMessage is what someone with production.deploy signs to make a server's production run a version (R14b): this server, this project, this version with exactly these settings.

func EnvironmentMessage

func EnvironmentMessage(workspace, serverID, project, kind, domain string) []byte

EnvironmentMessage is what the creator of a server's environment signs (R14): the server runs the project as this kind at this domain.

func Fingerprint

func Fingerprint(pub ed25519.PublicKey) string

Fingerprint is a short form of a public key for people to compare: the admin reads it out, the developer sees it in 'devopus trust show'.

func SettingsMessage

func SettingsMessage(workspace, project string, version int32, config []byte) []byte

SettingsMessage is what the author signs for a version: it cannot be shown as another project's, another workspace's or another number's version.

func SignerMessage

func SignerMessage(workspace, userID, email, deviceID string, pub ed25519.PublicKey) []byte

SignerMessage is what the root signs to certify a device of a person.

Types

type Key

type Key struct {
	Private ed25519.PrivateKey
}

Key is a device's signing key.

func NewKey

func NewKey() (Key, error)

NewKey makes a signing key.

func ParseKey

func ParseKey(s string) (Key, error)

ParseKey reads a key as String wrote it.

func (Key) Public

func (k Key) Public() ed25519.PublicKey

Public is the public half.

func (Key) Sign

func (k Key) Sign(msg []byte) []byte

Sign signs a message of this package.

func (Key) String

func (k Key) String() string

String is the private key for the key store.

type Set

type Set struct {
	Workspace string
	Root      ed25519.PublicKey
	// RootDevice and RootEmail are whose device holds the root.
	RootDevice, RootEmail string
	Signers               []Signer
}

Set is what an agent checks versions with: the root it pinned and the signers the server says the root certified — each certificate is checked, so the server can add no one.

func (Set) Certified

func (s Set) Certified(sg Signer) bool

Certified: the root signed this signer's certificate.

func (Set) Verify

func (s Set) Verify(project string, version int32, config []byte, deviceID string, sig []byte) (email string, err error)

Verify checks a version and returns who signed it.

func (Set) VerifyMessage

func (s Set) VerifyMessage(msg []byte, deviceID string, sig []byte) (string, error)

VerifyMessage checks any message of this package signed by the root or a certified device and returns who signed it.

type Signer

type Signer struct {
	DeviceID, UserID, Email string
	Public                  ed25519.PublicKey
	// Certificate is the root's signature of SignerMessage.
	Certificate []byte
}

Signer is a device whose signatures count: the root's, or one it certified.

Jump to

Keyboard shortcuts

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