Documentation ¶
Index ¶
- Constants
- func DecodeKey(b string) ([]byte, error)
- func DefaultBoostrapPeers() (peers []peer.AddrInfo, err error)
- func EncodeKey(b []byte) string
- type Config
- type Identity
- type LibP2PIdentity
- func (p *LibP2PIdentity) GetPublic() PubKey
- func (p *LibP2PIdentity) GetPublicDB() db.PublicKeyDB
- func (p *LibP2PIdentity) MarshalBinary() ([]byte, error)
- func (p *LibP2PIdentity) Raw() ([]byte, error)
- func (p *LibP2PIdentity) Sign(data []byte) ([]byte, error)
- func (p *LibP2PIdentity) UnmarshalBinary(data []byte) error
- type LibP2PPubKey
- type NewSpecterOption
- type NewSpecterOptions
- type PubKey
- type Specter
- type SpecterDB
- func (s *SpecterDB) GetID() db.InstanceID
- func (s *SpecterDB) GetPubKey() string
- func (s *SpecterDB) Init() error
- func (s *SpecterDB) MarshalBinary() ([]byte, error)
- func (s *SpecterDB) Raw() ([]byte, error)
- func (s *SpecterDB) SetID(id db.InstanceID)
- func (s *SpecterDB) SignInstance(pk db.PrivateKeyDB) (err error)
- func (s *SpecterDB) UnmarshalBinary(data []byte) error
- func (s *SpecterDB) Verify(data []byte, sigBytes []byte) (bool, error)
- func (s *SpecterDB) VerifyInstance(pk db.PublicKeyDB) (bool, error)
- type Specters
- func (s *Specters) ClusterID() string
- func (s *Specters) GetSpecterByPubKey(pk string) (specter Specter, err error)
- func (s *Specters) GetToken(specter Specter) (string, error)
- func (s *Specters) HasSpecters() (bool, error)
- func (s *Specters) Init(pk []byte) ([][]byte, error)
- func (s *Specters) IsInitialized() bool
- func (s *Specters) IsSealed() bool
- func (s *Specters) SetIdentity(identity Identity)
- func (s *Specters) Unseal(part []byte) error
- func (s *Specters) UnsealProgress() int
- func (s *Specters) Version() string
Constants ¶
const ShamirParts = 5
ShamirParts is the number of parts generating by shamir algorithm
const ShamirThreshold = 3
ShamirThreshold is the necessary number of parts for unsealing process
Variables ¶
This section is empty.
Functions ¶
func DefaultBoostrapPeers ¶
DefaultBoostrapPeers returns the default bootstrap peers for Specters
Types ¶
type Identity ¶
type Identity interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler db.PrivateKeyDB // Raw returns the raw bytes of the key (not wrapped in the // libp2p-crypto protobuf). // // This function is the inverse of {Priv,Pub}KeyUnmarshaler. Raw() ([]byte, error) // Sign the given bytes cryptographically. Sign([]byte) ([]byte, error) // GetPublic returns the public key paired with this identity. GetPublic() PubKey }
Identity represents an entity capable of signing a message and returning the associated public key for verification.
func NewLibP2PIdentity ¶
NewLibP2PIdentity returns a new LibP2PIdentity.
func UnmarshalLibP2PIdentity ¶
UnmarshalLibP2PIdentity converts a protobuf serialized LibP2PIdentity into its representative object
type LibP2PIdentity ¶
LibP2PIdentity wraps crypto.PrivKey, overwriting GetPublic with specters.PubKey.
func (*LibP2PIdentity) GetPublic ¶
func (p *LibP2PIdentity) GetPublic() PubKey
GetPublic returns the public key paired with this identity.
func (*LibP2PIdentity) GetPublicDB ¶
func (p *LibP2PIdentity) GetPublicDB() db.PublicKeyDB
GetPublicDB returns the public key DB paired with this identity.
func (*LibP2PIdentity) MarshalBinary ¶
func (p *LibP2PIdentity) MarshalBinary() ([]byte, error)
MarshalBinary converts an identity object into its protobuf serialized form.
func (*LibP2PIdentity) Raw ¶
func (p *LibP2PIdentity) Raw() ([]byte, error)
Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).
This function is the inverse of {Priv,Pub}KeyUnmarshaler.
func (*LibP2PIdentity) Sign ¶
func (p *LibP2PIdentity) Sign(data []byte) ([]byte, error)
Sign the given bytes cryptographically.
func (*LibP2PIdentity) UnmarshalBinary ¶
func (p *LibP2PIdentity) UnmarshalBinary(data []byte) error
UnmarshalBinary converts a protobuf serialized identity into its representative object
type LibP2PPubKey ¶
LibP2PPubKey wraps crypto.PubKey.
func (*LibP2PPubKey) MarshalBinary ¶
func (p *LibP2PPubKey) MarshalBinary() ([]byte, error)
MarshalBinary converts an identity object into its protobuf serialized form.
func (*LibP2PPubKey) Raw ¶
func (p *LibP2PPubKey) Raw() ([]byte, error)
Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).
This function is the inverse of {Priv,Pub}KeyUnmarshaler.
func (*LibP2PPubKey) UnmarshalBinary ¶
func (p *LibP2PPubKey) UnmarshalBinary(data []byte) error
UnmarshalBinary converts a protobuf serialized identity into its representative object
type NewSpecterOption ¶
type NewSpecterOption func(*NewSpecterOptions)
NewSpecterOption specifies a new Specter option.
func WithAlias ¶
func WithAlias(alias string) NewSpecterOption
WithAlias provides control over alias for Specter.
type NewSpecterOptions ¶
type NewSpecterOptions struct {
Alias string
}
NewSpecterOptions defines options for creating a new Specter.
type PubKey ¶
type PubKey interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler // Raw returns the raw bytes of the key (not wrapped in the // libp2p-crypto protobuf). // // This function is the inverse of {Priv,Pub}KeyUnmarshaler. Raw() ([]byte, error) // Verify that 'sig' is the signed hash of 'data' Verify([]byte, []byte) (bool, error) }
PubKey can be anything that provides a verify method.
func NewLibP2PPubKey ¶
NewLibP2PPubKey returns a new PubKey.
func UnmarshalLibP2PPubKey ¶
UnmarshalLibP2PPubKey converts a protobuf serialized LibP2PPubKey into its representative object
type Specter ¶
type Specter interface { PubKey db.InstanceDB // Init initializes the keys Init() error // GetPubKey gets the public key GetPubKey() string }
Specter is an app interface for Specter identity
func NewSpecterDB ¶
func NewSpecterDB(pk string, opts ...NewSpecterOption) (s Specter, err error)
NewSpecterDB creates a new instance of SpecterDB
type SpecterDB ¶
type SpecterDB struct { ID string `json:"_id"` PubKey string `json:"public_key"` Alias string `json:"alias"` CreatedAt int64 `json:"created_at"` Signature string `json:"signature"` // contains filtered or unexported fields }
SpecterDB is Textile Threads DB specter identity
func (*SpecterDB) MarshalBinary ¶
MarshalBinary converts an identity object into its protobuf serialized form.
func (*SpecterDB) Raw ¶
Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).
This function is the inverse of {Priv,Pub}KeyUnmarshaler.
func (*SpecterDB) SetID ¶
func (s *SpecterDB) SetID(id db.InstanceID)
SetID sets the ID on InstanceDB
func (*SpecterDB) SignInstance ¶
func (s *SpecterDB) SignInstance(pk db.PrivateKeyDB) (err error)
SignInstance the given instance cryptographically.
func (*SpecterDB) UnmarshalBinary ¶
UnmarshalBinary converts a protobuf serialized identity into its representative object
func (*SpecterDB) VerifyInstance ¶
func (s *SpecterDB) VerifyInstance(pk db.PublicKeyDB) (bool, error)
VerifyInstance that 'sig' is the signed hash of instance
type Specters ¶
type Specters struct {
// contains filtered or unexported fields
}
Specters is an app for specters orchestration
func NewSpecters ¶
func NewSpecters(ctx context.Context, clusterID string, version string, db db.DB, config Config) (*Specters, error)
NewSpecters creates a new instance of Specters
func (*Specters) GetSpecterByPubKey ¶
GetSpecterByPubKey returns a registered Specter identity from a public key
func (*Specters) HasSpecters ¶
HasSpecters returns if at least one specter exists
func (*Specters) IsInitialized ¶
IsInitialized returns if Specters is already initialized
func (*Specters) SetIdentity ¶
SetIdentity set the identity for the Specters manager
func (*Specters) Unseal ¶
Unseal set a part to unseal the master key and set it if the enough parts are set
func (*Specters) UnsealProgress ¶
UnsealProgress gets the number of parts provided to unseal the Specters manager