core

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Auth             auth.AuthService
	ServiceHandler   service.Handler
	LightningManager lightning.LightningManager
	Id               id.Identity
	KeyManager       key.KeyManager
	DBManager        state.DBManager
	ContactsManager  contacts.Contacts
	MessageManager   messages.MessageManager
	DIDComm          comm.DIDComm
	GlobalConfig     config.GlobalConfig
	KvManager        kv.KvManager
}

type Core

type Core interface {
	// Start will start the IMP core
	Start() error

	// Stop will stop the IMP core
	Stop() error

	// GetKey gets a value
	GetKey(key string) (string, error)

	// SetKey sets a key with a value
	SetKey(key string, value string) error

	// DelKey deletes a key
	DelKey(key string) error

	// GetMessages gets all of the saved messages
	GetMessages() ([]*messages.MessageInfo, error)

	// DeleteMessage deletes a saved message
	DeleteMessage(string, string) error

	// SendMessage is an extension of KeySend for sending data to dest pub key.
	SendMessage(message string, toDid string, amt int64, replyToId string) (string, error)

	// SendMessageV2 will send a DIDComm formatted message to another DID.
	SendMessageV2(body string, didCommType string, dids []string, amt int64, replyToId string, groupId string, settings *comm.MessageSettings) (string, error)

	// SavveMessage will save a message to the database
	SaveMessage(body string, didCommType string, dids []string, from string, replyToId string, groupId string) (string, error)

	// SignMessage will sign a message with a lightning node.
	SignMessage([]byte) ([]byte, error)

	// GenerateInvoice will generate an invoice for a specific amount
	// and memo. Returns the pay request.
	GenerateInvoice(int64, string) (string, error)

	// PayInvoice will pay a specific pay request invoice and returns preimage.
	PayInvoice(string) (string, error)

	// CheckInvoice will check a specific pay request invoice and returns true or false.
	CheckInvoice(string) (bool, error)

	// LightningStatus will check the status of the Lightning nodes configured.
	CheckLightningStatus() ([]lightning.NodeStatus, error)

	// GetChannels Get the channels from the connected LND node
	GetChannels() (int64, error)

	// ListPayments Get the payments from the connected LND node
	ListPayments() (string, error)

	// ListInvoices Get the invoices from the connected LND node
	ListInvoices() (string, error)

	// ResolveDID resolves a DID URI and returns back a DID Document and long form did
	ResolveDID(did string) (*did.Doc, string, error)

	// ListDID lists DID documents stored locally
	ListDID() ([]*did.Doc, error)

	// CreateDID will create a DID with the given info and save to DB
	CreateDID(didType string, serviceEndpoints []id.Service) (*id.DIDUpdateInfo, error)

	// DeleteDID will delete a DID with a given id
	DeleteDID(did string) error

	// BackupDID returns the DID backup information
	BackupDID(did string) (*id.DIDUpdateInfo, error)

	// RecoverDID recovers a DID with the recovery kit
	RecoverDID(*id.DIDUpdateInfo, string, string) error

	// ImportDID will import a DID belonging to the user
	ImportDID(document, longFormDID string) error

	// UpdateDID will update a DID with a patch document
	UpdateDID(document string) (*id.DIDUpdateInfo, error)

	//
	// Communication Commands
	//
	// GetWebsocketConnections will get all the DIDs that the daemon is connected to via websockets
	GetWebsocketConnections() ([]string, error)

	// SendRegistrationRequest will send a registration request to a relay node
	SendRegistrationRequest(toDID string, amt int64, data *relay.RelayRegistrationRequestData) (string, error)

	// SendMailboxRequest will send a mailbox request to a relay node
	SendMailboxRequest(toDID string, amt int64, data *relay.RelayMailboxRequestData) (string, error)

	// InitSeed will initialize the key manager with a master seed and initial api key
	InitSeed(seedImport string, passphrase string) (string, string, error)

	// UnlockSeed will unlock the key manager with the master seed encryption passphrase
	UnlockSeed(passphrase string) (string, error)

	// GetSeed will get the mnemonic seed phrase
	GetSeed() (string, error)

	KeyStatus() (string, error)

	contacts.Contacts

	CreateContacts([]*contacts.ContactInfo) ([]*contacts.ContactInfo, error)

	// Get a lightning node from the daemon config
	GetLightningNodeConfig() (config.Lnd, error)

	// Save a lightning node to the daemon config
	SaveLightningNodeConfig(node config.Lnd) error

	// Get a ion node from the daemon config
	GetIONConfig() (config.ION, error)

	// Save an ION node to the daemon config
	SaveIONConfig(ionNode config.ION) error

	// GenerateNewKey generates a new API key
	GenerateNewKey(name, description string) (*auth_state.AuthStateModel, error)

	// ListKeys will list API keys
	ListKeys() ([]*auth_state.AuthStateModel, error)

	// UpdateKey will update the name or description of a key
	UpdateKey(id int64, name, description string) error

	// DeleteKey will delete an api key
	DeleteKey(id int64) error
}

func NewImpCore

func NewImpCore(cfg *Config) (Core, error)

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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