Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

v0.9.41 #408

Merged
merged 6 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent/accessmgr/accessmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func Start() {

started = true
go func() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Error(err)
})
}))
glog.V(1).Infoln("wallet access mgr started")
for walletCfg := range input {
accessed.Lock()
Expand Down
4 changes: 2 additions & 2 deletions agent/agency/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ func timeToBackup() bool {
}

func Backup() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Warning(err)
})
}))

backupFileName := utils.Settings.RegisterBackupName()
if backupFileName == "" {
Expand Down
4 changes: 2 additions & 2 deletions agent/async/future_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func TestFuture_GetValue_And_SetChan(t *testing.T) {

func TestFuture_TestWithErrorResult(t *testing.T) {
readValue := func(f *Future) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
// eat the error
})
}))
f.value()
}

Expand Down
8 changes: 4 additions & 4 deletions agent/cloud/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ func NewEA() *Agent {

// AttachSAImpl sets implementation ID for SA to use for mocks and auto accepts.
func (a *Agent) AttachSAImpl(implID string) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorln("attach sa impl:", err)
})
}))
a.SetSAImplID(implID)
glog.V(3).Infof("setting implementation (%s)", a.SAImplID())
if a.IsCA() {
Expand Down Expand Up @@ -296,9 +296,9 @@ func (a *Agent) ExportWallet(key string, exportPath string) string {
}

func (a *Agent) loadPWMap() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Error("cannot load PW map:", err)
})
}))

a.AssertWallet()

Expand Down
8 changes: 4 additions & 4 deletions agent/handshake/agency.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ func LoadRegistered(filename string) (err error) {
return fmt.Errorf("load register: %s", err)
}
go func() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Fatal(err)
}, func(exception interface{}) {
}), func(exception interface{}) {
glog.Fatal(exception)
})

Expand All @@ -158,10 +158,10 @@ func LoadRegistered(filename string) (err error) {
name := strings.Replace(email, "@", "_", -1)

// don't let crash on panics
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("error: %s in agency load (email %s,DID:%s)",
err, email, caDID)
})
}))

if !alreadyRegistered[name] {
glog.V(2).Infof("Loading enclave key for root: %s, ca: %s", rootDid, caDID)
Expand Down
4 changes: 2 additions & 2 deletions agent/pairwise/pairwise.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func NewCalleePairwise(
}

func (p *Callee) CheckPreallocation(cnxAddr *endp.Addr) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("Error loading connection: %s (%v)", cnxAddr.ConnID, err)
})
}))

// ssi.DIDAgent implements comm.Receiver interface
// ssi.Agent is other interface, that's why the cast
Expand Down
14 changes: 8 additions & 6 deletions agent/prot/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ func StartPSM(ts Initial) (err error) {
wa := ts.Ca.WorkerEA()
connID := ts.T.ConnectionID()

defer err2.Handle(&err, func() {
defer err2.Handle(&err, func(err error) error {
opl := newPayload(ts)
_ = UpdatePSM(wDID, connID, ts.T, opl, psm.Failure)
return err
})

pipe := try.To1(wa.PwPipe(connID))
Expand Down Expand Up @@ -207,8 +208,9 @@ func ExecPSM(ts Transition) (err error) {
// Create protocol task in protocol implementation
task := try.To1(CreateTask(ts.TaskHeader, nil))

defer err2.Handle(&err, func() {
defer err2.Handle(&err, func(err error) error {
_ = UpdatePSM(meDID, connID, task, ts.Payload, psm.Failure)
return err
})

try.To(UpdatePSM(meDID, connID, task, ts.Payload, psm.Received))
Expand Down Expand Up @@ -295,9 +297,9 @@ func AddStatusProvider(t string, proc comm.ProtProc) {
}

func updatePSM(receiver comm.Receiver, t comm.Task, state psm.SubState) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("error in psm update: %s", err)
})
}))
msg := aries.MsgCreator.Create(didcomm.MsgInit{
Type: t.Type(),
Thread: decorator.NewThread(t.ID(), ""),
Expand All @@ -323,9 +325,9 @@ func CreateTask(header *comm.TaskHeader, protocol *pb.Protocol) (t comm.Task, er

// FindAndStartTask start the protocol by using CA API Type in the packet.PL.
func FindAndStartTask(receiver comm.Receiver, task comm.Task) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("Cannot start protocol: %s", err)
})
}))

