sharedsecret

package
v0.26.0-alpha.42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2019 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PersistenceService

type PersistenceService interface {
	// Add adds a shared secret, associated with an identity and an installationID
	Add(identity []byte, secret []byte, installationID string) error
	// Get returns a shared secret associated with multiple installationIDs
	Get(identity []byte, installationIDs []string) (*Response, error)
	// All returns an array of shared secrets, each one of them represented
	// as a byte array
	All() ([][][]byte, error)
}

type Response

type Response struct {
	// contains filtered or unexported fields
}

type SQLLitePersistence

type SQLLitePersistence struct {
	// contains filtered or unexported fields
}

func NewSQLLitePersistence

func NewSQLLitePersistence(db *sql.DB) *SQLLitePersistence

func (*SQLLitePersistence) Add

func (s *SQLLitePersistence) Add(identity []byte, secret []byte, installationID string) error

func (*SQLLitePersistence) All

func (s *SQLLitePersistence) All() ([][][]byte, error)

func (*SQLLitePersistence) Get

func (s *SQLLitePersistence) Get(identity []byte, installationIDs []string) (*Response, error)

type Secret

type Secret struct {
	Identity *ecdsa.PublicKey
	Key      []byte
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(persistence PersistenceService) *Service

func (*Service) All

func (s *Service) All() ([]*Secret, error)

func (*Service) Receive

func (s *Service) Receive(myPrivateKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, installationID string) (*Secret, error)

Receive will generate a shared secret for a given identity, and return it

func (*Service) Send

func (s *Service) Send(myPrivateKey *ecdsa.PrivateKey, myInstallationID string, theirPublicKey *ecdsa.PublicKey, theirInstallationIDs []string) (*Secret, bool, error)

Send returns a shared key and whether it has been acknowledged from all the installationIDs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL