sdk

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const AesKeySize = 32

Variables

This section is empty.

Functions

func AESEncrypt

func AESEncrypt(plaintext []byte) ([]byte, []byte, error)

func Deploy

func Deploy(req DeployRequest, keyReq KeyRequest) (string, []byte, error)

Deploy encrypts the given function data within a secure enclave and stores the encrypted function for future use. Returns a function ID upon successful deployment. The stored function can only be decrypted within an enclave.

func Encrypt

func Encrypt(message, username string, options ...Option) (string, error)

func EncryptBytes added in v0.2.1

func EncryptBytes(keyReq KeyRequest, input []byte) ([]byte, error)

func Key

func Key(keyReq KeyRequest) ([]byte, error)

func LinkAWSAccount added in v0.4.0

func LinkAWSAccount(url string, token string, customerID string) error

func PersistFile added in v0.4.0

func PersistFile(configDir, filename string, data []byte) error

func RSAEncrypt

func RSAEncrypt(plaintext []byte, publicKey []byte) ([]byte, error)

func Run

func Run(req RunRequest) ([]byte, error)

Run loads the given function into a secure enclave and invokes it on the given data, then returns the result.

func Test

func Test(testReq TestRequest, endpoint string, pcrSlice []string) (*entities.RunResults, error)

Test simulates the workflow of Deploy and Run, without storing the function. It loads the given function into an enclave, runs it on the given data, and returns the result. Use Test to verify that your function will work before storing it via Deploy.

Types

type AttestationUserData added in v0.3.0

type AttestationUserData struct {
	FuncChecksum []byte `json:"func_checksum"`
	KeyChecksum  []byte `json:"key_checksum"`
	CapeKey      []byte `json:"key"`
}

func ConnectAndAttest

func ConnectAndAttest(keyReq KeyRequest) (*attest.AttestationDoc, *AttestationUserData, error)

TODO: Run, deploy and test could use this function.

type DeployRequest

type DeployRequest struct {
	URL                    string
	Name                   string
	Reader                 io.Reader
	PcrSlice               []string
	FunctionTokenPublicKey string
	AuthToken              string

	// For development use only: skips validating TLS certificate from the URL
	Insecure bool
}

type ErrorMsg

type ErrorMsg struct {
	Error string `json:"error"`
}

type KeyRequest

type KeyRequest struct {
	URL          string
	FunctionAuth entities.FunctionAuth
	ConfigDir    string
	CapeKeyFile  string
	PcrSlice     []string

	// For development use only: skips validating TLS certificate from the URL
	Insecure bool
}

type Option added in v0.4.5

type Option func(o *Options)

func WithInsecure added in v0.4.8

func WithInsecure(insecure bool) Option

func WithURL added in v0.4.5

func WithURL(s string) Option

type Options added in v0.4.5

type Options struct {
	URL      string
	Insecure bool
}

type RunRequest

type RunRequest struct {
	URL          string
	FunctionID   string
	Data         []byte
	FuncChecksum []byte
	KeyChecksum  []byte
	PcrSlice     []string
	FunctionAuth entities.FunctionAuth

	// For development use only: skips validating TLS certificate from the URL
	Insecure bool
}

type TestRequest

type TestRequest struct {
	Function  []byte
	Input     []byte
	AuthToken string

	// For development use only: circumvents some token authorization when true
	Insecure bool
}

Jump to

Keyboard shortcuts

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