proc, ok := starters[task.Type()]
if !ok {
Expand Down
8 changes: 4 additions & 4 deletions agent/prot/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func NotifyEdge(ne notifyEdge) {
r := comm.ActiveRcvrs.Get(ne.did)
if r != nil {
go func() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Warningf("=======\n%s\n=======", err)
})
}))

bus.WantAllAgentActions.AgentBroadcast(bus.AgentNotify{
AgentKeyType: bus.AgentKeyType{AgentDID: ne.did},
Expand Down Expand Up @@ -239,9 +239,9 @@ type endingInfo struct {
}

func triggerEnd(info endingInfo) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Error("trigger PSM end notification:", err)
})
}))

key := psm.StateKey{
DID: info.meDID,
Expand Down
4 changes: 2 additions & 2 deletions agent/psm/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func TestMain(m *testing.M) {
}

func setUp() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
fmt.Println("error on setup", err)
})
}))

// We don't want logs on file with tests
try.To(flag.Set("logtostderr", "true"))
Expand Down
12 changes: 6 additions & 6 deletions agent/sec/pipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ func TestPackUnpackWithSeparatedWallets(t *testing.T) {
func TestIndyPipe(t *testing.T) {
assert.PushTester(t)
defer assert.PopTester()
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
println(err)
utils.Settings.SetDIDMethod(method.TypeSov)
}, func(v any) {
}), func(v any) {
println(v)
utils.Settings.SetDIDMethod(method.TypeSov)
})
Expand Down Expand Up @@ -270,10 +270,10 @@ func getRecipientKeys(msg map[string]interface{}) (keys []string, err error) {
func TestPipe_pack(t *testing.T) {
assert.PushTester(t)
defer assert.PopTester()
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
println(err)
utils.Settings.SetDIDMethod(method.TypeSov)
}, func(v any) {
}), func(v any) {
println(v)
utils.Settings.SetDIDMethod(method.TypeSov)
})
Expand Down Expand Up @@ -352,10 +352,10 @@ func TestPipe_pack(t *testing.T) {
func TestPipe_packPeer(t *testing.T) {
assert.PushTester(t)
defer assert.PopTester()
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
fmt.Println(err)
t.Fail()
}, func(v any) {
}), func(v any) {
fmt.Println(v)
t.Error(v)
})
Expand Down
12 changes: 6 additions & 6 deletions agent/ssi/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ func (a *DIDAgent) myCreateDID(seed string) (agentDid *DID) {
f := new(async.Future)
ch := make(findy.Channel, 1)
go func() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("AddDID failed: %s", err)
})
}))
// Catch did result here and store it also to the agent storage
didRes := <-did.CreateAndStore(a.Wallet(), did.Did{Seed: seed})
glog.V(5).Infof("agent storage Add DID %s", didRes.Data.Str1)
Expand Down Expand Up @@ -363,9 +363,9 @@ func (a *DIDAgent) KMS() kms.KeyManager {

// localKey returns a future to the verkey of the DID from a local wallet.
func (a *DIDAgent) localKey(didName string) (f *async.Future) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorln("error when fetching localKey: ", err)
})
}))

// using did storage to get the verkey - could be also fetched from indy wallet directly
// eventually all data should be fetched from agent storage and not from indy wallet
Expand Down Expand Up @@ -421,9 +421,9 @@ func (a *DIDAgent) LoadDID(did string) core.DID {
}

