From 9f034c891ecb80322c3993d0dee3330664720e97 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Thu, 7 Apr 2022 18:14:47 -0700
Subject: [PATCH] finished auth (no tests)

---
 auth/interface.go       |  1 +
 auth/receivedRequest.go |  4 ++--
 auth/replayConfirm.go   | 13 +++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/auth/interface.go b/auth/interface.go
index 7fdd73968..52b1d9dd3 100644
--- a/auth/interface.go
+++ b/auth/interface.go
@@ -54,6 +54,7 @@ type State interface {
 	// ratcheted
 	// The confirm sends as a critical message, if the round send on fails, it
 	// will be auto resent by the cmix client
+	// This will not be useful if either side has ratcheted
 	ReplayConfirm(partner *id.ID) (id.Round, error)
 
 	// ReplayRequests will iterate through all pending contact requests and replay
diff --git a/auth/receivedRequest.go b/auth/receivedRequest.go
index eaea3ddd6..1a58f62b2 100644
--- a/auth/receivedRequest.go
+++ b/auth/receivedRequest.go
@@ -7,8 +7,8 @@ import (
 	"github.com/pkg/errors"
 	jww "github.com/spf13/jwalterweatherman"
 	"gitlab.com/elixxir/client/auth/store"
-	"gitlab.com/elixxir/client/cmix/rounds"
 	"gitlab.com/elixxir/client/cmix/identity/receptionID"
+	"gitlab.com/elixxir/client/cmix/rounds"
 	"gitlab.com/elixxir/client/e2e/ratchet"
 	"gitlab.com/elixxir/crypto/contact"
 	cAuth "gitlab.com/elixxir/crypto/e2e/auth"
@@ -236,7 +236,7 @@ func (rrs *receivedRequestService) Process(message format.Message,
 
 	//autoconfirm if we should
 	if autoConfirm || reset {
-		_, _ = state.confirmRequestAuth(c, state.params.getConfirmTag(reset))
+		_, _ = state.confirm(c, state.params.getConfirmTag(reset))
 		//handle callbacks
 		if autoConfirm {
 			state.callbacks.Confirm(c, receptionID, round)
diff --git a/auth/replayConfirm.go b/auth/replayConfirm.go
index 70b4ba619..09540fe29 100644
--- a/auth/replayConfirm.go
+++ b/auth/replayConfirm.go
@@ -2,7 +2,16 @@ package auth
 
 import "gitlab.com/xx_network/primitives/id"
 
-//todo implement replay confirm
+// ReplayConfirm is used to resend a confirm
 func (s *state) ReplayConfirm(partner *id.ID) (id.Round, error) {
-	return 0, nil
+
+	confirmPayload, mac, keyfp, err := s.store.LoadConfirmation(partner)
+	if err != nil {
+		return 0, err
+	}
+
+	rid, err := sendAuthConfirm(s.net, partner, keyfp,
+		confirmPayload, mac, s.event, s.params.ResetConfirmTag)
+
+	return rid, err
 }
-- 
GitLab