internal

package
v0.0.0-...-a0d1ad3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthorization

func NewAuthorization(ctx context.Context) *authorization

func Run

func Run() error

Types

type AuthorizationHandler

type AuthorizationHandler interface {
	// Authorization Connect to the account system to verify the username and first name password and
	// return the authorization result.
	Authorization(username, password string) (*account.VerifyResponse, error)

	SetPublicKey(accountId uint, publicKey string) error
	// AddDevice Add a device to the device system.
	AddDevice(accountId int64, ua string) (*device.CreateResponse, error)
}

type Auths

type Auths struct {
	gorm.Model

	AccountId uint   `gorm:"primaryKey;bigint;account_id"`
	PublicKey string `gorm:"type:text;public_key"`
}

func NewAuths

func NewAuths(accountId uint, publicKey string) *Auths

type DH

type DH interface {
	GetPrivateKey() error
	GetDH() (*Dh, error)
	SendPrivateKey() error
}

type Dh

type Dh struct {
	DeviceId       uint
	ObjectDeviceId uint
	IV             string
	PublicKey      string
	PrivateKey     string
}

func NewDHDeviceId

func NewDHDeviceId(deviceId uint) *Dh

func NewDh

func NewDh(deviceId uint, objectDeviceId uint, IV string, publicKey string) *Dh

func (*Dh) GetDH

func (dh *Dh) GetDH() (*Dh, error)

func (*Dh) GetPrivateKey

func (dh *Dh) GetPrivateKey() error

func (*Dh) SendPrivateKey

func (dh *Dh) SendPrivateKey(privateKey string) error

Jump to

Keyboard shortcuts

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