Documentation ¶
Index ¶
- Constants
- Variables
- func AgentStorage(h int) api.AgentStorage
- func NewDoc(did core.DID, ae service.Addr) *sov.Doc
- func SetWalletMgrPoolSize(s int)
- type Agent
- type AgentType
- type Cache
- type DID
- func NewAgentDid(wallet managed.Wallet, f *async.Future) (ad *DID)
- func NewDIDWithRouting(_ string, verkey ...string) (d *DID)
- func NewDid(did, verkey string) (d *DID)
- func NewDidWithKeyFuture(wallet managed.Wallet, did string, verkey *async.Future) (d *DID)
- func NewOutDid(verkey string, route []string) (d *DID)
- func (d *DID) AEndp() (ae service.Addr, err error)
- func (d *DID) DOC() core.DIDDoc
- func (d *DID) Did() string
- func (d *DID) Endpoint() string
- func (d *DID) KID() string
- func (d *DID) KMS() *indy.KMS
- func (d *DID) NewDoc(ae service.Addr) core.DIDDoc
- func (d *DID) Packager() api.Packager
- func (d *DID) RecipientKeys() []string
- func (d *DID) Route() []string
- func (d *DID) SavePairwiseForDID(mStorage managed.Wallet, tDID core.DID, pw core.PairwiseMeta)
- func (d *DID) SetAEndp(ae service.Addr)
- func (d *DID) SetWallet(w managed.Wallet)
- func (d *DID) SignKey() any
- func (d *DID) StartEndp(storageH managed.Wallet, connectionID string)
- func (d *DID) Storage() managed.Wallet
- func (d *DID) Store(mgdWallet, mgdStorage managed.Wallet)
- func (d *DID) StoreResult() error
- func (d *DID) String() string
- func (d *DID) URI() string
- func (d *DID) VerKey() (vk string)
- func (d *DID) Wallet() int
- type DIDAgent
- func (a *DIDAgent) AddDIDCache(DID *DID)
- func (a *DIDAgent) AssertWallet()
- func (a *DIDAgent) CloseWallet()
- func (a *DIDAgent) ConnectionStorage() storage.ConnectionStorage
- func (a *DIDAgent) DIDStorage() storage.DIDStorage
- func (a *DIDAgent) FindPWByID(id string) (pw *storage.Connection, err error)
- func (a *DIDAgent) FindPWByName(name string) (pw *storage.Connection, err error)
- func (a *DIDAgent) IsCA() bool
- func (a *DIDAgent) IsEA() bool
- func (a *DIDAgent) IsWorker() bool
- func (a *DIDAgent) KMS() kms.KeyManager
- func (a *DIDAgent) LoadDID(did string) core.DID
- func (a *DIDAgent) LoadTheirDID(connection storage.Connection) core.DID
- func (a *DIDAgent) ManagedStorage() managed.Wallet
- func (a *DIDAgent) ManagedWallet() (managed.Wallet, managed.Wallet)
- func (a *DIDAgent) NewDID(didMethod method.Type, args ...string) (_ core.DID, err error)
- func (a *DIDAgent) NewOutDID(didInfo ...string) (id core.DID, err error)
- func (a *DIDAgent) OpenDID(name string) *DID
- func (a *DIDAgent) OpenPool(name string)
- func (a *DIDAgent) OpenWallet(aw Wallet)
- func (a *DIDAgent) Pool() (v int)
- func (a *DIDAgent) RootDid() core.DID
- func (a *DIDAgent) SAImplID() string
- func (a *DIDAgent) SaveTheirDID(did, vk string) (err error)
- func (a *DIDAgent) SendNYM(targetDid *DID, submitterDid, alias, role string) (err error)
- func (a *DIDAgent) SetRootDid(rootDid core.DID)
- func (a *DIDAgent) SetSAImplID(id string)
- func (a *DIDAgent) Storage() storage.AgentStorage
- func (a *DIDAgent) VDR() *vdr.VDR
- func (a *DIDAgent) Wallet() (h int)
- type DidComm
- type Handle
- type In
- type Mgr
- type Out
- type Type
- type Wallet
- func (w *Wallet) Close(handle int) (f *async.Future)
- func (w *Wallet) CloseWallet(handle int) (err error)
- func (w *Wallet) Create() (exist bool)
- func (w *Wallet) Exists(worker bool) bool
- func (w *Wallet) ID() string
- func (w *Wallet) Key() string
- func (w *Wallet) Open() (f *async.Future)
- func (w *Wallet) OpenWallet() (h int, err error)
- func (w *Wallet) SetID(id string)
- func (w *Wallet) SetKey(key string)
- func (w *Wallet) SetKeyMethod(m string)
- func (w *Wallet) UniqueID() string
- func (w *Wallet) WantsBackup() bool
- func (w Wallet) WorkerWallet() *Wallet
- func (w Wallet) WorkerWalletBy(suffix string) *Wallet
- type WalletMap
Constants ¶
const ( // Edge agents are the agents which are at the end of the agent route. They // are the final endpoint of the agent messages. In the agency we can have // pure EAs when CLI is used, or we can have Worker EAs which are working // together with their Cloud Agent. Edge = 0x01 // Worker is an Edge Agent in the Cloud. Workers are used to allow EAs to // have endpoints inside to identity domain. Worker EAs can be always on, // and listen their endpoints. These cloud EAs have their own wallets, // which can be copied to actual EA's device if needed. Worker = 0x02 )
Please be noted that Cloud Agent is the default value.
const WalletAlreadyExistsError = 203
Variables ¶
var ErrNoData = fmt.Errorf("no data")
Functions ¶
func AgentStorage ¶ added in v0.30.8
func AgentStorage(h int) api.AgentStorage
func SetWalletMgrPoolSize ¶ added in v0.25.24
func SetWalletMgrPoolSize(s int)
SetWalletMgrPoolSize sets pool size, i.e. how many wallets can kept open in the same time. This should be set at the startup of the application or service.
Types ¶
type Agent ¶
type Agent interface { AgentType Wallet() (h int) ManagedWallet() (managed.Wallet, managed.Wallet) RootDid() core.DID // CreateDID(seed string) (agentDid core.DID) NewDID(m method.Type, args ...string) (_ core.DID, err error) NewOutDID(didInfo ...string) (id core.DID, err error) SendNYM(targetDid *DID, submitterDid, alias, role string) error AddDIDCache(DID *DID) }
type Cache ¶
Cache is keeps DIDs in memory per agent because they are so slow to load from wallet. Cache is not thread safe because this is not a global cache but per Agent.
type DID ¶
type DID struct { sync.Mutex // when setting Future ptrs making sure that happens atomically // contains filtered or unexported fields }
DID is an application framework level wrapper for findy.DID implementation. Uses Future to async processing of the findy.Channel results.
func NewDIDWithRouting ¶ added in v0.30.9
func NewDidWithKeyFuture ¶
func (*DID) KID ¶ added in v0.30.4
KID returns a KMS specific key ID that can be used to Get KH from KMS.
func (*DID) RecipientKeys ¶ added in v0.30.15
func (*DID) SavePairwiseForDID ¶ added in v0.25.26
func (*DID) SignKey ¶ added in v0.30.4
SignKey return a indy.Handle including wallet SDK handle (int) and a VerKey TODO: Let's think if wee need a KID for there as well
func (*DID) Store ¶
Store stores this DID as their DID to given wallet. Work is done thru futures so the call doesn't block. The meta data is set "pairwise". See StoreResult() for status.
func (*DID) StoreResult ¶
StoreResult returns error status of the Store() functions result. If storing their DID and related meta and pairwise data isn't ready, this call blocks.
type DIDAgent ¶
type DIDAgent struct { WalletH managed.Wallet StorageH managed.Wallet // result future of the wallet export, one time attr, obsolete soon Export async.Future // the Root DID which gives us rights to write ledger Root core.DID // keep 'all' DIDs for performance reasons as well as better usability of our APIs DidCache Cache // Agent type: CA, EA, Worker, etc. Type Type sync.Mutex // Currently saImplID makes the agent mutable EAEndp *service.Addr // EA endpoint if set, used for SA API and notifications // contains filtered or unexported fields }
DIDAgent is the main abstraction of the package together with Agency. The agent started as a CA but has been later added support for EAs and worker/cloud-EA as well. This might be something we will change later. DIDAgent's most important task is/WAS to receive Payloads and process Messages inside them. And there are lots of stuff to support that. That part of code is heavily under construction.
More concrete parts of the DIDAgent are support for wallet, root DID, did cache. Web socket connections are more like old relic, and that will change in future for something else. It WAS part of the protocol STATE management.
Please be noted that DIDAgent or more precisely CA is singleton by its nature per EA it serves. So, Cloud DIDAgent is a gateway to world for EA it serves. EAs are mostly in mobile devices and handicapped by their nature. In our latest architecture CA serves EA by creating a worker EA which lives in the cloud as well. For now, in the most cases we have pair or agents serving each mobile EAs here in the cloud: CA and w-EA.
There is DIDAgent.Type where this DIDAgent can be EA only. That type is used for test and CLI Go clients.
func (*DIDAgent) AddDIDCache ¶
func (*DIDAgent) AssertWallet ¶
func (a *DIDAgent) AssertWallet()
func (*DIDAgent) CloseWallet ¶
func (a *DIDAgent) CloseWallet()
func (*DIDAgent) ConnectionStorage ¶ added in v0.30.4
func (a *DIDAgent) ConnectionStorage() storage.ConnectionStorage
func (*DIDAgent) DIDStorage ¶ added in v0.30.4
func (a *DIDAgent) DIDStorage() storage.DIDStorage
func (*DIDAgent) FindPWByID ¶ added in v0.30.14
func (a *DIDAgent) FindPWByID(id string) (pw *storage.Connection, err error)
FindPWByID finds pairwise by id. This is a ReceiverEndp interface method.
func (*DIDAgent) FindPWByName ¶ added in v0.25.26
func (a *DIDAgent) FindPWByName(name string) (pw *storage.Connection, err error)
func (*DIDAgent) KMS ¶ added in v0.30.4
func (a *DIDAgent) KMS() kms.KeyManager
func (*DIDAgent) LoadTheirDID ¶ added in v0.25.27
func (a *DIDAgent) LoadTheirDID(connection storage.Connection) core.DID
func (*DIDAgent) ManagedStorage ¶ added in v0.30.7
func (*DIDAgent) ManagedWallet ¶ added in v0.30.0
func (*DIDAgent) OpenWallet ¶
func (*DIDAgent) SaveTheirDID ¶
func (*DIDAgent) SetRootDid ¶
func (*DIDAgent) SetSAImplID ¶ added in v0.25.3
func (*DIDAgent) Storage ¶ added in v0.30.7
func (a *DIDAgent) Storage() storage.AgentStorage
Storage returns TEMPORARY agent storage object pointer. Note!! You should newer store it, only use by once, even in every single line of code.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle implements ManagedWallet interface. These types together offer an API to use SSI wallets conveniently. They hide closing and opening logic which is needed to reserve OS level file handles. Only limited amount of simultaneous wallet handles is kept open (MaxOpen). See more information from API function descriptions.
func (*Handle) Close ¶
func (h *Handle) Close()
Close frees the wallet handle to reuse by WalletMgr. Please note that it's NOT important or desired to call this function during the agency process is running.
func (*Handle) Handle ¶
Handle returns the actual indy wallet handle which can be used with indy SDK API calls. The Handle function hides all the needed complexity behind it. For example, if the actual libindy wallet handle is already closed, it will be opened first. Please note that there is no performance penalty i.e. no optimization is needed.
func (*Handle) Storage ¶ added in v0.30.0
func (h *Handle) Storage() api.AgentStorage
type Mgr ¶
type Mgr struct {
// contains filtered or unexported fields
}
type Type ¶
type Type int
Type of the agent instance. In most cases it's Cloud Agent (CA). Which is the the default value.
type Wallet ¶
type Wallet struct { Config wallet.Config Credentials wallet.Credentials // contains filtered or unexported fields }
func NewRawWalletCfg ¶
func NewWalletCfg ¶
func (*Wallet) CloseWallet ¶ added in v0.30.7
func (*Wallet) OpenWallet ¶ added in v0.30.7
func (*Wallet) SetKeyMethod ¶
func (*Wallet) WantsBackup ¶ added in v0.30.7
func (Wallet) WorkerWallet ¶
WorkerWallet makes a copy of the wallet cfg, normally CA`s wallet
func (Wallet) WorkerWalletBy ¶
WorkerWalletBy makes a copy of the wallet cfg which name ends with suffix