QOL – handle join announcements better by pre-empting the bundle announcement

This commit is contained in:
Cassandra Heart 2023-09-24 23:34:01 -05:00
parent 5f9c90f284
commit a0ff2ab3c6
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -485,11 +485,32 @@ func (e *CeremonyExecutionEngine) announceJoin(
) error { ) error {
idk, err := e.keyManager.GetAgreementKey("q-ratchet-idk") idk, err := e.keyManager.GetAgreementKey("q-ratchet-idk")
if err != nil { 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") spk, err := e.keyManager.GetAgreementKey("q-ratchet-spk")
if err != nil { 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() g := curves.ED448().Point.Generator()