Documentation ¶
Index ¶
Constants ¶
const ( // Path to the capnp schema that ship with Sandstorm, assuming sandstorm // is installed in /opt/sandstorm. SandstormCapnpPath = "/opt/sandstorm/latest/usr/include" )
Variables ¶
var ( // The base32 alphabet used by Sandstorm for app-ids/public keys. SandstormBase32Encoding = base32.NewEncoding("0123456789acdefghjkmnpqrstuvwxyz"). WithPadding(base32.NoPadding) ErrBadKeyLength = errors.New("Invalid App Id: wrong length") )
var ( ErrKeyNotFound = errors.New("Key not found in keyring") ErrMalformedKey = errors.New("Key is malformed") )
Functions ¶
func PackInto ¶
Write an .spk into `dest`, using `archive` as the contents and `key` for signing. The archive must already contain the manifest.
func ReadPackageDefinition ¶
func ReadPackageDefinition(file, variable string, extraPaths []string) (spk.PackageDefinition, error)
Read the package definition from a textual pkgdef on disk. The `capnp` executable must be in PATH.
Parameters:
- file: The schema file to read - variable: the name of the variable in the file defining the package definition. - extraPaths: a list of extra directories to search for capnproto schema.
A typical use of this would be:
ReadPackageDefinition("sandstorm-pkgdef.capnp", "pkgdef", []string{SandstormCapnpPath})
Types ¶
type AppId ¶
type AppId [32]byte
An app id/public key
func (AppId) MarshalBinary ¶
func (AppId) MarshalText ¶
func (*AppId) UnmarshalBinary ¶
func (*AppId) UnmarshalText ¶
type Key ¶
A package signing key
func GenerateKey ¶
Generate a new signing key. It will be the root object of its own message. The argument is a cryptographic random number generator. Defaults to crypto/rand.Reader if nil.
type Keyring ¶
type Keyring struct {
// contains filtered or unexported fields
}
The contents of a sandstorm keyring, typically stored at ~/.sandstorm-keyring or ~/.sandstorm/sandstorm-keyring.
func LoadKeyring ¶
Load the sandstorm keyring from a named file.
type PkgDefParams ¶
type PkgDefParams struct { AppId AppId Key Key // The capnp schema id for the app's sandstorm-pkgdef.capnp SchemaId uint64 // The keyring in which to save the gerated key. // Defaults to ~/.sandstorm/sandstorm-keyring KeyringPath string // Path to save the package definition. Defaults to // `.sandstorm/sandstorm-pkgdef.capnp`. PkgDefPath string }
Parameters for initializing an application's pkgdef.
func NewApp ¶
func NewApp() (*PkgDefParams, error)
Generate the information needed to initialize a new app.
func (*PkgDefParams) Emit ¶
func (p *PkgDefParams) Emit() error
Emit a pkgdef with the given parameters, and save the app's key to the keyring.