Migrating from v11 to v12
The migrations in this file apply to all platforms. In addition, there are some migrations required for particular platforms:
New decrypt_message API
DecryptedMessage.Commitlost itsbufferedMessagesfield; these messages now appear in the list returned bydecryptMessage.BufferedDecryptedMessageno longer exists; remove any related helpers.- The following errors have been converted to outcomes. Any
catchblocks which existed only to suppress them must be deleted; those with behavior should be rewritten to trigger based on inspection of the outcomes.BufferedFutureMessageBufferedCommitUnmergedPendingGroupDuplicateMessageStaleCommitStaleProposalMessageEpochTooOldWrongEpoch
const outcomes = await ctx.decryptMessage(conversationId, messageBytes);
for (const outcome of outcomes) {
// example: we care about buffered commits
if (
DecryptionOutcome.Deferred.instanceOf(outcome) &&
DeferralReason.MissingProposal.instanceOf(outcome.inner.deferralReason)
) {
handleBufferedCommit();
}
// and decrypted messages can go through the normal path
else if (DecryptionOutcome.Decrypted.instanceOf(outcome)) {
handleDecryptedMessage(outcome.inner.decryptedMessage);
}
// any outcomes we don't care about can be dropped
}
let outcomes = try await ctx.decryptMessage(conversationId: conversationId, payload: messageBytes)
for outcome in outcomes {
switch outcome {
// example: we care about buffered commits
case .deferred(.missingProposal):
handleBufferedCommit()
// and decrypted messages can go through the normal path
case .decrypted(let decryptedMessage):
handleDecryptedMessage(decryptedMessage)
// any outcomes we don't care about can be dropped
default:
break
}
}
val outcomes = ctx.decryptMessage(conversationId, messageBytes)
for (outcome in outcomes) {
when (outcome) {
// example: we care about buffered commits
is DecryptionOutcome.Deferred ->
if (outcome.deferralReason is DeferralReason.MissingProposal) handleBufferedCommit()
// and decrypted messages can go through the normal path
is DecryptionOutcome.Decrypted -> handleDecryptedMessage(outcome.decryptedMessage)
// any outcomes we don't care about can be dropped
else -> {}
}
}