Documentation ¶
Index ¶
- Constants
- func ClosePool()
- func CredDefFromLedger(DID, credDefID string) (cd string, err error)
- func Pool() (v int)
- func SetWalletMgrPoolSize(s int)
- type Agent
- type AgentType
- type Cache
- type DID
- func (d *DID) AEndp() (ae service.Addr, err error)
- func (d *DID) Did() string
- func (d *DID) Endpoint() string
- func (d *DID) Route() []string
- func (d *DID) SavePairwiseForDID(wallet int, theirDID *DID, pw PairwiseMeta)
- func (d *DID) SetAEndp(ae service.Addr)
- func (d *DID) SetWallet(w managed.Wallet)
- func (d *DID) StartEndp(wallet int)
- func (d *DID) Store(wallet int)
- func (d *DID) StoreResult() error
- 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) CreateDID(seed string) (agentDid *DID)
- func (a *DIDAgent) FindPWByDID(my string) (pw *Pairwise, err error)
- func (a *DIDAgent) FindPWByName(name string) (pw *Pairwise, err error)
- func (a *DIDAgent) IsCA() bool
- func (a *DIDAgent) IsEA() bool
- func (a *DIDAgent) IsWorker() bool
- func (a *DIDAgent) LoadDID(did string) *DID
- func (a *DIDAgent) LoadTheirDID(pw Pairwise) *DID
- 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() *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 *DID)
- func (a *DIDAgent) SetSAImplID(id string)
- func (a *DIDAgent) Wallet() (h int)
- type DidComm
- type Future
- type Handle
- type In
- type Mgr
- type Out
- type Pairwise
- type PairwiseMeta
- type Schema
- type State
- type Type
- type Wallet
- func (w *Wallet) Close(handle int) (f *Future)
- 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 *Future)
- func (w *Wallet) SetID(id string)
- func (w *Wallet) SetKey(key string)
- func (w *Wallet) SetKeyMethod(m string)
- func (w *Wallet) StartCreation() (f *Future)
- func (w *Wallet) SyncClose(handle int) (err error)
- func (w *Wallet) SyncOpen() int
- func (w *Wallet) UniqueID() string
- 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 ¶
This section is empty.
Functions ¶
func CredDefFromLedger ¶
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 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 NewDidWithKeyFuture ¶
func (*DID) SavePairwiseForDID ¶ added in v0.25.26
func (d *DID) SavePairwiseForDID(wallet int, theirDID *DID, pw PairwiseMeta)
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 // result future of the wallet export, one time attr, obsolete soon Export Future // the Root DID which gives us rights to write ledger Root *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) CreateDID ¶
CreateDID creates a new DID thru the Future which means that returned *DID follows 'lazy fetch' principle. You should call this as early as possible for the performance reasons. Most cases seed should be empty string.
func (*DIDAgent) FindPWByDID ¶ added in v0.25.26
FindPWByDID finds pairwise by my DID. This is a ReceiverEndp interface method.
func (*DIDAgent) FindPWByName ¶ added in v0.25.26
func (*DIDAgent) LoadTheirDID ¶ added in v0.25.27
func (*DIDAgent) OpenWallet ¶
func (*DIDAgent) SaveTheirDID ¶
func (*DIDAgent) SetRootDid ¶
func (*DIDAgent) SetSAImplID ¶ added in v0.25.3
type Future ¶
type Future struct { On State V interface{} // contains filtered or unexported fields }
func NewFuture ¶
func NewFuture(ch findy.Channel) *Future
NewFuture changes the existing findy.Channel to a Future.
func OpenPool ¶
Open opens ledger connection first time called. After that returns previous handle without checking the pool name. If caller wants to reopen new pool it must call ClosePool() first.
Note! We could have unit tests working with out ledger by reserving certain ledger handle and name, but that should be done in the indy Go wrapper
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.
type Mgr ¶
type Mgr struct {
// contains filtered or unexported fields
}
type Pairwise ¶ added in v0.25.27
type Pairwise struct { MyDID string TheirDID string Meta PairwiseMeta }
func FromIndyPairwise ¶ added in v0.25.27
type PairwiseMeta ¶ added in v0.25.27
type Schema ¶
type Schema struct { ID string `json:"id,omitempty"` // ID from Indy/Ledger Name string `json:"name,omitempty"` // name of the schema Version string `json:"version,omitempty"` // version number in string Attrs []string `json:"attrs,omitempty"` // attribute string list Stored *Future `json:"-"` // info from ledger }
func (*Schema) FromLedger ¶
func (*Schema) LazySchema ¶
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) SetKeyMethod ¶
func (*Wallet) StartCreation ¶
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