func (a *DIDAgent) LoadTheirDID(connection storage.Connection) core.DID {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Warningf("load connection (%s) error: %v", connection.ID, err)
}, func(v any) {
}), func(v any) {
glog.Warningf("load connection (%s) error: %v", connection.ID, v)
})

Expand Down
8 changes: 4 additions & 4 deletions agent/ssi/did.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ func (d *DID) SetWallet(w managed.Wallet) {
// so the call doesn't block. The meta data is set "pairwise". See StoreResult()
// for status.
func (d *DID) Store(mgdWallet, mgdStorage managed.Wallet) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Errorf("Error storing DID: %s", err)
})
}))

ds, vk, _ := d.data.Strs()
idJSON := did.Did{Did: ds, VerKey: vk}
Expand Down Expand Up @@ -223,9 +223,9 @@ func (d *DID) StoreResult() error {
}

func (d *DID) SavePairwiseForDID(mStorage managed.Wallet, tDID core.DID, pw core.PairwiseMeta) {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Warningf("save pairwise for DID error: %v", err)
})
}))

theirDID := tDID.(*DID)

Expand Down
12 changes: 6 additions & 6 deletions agent/ssi/walletmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func (h *Handle) Config() managed.WalletCfg {
// NOT important or desired to call this function during the agency process is
// running.
func (h *Handle) Close() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Warning("closing error:", err)
})
}))

h.l.Lock()
defer h.l.Unlock()
Expand Down Expand Up @@ -102,9 +102,9 @@ func (h *Handle) Handle() int {
// reopen opens the wallet by its configuration. Open is always called by Wallet
// Manager because it will keep track of wallet handles and max amount of them.
func (h *Handle) reopen() int {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Error("error when reopening wallet: ", err)
})
}))

h.h = try.To1(h.cfg.OpenWallet())

Expand Down Expand Up @@ -145,9 +145,9 @@ func (m *Mgr) Open(cfg managed.WalletCfg) managed.Wallet {
}

func (m *Mgr) openNewWallet(cfg managed.WalletCfg) managed.Wallet {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
glog.Error("error when opening wallet: ", err)
})
}))

handle := try.To1(cfg.OpenWallet())

Expand Down
4 changes: 2 additions & 2 deletions cmd/agency.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ var (
const registerBackupInterval = 12 * time.Hour

func init() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
log.Println(err)
})
}))

aCmd.VersionInfo = "findy-agent v" + utils.Version

Expand Down
4 changes: 2 additions & 2 deletions cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ Example
var expCmd = tools.ExportCmd{}

func init() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
log.Println(err)
})
}))

flags := exportCmd.Flags()
flags.StringVar(&expCmd.WalletName, "wallet-name", "", flagInfo("wallet name", exportCmd.Name(), exportEnvs["wallet-name"]))
Expand Down
4 changes: 2 additions & 2 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Example
var impCmd = tools.ImportCmd{}

func init() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
log.Println(err)
})
}))

flags := importCmd.Flags()
flags.StringVar(&impCmd.WalletName, "wallet-name", "", flagInfo("wallet name", importCmd.Name(), importEnvs["wallet-name"]))
Expand Down
4 changes: 2 additions & 2 deletions cmd/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Example
var keyCreateCmd = key.CreateCmd{}

func init() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
log.Println(err)
})
}))

createKeyCmd.Flags().StringVar(&keyCreateCmd.Seed, "seed", "", flagInfo("seed for wallet key creation", keyCmd.Name(), keyEnvs["seed"]))

Expand Down
4 changes: 2 additions & 2 deletions cmd/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ var (
)

func init() {
defer err2.Catch(func(err error) {
defer err2.Catch(err2.Err(func(err error) {
log.Println(err)
})
}))

f := poolCmd.PersistentFlags()
f.StringVar(&poolName, "name", "", flagInfo("name of the pool", poolCmd.Name(), poolCreateEnvs["name"]))
Expand Down
Loading