Documentation
¶
Overview ¶
Package helium provides the main types and interfaces for the Helium framework.
Index ¶
- Variables
- func ContextWithCircuitID(ctx context.Context, circID CircuitID) context.Context
- func NewBackgroundContext(sessID SessionID, circID ...CircuitID) context.Context
- func NewContext(ctx context.Context, sessID SessionID, circID ...CircuitID) context.Context
- type CachedKeyBackend
- func (ckb *CachedKeyBackend) GetCollectivePublicKey(ctx context.Context) (*rlwe.PublicKey, error)
- func (ckb *CachedKeyBackend) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
- func (ckb *CachedKeyBackend) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
- type Ciphertext
- type CiphertextID
- type CiphertextMetadata
- type CiphertextType
- type CircuitID
- type MemoryKeyStore
- func (pkb *MemoryKeyStore) GetCollectivePublicKey(ctx context.Context) (cpk *rlwe.PublicKey, err error)
- func (pkb *MemoryKeyStore) GetGaloisKey(ctx context.Context, galEl uint64) (gk *rlwe.GaloisKey, err error)
- func (pkb *MemoryKeyStore) GetRelinearizationKey(ctx context.Context) (rlk *rlwe.RelinearizationKey, err error)
- type NodeAddress
- type NodeID
- type NodeInfo
- type NodesList
- type PublicKeyProvider
- type SessionID
- type TestKeyProvider
- func (tkb *TestKeyProvider) GetCollectivePublicKey(ctx context.Context) (*rlwe.PublicKey, error)
- func (tkb *TestKeyProvider) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
- func (tkb *TestKeyProvider) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
- type URL
Constants ¶
This section is empty.
Variables ¶
var ( // CtxSessionID is the context key for the session ID. // Helium contexts must always have a session id. CtxSessionID ctxKey = "session_id" // CtxCircuitID is the context key for the circuit ID. // The circuit ID is optional and is only present in the context // of a circuit execution. CtxCircuitID ctxKey = "circuit_id" )
Functions ¶
func ContextWithCircuitID ¶
ContextWithCircuitID returns a new context derived from ctx with the given session ID.
func NewBackgroundContext ¶
NewBackgroundContext returns a new context derived from context.Background with the given session and circuit IDs.
Types ¶
type CachedKeyBackend ¶
type CachedKeyBackend struct {
sync.Mutex // TODO: could be more clever
MemoryKeyStore
PublicKeyProvider
}
CachedKeyBackend is a PublicKeyProvider queries a PublicKeyProvider for keys and caches them. The cached keys are cached indefinitely. This implementation is blocking if the underlying PublicKeyProvider is blocking. It returns an error if the underlying PublicKeyProvider returns an error. The implementation is safe for concurrent use.
func NewCachedPublicKeyBackend ¶
func NewCachedPublicKeyBackend(kb PublicKeyProvider) (ckb *CachedKeyBackend)
NewCachedPublicKeyBackend creates a new CachedKeyBackend for the given PublicKeyProvider. The function panics if kb is nil.
func (*CachedKeyBackend) GetCollectivePublicKey ¶
GetCollectivePublicKey returns the collective public key for the session in ctx. The method returns an error if the key is not in the store and the underlying PublicKeyProvider returns an error.
func (*CachedKeyBackend) GetGaloisKey ¶
func (ckb *CachedKeyBackend) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
GetGaloisKey returns the galois key for the session in ctx and the given Galois element. The method returns an error if the key is not in the store and the underlying PublicKeyProvider returns an error.
func (*CachedKeyBackend) GetRelinearizationKey ¶
func (ckb *CachedKeyBackend) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
GetRelinearizationKey returns the relinearization key for the session in ctx. The method returns an error if the key is not in the store and the underlying PublicKeyProvider returns an error.
type Ciphertext ¶
type Ciphertext struct {
rlwe.Ciphertext
CiphertextMetadata
}
Ciphertext is a type for ciphertext within the helium framework.
type CiphertextID ¶
type CiphertextID string
type CiphertextMetadata ¶
type CiphertextMetadata struct {
ID CiphertextID
Type CiphertextType
}
CiphertextMetadata contains information on ciphertexts. In the current bgv-specific implementation, the type is not used.
type CiphertextType ¶
type CiphertextType int
CiphertextType is an enumerated type for the types of ciphertexts.
const ( // Unspecified is the default value for the type of a ciphertext. Unspecified CiphertextType = iota // BFV is the type of a ciphertext in the BFV scheme. BFV // BGV is the type of a ciphertext in the BGV scheme. BGV // CKKS is the type of a ciphertext in the CKKS scheme. CKKS // RGSW is the type of a ciphertext in the RGSW scheme. RGSW )
func (CiphertextType) String ¶
func (ctt CiphertextType) String() string
String returns a string representation of the ciphertext type.
type MemoryKeyStore ¶
type MemoryKeyStore struct {
*rlwe.PublicKey
GaloisKeys map[uint64]*rlwe.GaloisKey
*rlwe.RelinearizationKey
}
MemoryKeyStore is a simple in-memory implementation of PublicKeyProvider. This implementation is non-blocking and returns an error if the keys are not available.
func (*MemoryKeyStore) GetCollectivePublicKey ¶
func (pkb *MemoryKeyStore) GetCollectivePublicKey(ctx context.Context) (cpk *rlwe.PublicKey, err error)
GetCollectivePublicKey returns the collective public key for the session in ctx. If the public key is not in the store, it returns an error.
func (*MemoryKeyStore) GetGaloisKey ¶
func (pkb *MemoryKeyStore) GetGaloisKey(ctx context.Context, galEl uint64) (gk *rlwe.GaloisKey, err error)
GetGaloisKey returns the galois key for the session in ctx and the given Galois element. If the galois key is not in the store, it returns an error.
func (*MemoryKeyStore) GetRelinearizationKey ¶
func (pkb *MemoryKeyStore) GetRelinearizationKey(ctx context.Context) (rlk *rlwe.RelinearizationKey, err error)
GetRelinearizationKey returns the relinearization key for the session in ctx. If the relinearization key is not in the store, it returns an error.
type NodeAddress ¶
type NodeAddress string
NodeAddress is the network address of a node.
func (NodeAddress) String ¶
func (na NodeAddress) String() string
String returns a string representation of the node address.
type NodeInfo ¶
type NodeInfo struct {
NodeID
NodeAddress
}
NodeInfo contains the unique identifier and the network address of a node.
type NodesList ¶
type NodesList []NodeInfo
NodesList is a list of known nodes in the network. It must contains all nodes for a given application, including the current node. It does not need to contain an address for all nodes, except for the helper node.
func (NodesList) AddressOf ¶
func (nl NodesList) AddressOf(id NodeID) NodeAddress
AddressOf returns the network address of the node with the given ID. Returns an empty string if the node is not found in the list.
type PublicKeyProvider ¶
type PublicKeyProvider interface {
// GetCollectivePublicKey returns the collective public key for the session in ctx.
GetCollectivePublicKey(ctx context.Context) (*rlwe.PublicKey, error)
// GetGaloisKey returns the galois key for the session in ctx and the given Galois element.
GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
// GetRelinearizationKey returns the relinearization key for the session in ctx.
GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
}
PublicKeyProvider is an interface for retrieving public keys. Implementations return the keys for the session provided in the context. It is not specified whether implementations should block or return an error if the keys are not available.
Notable implementations of this interface are setup.Service, and key stores like MemoryKeyStore and the CachedkeyStore.
type TestKeyProvider ¶
type TestKeyProvider struct {
// contains filtered or unexported fields
}
TestKeyProvider is an implementation of a PublicKeyProvider that generates the keys on the fly, and is used for testing purposes. The implementation is not safe for concurrent use.
func NewTestKeyBackend ¶
func NewTestKeyBackend(params rlwe.Parameters, skIdeal *rlwe.SecretKey) *TestKeyProvider
NewTestKeyBackend creates a new TestKeyProvider for the given parameters and ideal secret key.
func (*TestKeyProvider) GetCollectivePublicKey ¶
GetCollectivePublicKey returns the collective public key for the session in ctx.
func (*TestKeyProvider) GetGaloisKey ¶
func (tkb *TestKeyProvider) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
GetGaloisKey returns the galois key for the session in ctx and the given Galois element.
func (*TestKeyProvider) GetRelinearizationKey ¶
func (tkb *TestKeyProvider) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
GetRelinearizationKey returns the relinearization key for the session in ctx.
type URL ¶
URL defines a URL format to serve as ciphertext identifier for the Helium framwork.
func (*URL) CiphertextBaseID ¶
func (u *URL) CiphertextBaseID() CiphertextID
func (*URL) CiphertextID ¶
func (u *URL) CiphertextID() CiphertextID
func (*URL) CircuitID ¶
CircuitID returns the circuit id part of the URL, if any. Returns the empty string if no circuit id is present.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package circuits provides the types and interfaces for defining, parsing and executing circuits.
|
Package circuits provides the types and interfaces for defining, parsing and executing circuits. |
|
Package coordinator provides types and methods for the coordination of Helium nodes.
|
Package coordinator provides types and methods for the coordination of Helium nodes. |
|
examples
|
|
|
vec-mul
command
|
|
|
Package node provides the main entry point for the Helium library.
|
Package node provides the main entry point for the Helium library. |
|
Package objectstore defines an interface between the helium services and the session data.
|
Package objectstore defines an interface between the helium services and the session data. |
|
Package protocols implements the MHE protocol execution.
|
Package protocols implements the MHE protocol execution. |
|
services
|
|
|
compute
Package compute implements the MHE compute phase as a service.
|
Package compute implements the MHE compute phase as a service. |
|
setup
Package setup implements the MHE setup phase as a service.
|
Package setup implements the MHE setup phase as a service. |
|
Package session implements helium sessions.
|
Package session implements helium sessions. |
|
transport
|
|
|
centralized
Package centralized defines a client-server-based transport for the helium services.
|
Package centralized defines a client-server-based transport for the helium services. |
|
Package utils defines a set of utility functions and types used across the helium project.
|
Package utils defines a set of utility functions and types used across the helium project. |
|
certs
Package certs provides utility functions for managing certificates.
|
Package certs provides utility functions for managing certificates. |