Documentation
¶
Index ¶
- Constants
- type DAEncryptionService
- type EnclaveAttestedKeyService
- func (eks *EnclaveAttestedKeyService) Decrypt(encBytes []byte) ([]byte, error)
- func (eks *EnclaveAttestedKeyService) EnclaveID() common.EnclaveID
- func (eks *EnclaveAttestedKeyService) Encrypt(encBytes []byte) ([]byte, error)
- func (eks *EnclaveAttestedKeyService) GenerateEnclaveKey() ([]byte, error)
- func (eks *EnclaveAttestedKeyService) PublicKey() *ecdsa.PublicKey
- func (eks *EnclaveAttestedKeyService) PublicKeyBytes() []byte
- func (eks *EnclaveAttestedKeyService) SetEnclaveKey(keyBytes []byte)
- func (eks *EnclaveAttestedKeyService) Sign(payload gethcommon.Hash) ([]byte, error)
- type EvmEntropyService
- type RPCKeyService
- type SharedEnclaveSecret
- type SharedSecretService
- func (sss *SharedSecretService) EncryptSecretWithKey(pubKey []byte) (common.EncryptedSharedEnclaveSecret, error)
- func (sss *SharedSecretService) ExtendEntropy(extra []byte) []byte
- func (sss *SharedSecretService) GenerateSharedSecret()
- func (sss *SharedSecretService) IsGenesis() bool
- func (sss *SharedSecretService) IsInitialised() bool
- func (sss *SharedSecretService) Secret() *SharedEnclaveSecret
- func (sss *SharedSecretService) SetSharedSecret(ss *SharedEnclaveSecret)
Constants ¶
const (
// GCMNonceLength is the nonce's length in bytes for encrypting and decrypting transactions.
GCMNonceLength = 12
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAEncryptionService ¶ added in v1.0.0
type DAEncryptionService struct {
// contains filtered or unexported fields
}
DAEncryptionService - handles encryption/decryption of the data stored in the DA layer
func NewDAEncryptionService ¶ added in v1.0.0
func NewDAEncryptionService(sharedSecretService *SharedSecretService, logger gethlog.Logger) *DAEncryptionService
func (*DAEncryptionService) Decrypt ¶ added in v1.0.0
func (t *DAEncryptionService) Decrypt(blob []byte) ([]byte, error)
func (*DAEncryptionService) Encrypt ¶ added in v1.0.0
func (t *DAEncryptionService) Encrypt(blob []byte) ([]byte, error)
func (*DAEncryptionService) Initialise ¶ added in v1.0.0
func (t *DAEncryptionService) Initialise() error
type EnclaveAttestedKeyService ¶ added in v1.0.0
type EnclaveAttestedKeyService struct {
// contains filtered or unexported fields
}
EnclaveAttestedKeyService manages the attestation key - including
func NewEnclaveAttestedKeyService ¶ added in v1.0.0
func NewEnclaveAttestedKeyService(logger gethlog.Logger) *EnclaveAttestedKeyService
func (*EnclaveAttestedKeyService) Decrypt ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) Decrypt(encBytes []byte) ([]byte, error)
func (*EnclaveAttestedKeyService) EnclaveID ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) EnclaveID() common.EnclaveID
func (*EnclaveAttestedKeyService) Encrypt ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) Encrypt(encBytes []byte) ([]byte, error)
func (*EnclaveAttestedKeyService) GenerateEnclaveKey ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) GenerateEnclaveKey() ([]byte, error)
func (*EnclaveAttestedKeyService) PublicKey ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) PublicKey() *ecdsa.PublicKey
func (*EnclaveAttestedKeyService) PublicKeyBytes ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) PublicKeyBytes() []byte
func (*EnclaveAttestedKeyService) SetEnclaveKey ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) SetEnclaveKey(keyBytes []byte)
func (*EnclaveAttestedKeyService) Sign ¶ added in v1.0.0
func (eks *EnclaveAttestedKeyService) Sign(payload gethcommon.Hash) ([]byte, error)
type EvmEntropyService ¶ added in v1.0.0
type EvmEntropyService struct {
// contains filtered or unexported fields
}
EvmEntropyService - generates the entropy that is injected into the EVM - unique for each transaction
func NewEvmEntropyService ¶ added in v1.0.0
func NewEvmEntropyService(sc *SharedSecretService, logger gethlog.Logger) *EvmEntropyService
func (*EvmEntropyService) BatchEntropy ¶ added in v1.0.0
func (ees *EvmEntropyService) BatchEntropy(batch *common.BatchHeader) gethcommon.Hash
BatchEntropy - calculates entropy per batch In Ten, we use a root entropy per batch, which is then used to calculate randomness exposed to individual transactions The RootBatchEntropy is calculated based on the shared secret, the batch height and the timestamp This ensures that sibling batches will naturally use the same root entropy so that transactions will have the same results
func (*EvmEntropyService) TxEntropy ¶ added in v1.0.0
func (ees *EvmEntropyService) TxEntropy(rootBatchEntropy []byte, tCount int) gethcommon.Hash
TxEntropy - calculates the randomness exposed to individual transactions In TEN, each tx has its own independent randomness, because otherwise a malicious transaction from the same batch could reveal information.
type RPCKeyService ¶ added in v1.0.0
type RPCKeyService struct {
// contains filtered or unexported fields
}
RPCKeyService - manages the "TEN - RPC key" used by clients (like the TEN gateway) to make RPC requests
func NewRPCKeyService ¶ added in v1.0.0
func NewRPCKeyService(sharedSecretService *SharedSecretService, logger gethlog.Logger) *RPCKeyService
func (*RPCKeyService) DecryptRPCRequest ¶ added in v1.0.0
func (s *RPCKeyService) DecryptRPCRequest(bytes []byte) ([]byte, error)
func (*RPCKeyService) Initialise ¶ added in v1.0.0
func (s *RPCKeyService) Initialise() error
Initialise - called when the shared secret is available
func (*RPCKeyService) PublicKey ¶ added in v1.0.0
func (s *RPCKeyService) PublicKey() ([]byte, error)
type SharedEnclaveSecret ¶
type SharedEnclaveSecret [sharedSecretLenInBytes]byte
SharedEnclaveSecret - the entropy
type SharedSecretService ¶ added in v1.0.0
type SharedSecretService struct {
// contains filtered or unexported fields
}
SharedSecretService provides functionality to encapsulate, generate, extend, and encrypt the shared secret of the TEN network.
func NewSharedSecretService ¶ added in v1.0.0
func NewSharedSecretService(logger gethlog.Logger) *SharedSecretService
func (*SharedSecretService) EncryptSecretWithKey ¶ added in v1.0.0
func (sss *SharedSecretService) EncryptSecretWithKey(pubKey []byte) (common.EncryptedSharedEnclaveSecret, error)
func (*SharedSecretService) ExtendEntropy ¶ added in v1.0.0
func (sss *SharedSecretService) ExtendEntropy(extra []byte) []byte
ExtendEntropy derives more entropy from the shared secret
func (*SharedSecretService) GenerateSharedSecret ¶ added in v1.0.0
func (sss *SharedSecretService) GenerateSharedSecret()
GenerateSharedSecret - called only by the genesis
func (*SharedSecretService) IsGenesis ¶ added in v1.0.0
func (sss *SharedSecretService) IsGenesis() bool
func (*SharedSecretService) IsInitialised ¶ added in v1.0.0
func (sss *SharedSecretService) IsInitialised() bool
func (*SharedSecretService) Secret ¶ added in v1.0.0
func (sss *SharedSecretService) Secret() *SharedEnclaveSecret
Secret - should only be used before storing it
func (*SharedSecretService) SetSharedSecret ¶ added in v1.0.0
func (sss *SharedSecretService) SetSharedSecret(ss *SharedEnclaveSecret)