Skip to content
Snippets Groups Projects
Commit 6155ebae authored by Jake Taylor's avatar Jake Taylor
Browse files

move defaultauthcallbacks

parent d2f2814d
No related branches found
No related tags found
1 merge request!510Release
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package bindings package bindings
import ( import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/rounds" "gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/client/xxdk"
...@@ -49,7 +48,7 @@ func LoginE2e(cmixId int, callbacks AuthCallbacks, identity []byte) (*E2e, error ...@@ -49,7 +48,7 @@ func LoginE2e(cmixId int, callbacks AuthCallbacks, identity []byte) (*E2e, error
var authCallbacks xxdk.AuthCallbacks var authCallbacks xxdk.AuthCallbacks
if callbacks == nil { if callbacks == nil {
authCallbacks = defaultAuthCallbacks{} authCallbacks = xxdk.DefaultAuthCallbacks{}
} else { } else {
authCallbacks = &authCallback{bindingsCbs: callbacks} authCallbacks = &authCallback{bindingsCbs: callbacks}
} }
...@@ -78,7 +77,7 @@ func LoginE2eEphemeral(cmixId int, callbacks AuthCallbacks, identity []byte) (*E ...@@ -78,7 +77,7 @@ func LoginE2eEphemeral(cmixId int, callbacks AuthCallbacks, identity []byte) (*E
var authCallbacks xxdk.AuthCallbacks var authCallbacks xxdk.AuthCallbacks
if callbacks == nil { if callbacks == nil {
authCallbacks = defaultAuthCallbacks{} authCallbacks = xxdk.DefaultAuthCallbacks{}
} else { } else {
authCallbacks = &authCallback{bindingsCbs: callbacks} authCallbacks = &authCallback{bindingsCbs: callbacks}
} }
...@@ -103,7 +102,7 @@ func LoginE2eLegacy(cmixId int, callbacks AuthCallbacks) (*E2e, error) { ...@@ -103,7 +102,7 @@ func LoginE2eLegacy(cmixId int, callbacks AuthCallbacks) (*E2e, error) {
var authCallbacks xxdk.AuthCallbacks var authCallbacks xxdk.AuthCallbacks
if callbacks == nil { if callbacks == nil {
authCallbacks = defaultAuthCallbacks{} authCallbacks = xxdk.DefaultAuthCallbacks{}
} else { } else {
authCallbacks = &authCallback{bindingsCbs: callbacks} authCallbacks = &authCallback{bindingsCbs: callbacks}
} }
...@@ -162,25 +161,3 @@ func (a *authCallback) Reset(partner contact.Contact, ...@@ -162,25 +161,3 @@ func (a *authCallback) Reset(partner contact.Contact,
receptionID receptionID.EphemeralIdentity, round rounds.Round, _ *xxdk.E2e) { receptionID receptionID.EphemeralIdentity, round rounds.Round, _ *xxdk.E2e) {
a.bindingsCbs.Reset(convertAuthCallbacks(partner, receptionID, round)) 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!")
}
...@@ -432,3 +432,25 @@ func (aca *authCallbacksAdapter) Reset(partner contact.Contact, ...@@ -432,3 +432,25 @@ func (aca *authCallbacksAdapter) Reset(partner contact.Contact,
receptionID receptionID.EphemeralIdentity, round rounds.Round) { receptionID receptionID.EphemeralIdentity, round rounds.Round) {
aca.ac.Reset(partner, receptionID, round, aca.e2e) 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!")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment