From 6155ebaed560ab8ccb1a941ce0663cd729871326 Mon Sep 17 00:00:00 2001 From: Jake Taylor <jake@elixxir.io> Date: Thu, 30 Jun 2022 14:49:18 -0500 Subject: [PATCH] move defaultauthcallbacks --- bindings/e2e.go | 29 +++-------------------------- xxdk/e2e.go | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/bindings/e2e.go b/bindings/e2e.go index 8820d59f9..bd849f9ad 100644 --- a/bindings/e2e.go +++ b/bindings/e2e.go @@ -7,7 +7,6 @@ package bindings import ( - jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/rounds" "gitlab.com/elixxir/client/xxdk" @@ -49,7 +48,7 @@ func LoginE2e(cmixId int, callbacks AuthCallbacks, identity []byte) (*E2e, error var authCallbacks xxdk.AuthCallbacks if callbacks == nil { - authCallbacks = defaultAuthCallbacks{} + authCallbacks = xxdk.DefaultAuthCallbacks{} } else { authCallbacks = &authCallback{bindingsCbs: callbacks} } @@ -78,7 +77,7 @@ func LoginE2eEphemeral(cmixId int, callbacks AuthCallbacks, identity []byte) (*E var authCallbacks xxdk.AuthCallbacks if callbacks == nil { - authCallbacks = defaultAuthCallbacks{} + authCallbacks = xxdk.DefaultAuthCallbacks{} } else { authCallbacks = &authCallback{bindingsCbs: callbacks} } @@ -103,7 +102,7 @@ func LoginE2eLegacy(cmixId int, callbacks AuthCallbacks) (*E2e, error) { var authCallbacks xxdk.AuthCallbacks if callbacks == nil { - authCallbacks = defaultAuthCallbacks{} + authCallbacks = xxdk.DefaultAuthCallbacks{} } else { authCallbacks = &authCallback{bindingsCbs: callbacks} } @@ -162,25 +161,3 @@ func (a *authCallback) Reset(partner contact.Contact, receptionID receptionID.EphemeralIdentity, round rounds.Round, _ *xxdk.E2e) { a.bindingsCbs.Reset(convertAuthCallbacks(partner, receptionID, round)) } - -// defaultAuthCallbacks is a simple structure for providing a default Callbacks implementation -// It should generally not be used. -type defaultAuthCallbacks struct{} - -// Confirm will be called when an auth Confirm message is processed. -func (a defaultAuthCallbacks) Confirm(contact.Contact, - receptionID.EphemeralIdentity, rounds.Round, *xxdk.E2e) { - jww.ERROR.Printf("No valid auth callback assigned!") -} - -// Request will be called when an auth Request message is processed. -func (a defaultAuthCallbacks) Request(contact.Contact, - receptionID.EphemeralIdentity, rounds.Round, *xxdk.E2e) { - jww.ERROR.Printf("No valid auth callback assigned!") -} - -// Reset will be called when an auth Reset operation occurs. -func (a defaultAuthCallbacks) Reset(contact.Contact, - receptionID.EphemeralIdentity, rounds.Round, *xxdk.E2e) { - jww.ERROR.Printf("No valid auth callback assigned!") -} diff --git a/xxdk/e2e.go b/xxdk/e2e.go index 34271b209..650428be9 100644 --- a/xxdk/e2e.go +++ b/xxdk/e2e.go @@ -432,3 +432,25 @@ func (aca *authCallbacksAdapter) Reset(partner contact.Contact, receptionID receptionID.EphemeralIdentity, round rounds.Round) { aca.ac.Reset(partner, receptionID, round, aca.e2e) } + +// DefaultAuthCallbacks is a simple structure for providing a default Callbacks implementation +// It should generally not be used. +type DefaultAuthCallbacks struct{} + +// Confirm will be called when an auth Confirm message is processed. +func (a DefaultAuthCallbacks) Confirm(contact.Contact, + receptionID.EphemeralIdentity, rounds.Round, *E2e) { + jww.ERROR.Printf("No valid auth callback assigned!") +} + +// Request will be called when an auth Request message is processed. +func (a DefaultAuthCallbacks) Request(contact.Contact, + receptionID.EphemeralIdentity, rounds.Round, *E2e) { + jww.ERROR.Printf("No valid auth callback assigned!") +} + +// Reset will be called when an auth Reset operation occurs. +func (a DefaultAuthCallbacks) Reset(contact.Contact, + receptionID.EphemeralIdentity, rounds.Round, *E2e) { + jww.ERROR.Printf("No valid auth callback assigned!") +} -- GitLab