Documentation ¶
Index ¶
- type Config
- type DB
- type InstanceDB
- type InstanceID
- type PrivateKeyDB
- type PublicKeyDB
- type ThreadsDB
- func (t *ThreadsDB) Close() error
- func (t *ThreadsDB) CreateSpecter(specter InstanceDB, privateKey PrivateKeyDB) (InstanceID, error)
- func (t *ThreadsDB) CreateSpecters(ctx context.Context, specter InstanceDB) error
- func (t *ThreadsDB) GetSpecter(pubKey string, specter InstanceDB, publicKey PublicKeyDB) (InstanceDB, error)
- func (t *ThreadsDB) HasSpecters() (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Close closes DB Close() error // CreateSpecters creates the Specters DB if it doesn't exist CreateSpecters(context.Context, InstanceDB) error // GetSpecter gets a Specter from Specters DB GetSpecter(string, InstanceDB, PublicKeyDB) (InstanceDB, error) // HasSpecters returns if at least one specter exists HasSpecters() (bool, error) // CreateSpecter creates a Specter in Specters DB CreateSpecter(InstanceDB, PrivateKeyDB) (InstanceID, error) }
DB is an interface for specters storage
func NewThreadsDB ¶
func NewThreadsDB(store keytransform.TxnDatastoreExtended, network app.Net, config Config) (DB, error)
NewThreadsDB creates a new instance of ThreadsDB
type InstanceDB ¶
type InstanceDB interface { // GetID gets the ID of InstanceDB GetID() InstanceID // SetID sets the ID on InstanceDB SetID(InstanceID) // SignInstance the given instance cryptographically. SignInstance(PrivateKeyDB) error // VerifyInstance that 'sig' is the signed hash of instance VerifyInstance(PublicKeyDB) (bool, error) }
InstanceDB is an interface to sign and verify instances
type PrivateKeyDB ¶
type PrivateKeyDB interface { // Sign the given bytes cryptographically. Sign([]byte) ([]byte, error) // GetPublicDB returns the public key DB paired with this identity. GetPublicDB() PublicKeyDB }
PrivateKeyDB is an interface to sign
type PublicKeyDB ¶
type PublicKeyDB interface { // Verify that 'sig' is the signed hash of 'data' Verify([]byte, []byte) (bool, error) }
PublicKeyDB is an interface to verify
type ThreadsDB ¶
type ThreadsDB struct {
// contains filtered or unexported fields
}
ThreadsDB is an implementation of Db using Textile Threads
func (*ThreadsDB) CreateSpecter ¶
func (t *ThreadsDB) CreateSpecter(specter InstanceDB, privateKey PrivateKeyDB) (InstanceID, error)
CreateSpecter creates a Specter in Specters DB
func (*ThreadsDB) CreateSpecters ¶
func (t *ThreadsDB) CreateSpecters(ctx context.Context, specter InstanceDB) error
CreateSpecters creates the Specters DB if it doesn't exist
func (*ThreadsDB) GetSpecter ¶
func (t *ThreadsDB) GetSpecter(pubKey string, specter InstanceDB, publicKey PublicKeyDB) (InstanceDB, error)
GetSpecter gets a Specter from Specters DB
func (*ThreadsDB) HasSpecters ¶
HasSpecters returns if at least one specter exists
Click to show internal directories.
Click to hide internal directories.