proto

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package proto holds the wire types and shared helpers used by both the gosigner daemon and the signreq client: the Spot request/response envelope, per-transfer AES-256-GCM file encryption, the static ed25519 identity store, and Util/TempFile upload/download (tunneled through Spot).

Index

Constants

View Source
const Endpoint = "sign"

Endpoint is the default Spot handler name the daemon listens on and the client sends to (overridable on both sides).

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext, key, nonce []byte) ([]byte, error)

Decrypt opens a ciphertext produced by Encrypt.

func DownloadURL

func DownloadURL(ctx context.Context, url string) ([]byte, error)

DownloadURL fetches the (encrypted) blob at url over plain HTTPS, following redirects. The payload is AES-encrypted so the transport being unauthenticated/plaintext is acceptable by design.

func Encrypt

func Encrypt(plain []byte) (ciphertext, key, nonce []byte, err error)

Encrypt seals plain with a fresh random AES-256-GCM key and nonce. Returns the ciphertext, the 32-byte key and the 12-byte nonce.

func LoadOrCreateIdentity

func LoadOrCreateIdentity(path string) (ed25519.PrivateKey, error)

LoadOrCreateIdentity loads an ed25519 private key from a PKCS#8 PEM file, creating (and persisting, mode 0600) a new one if the file is absent. This gives the daemon a stable Spot peer id across restarts.

func UploadTempFile

func UploadTempFile(ctx context.Context, sc rest.SpotClient, name string, data []byte) (string, error)

UploadTempFile uploads data to Util/TempFile:upload through the Spot client (so the API call itself is authenticated/E2E; the blob is not, hence callers encrypt it first) and returns its public download URL.

Types

type SignRequest

type SignRequest struct {
	Secret      string `json:"secret"`
	URL         string `json:"url"`
	Key         []byte `json:"key"`   // 32 bytes (base64 in JSON)
	Nonce       []byte `json:"nonce"` // 12 bytes (base64 in JSON)
	Filename    string `json:"filename"`
	ProgramName string `json:"program_name,omitempty"`
	ProgramURL  string `json:"program_url,omitempty"`
}

SignRequest is the JSON body sent by signreq to the daemon inside an end-to-end-encrypted Spot message. URL points at an AES-256-GCM encrypted blob on Util/TempFile; Key/Nonce decrypt it. ProgramName and ProgramURL populate the SpcSpOpusInfo signed attribute (the publisher's display name and "more info" link surfaced by Authenticode verifiers); both optional, both default to empty / omitted.

type SignResponse

type SignResponse struct {
	URL      string `json:"url"`
	Key      []byte `json:"key"`
	Nonce    []byte `json:"nonce"`
	Filename string `json:"filename"`
}

SignResponse is the JSON body the daemon returns (also inside an end-to-end-encrypted Spot reply) pointing at the encrypted signed file.

Jump to

Keyboard shortcuts

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