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
- func Decrypt(ciphertext, key, nonce []byte) ([]byte, error)
- func DownloadURL(ctx context.Context, url string) ([]byte, error)
- func Encrypt(plain []byte) (ciphertext, key, nonce []byte, err error)
- func LoadOrCreateIdentity(path string) (ed25519.PrivateKey, error)
- func UploadTempFile(ctx context.Context, sc rest.SpotClient, name string, data []byte) (string, error)
- type SignRequest
- type SignResponse
Constants ¶
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 DownloadURL ¶
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 ¶
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.