Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identifier ¶
type Identifier interface {
Identity() string
}
Identifier is the interface that defines how an object can be used as an identity
type IdentityManager ¶
type IdentityManager interface {
// Store returns the key store kind
StoreKind() string
// NodeID returns the node id (public key)
NodeID() StrIdentifier
// FarmID return the farm id this node is part of. this is usually a configuration
// that the node is booted with. An error is returned if the farmer id is not configured
FarmID() pkg.FarmID
// Farm returns name of the farm. Or error
Farm() (string, error)
// FarmSecret get the farm secret as defined in the boot params
FarmSecret() string
// Sign signs the message with privateKey and returns a signature.
Sign(message []byte) ([]byte, error)
// Verify reports whether sig is a valid signature of message by publicKey.
Verify(message, sig []byte) error
// Encrypt encrypts message with the public key of the node
Encrypt(message []byte) ([]byte, error)
// Decrypt decrypts message with the private of the node
Decrypt(message []byte) ([]byte, error)
// EncryptECDH aes encrypt msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm
// the nonce if prepended to the encrypted message
EncryptECDH(msg []byte, publicKey []byte) ([]byte, error)
// DecryptECDH decrypt aes encrypted msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm
DecryptECDH(msg []byte, publicKey []byte) ([]byte, error)
// PrivateKey sends the keypair
PrivateKey() []byte
}
IdentityManager interface.
type RegistrarGateway ¶
type RegistrarGateway interface {
CreateNode(node types.UpdateNodeRequest) (uint64, error)
CreateTwin(relay string, pk []byte) (types.Account, error)
EnsureAccount(pk []byte) (twin types.Account, err error)
GetContract(id uint64) (substrate.Contract, pkg.SubstrateError)
GetContractIDByNameRegistration(name string) (uint64, pkg.SubstrateError)
GetNodeRentContract(node uint32) (uint64, pkg.SubstrateError)
GetFarm(id uint64) (types.Farm, error)
GetNode(id uint64) (types.Node, error)
GetNodeByTwinID(twin uint64) (uint64, error)
GetNodeContracts(node uint32) ([]substrateTypes.U64, error)
GetNodes(farmID uint32) ([]uint32, error)
GetPowerTarget() (power substrate.NodePower, err error)
GetTwin(id uint64) (types.Account, error)
GetTwinByPubKey(pk []byte) (uint64, error)
Report(consumptions []substrate.NruConsumption) (substrateTypes.Hash, error)
SetContractConsumption(resources ...substrate.ContractResources) error
SetNodePowerState(up bool) (hash substrateTypes.Hash, err error)
UpdateNode(node types.UpdateNodeRequest) (uint64, error)
UpdateNodeUptimeV2(uptime uint64, timestampHint uint64) (err error)
GetTime() (time.Time, error)
GetZosVersion() (string, error)
}
type StrIdentifier ¶
type StrIdentifier string
StrIdentifier is a helper type that implement the Identifier interface on top of simple string
func (StrIdentifier) Identity ¶
func (s StrIdentifier) Identity() string
Identity implements the Identifier interface
Directories
¶
| Path | Synopsis |
|---|---|
|
Package provision exposes the Engine type.
|
Package provision exposes the Engine type. |
Click to show internal directories.
Click to hide internal directories.