From a0ff2ab3c64627e359f713c356c79a746435f9f8 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Sun, 24 Sep 2023 23:34:01 -0500 Subject: [PATCH] =?UTF-8?q?QOL=20=E2=80=93=20handle=20join=20announcements?= =?UTF-8?q?=20better=20by=20pre-empting=20the=20bundle=20announcement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ceremony/ceremony_execution_engine.go | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/node/execution/ceremony/ceremony_execution_engine.go b/node/execution/ceremony/ceremony_execution_engine.go index 6610fae..a5f5757 100644 --- a/node/execution/ceremony/ceremony_execution_engine.go +++ b/node/execution/ceremony/ceremony_execution_engine.go @@ -485,11 +485,32 @@ func (e *CeremonyExecutionEngine) announceJoin( ) error { idk, err := e.keyManager.GetAgreementKey("q-ratchet-idk") if err != nil { - return errors.Wrap(err, "announce join") + if errors.Is(err, keys.KeyNotFoundErr) { + idk, err = e.keyManager.CreateAgreementKey( + "q-ratchet-idk", + keys.KeyTypeX448, + ) + if err != nil { + return errors.Wrap(err, "announce key bundle") + } + } else { + return errors.Wrap(err, "announce key bundle") + } } + spk, err := e.keyManager.GetAgreementKey("q-ratchet-spk") if err != nil { - return errors.Wrap(err, "announce join") + if errors.Is(err, keys.KeyNotFoundErr) { + spk, err = e.keyManager.CreateAgreementKey( + "q-ratchet-spk", + keys.KeyTypeX448, + ) + if err != nil { + return errors.Wrap(err, "announce key bundle") + } + } else { + return errors.Wrap(err, "announce key bundle") + } } g := curves.ED448().Point.Generator()