Migrating from v10 to v11
This page covers changes that apply to all platforms. Some changes only affect one platform; they are covered on the TypeScript, Swift and Kotlin pages.
DecryptedMessage
DecryptedMessage.Text and BufferedDecryptedMessage.Text have been renamed to DecryptedMessage.ApplicationMessage
and BufferedDecryptedMessage.ApplicationMessage, respectively. Both enums now also include Transient,
TransientTargeted and PersistedTargeted variants. Match on all DecryptedMessage variants before accessing their
data:
if (DecryptedMessage.ApplicationMessage.instanceOf(decryptedMessage)) {
const { plaintext, senderClientId, identity } = decryptedMessage.inner;
// Handle the application message.
} else if (DecryptedMessage.Commit.instanceOf(decryptedMessage)) {
const { isActive, bufferedMessages, identity } = decryptedMessage.inner;
// Handle the commit.
} else if (DecryptedMessage.Proposal.instanceOf(decryptedMessage)) {
const { delay, identity } = decryptedMessage.inner;
// Handle the proposal.
} else if (DecryptedMessage.Transient.instanceOf(decryptedMessage)) {
const { plaintext, senderClientId, identity } = decryptedMessage.inner;
// Handle the transient message.
} else if (DecryptedMessage.TransientTargeted.instanceOf(decryptedMessage)) {
const { plaintext, senderClientId, identity } = decryptedMessage.inner;
// Handle the transient targeted message.
} else if (DecryptedMessage.PersistedTargeted.instanceOf(decryptedMessage)) {
const { plaintext, senderClientId, identity } = decryptedMessage.inner;
// Handle the persisted targeted message.
}
switch decryptedMessage {
case let .applicationMessage(plaintext, senderClientId, identity):
// Handle the application message.
case let .commit(isActive, bufferedMessages, identity):
// Handle the commit.
case let .proposal(delay, identity):
// Handle the proposal.
case let .transient(plaintext, senderClientId, identity):
// Handle the transient message.
case let .transientTargeted(plaintext, senderClientId, identity):
// Handle the transient targeted message.
case let .persistedTargeted(plaintext, senderClientId, identity):
// Handle the persisted targeted message.
}
when (decryptedMessage) {
is DecryptedMessage.ApplicationMessage -> {
val (plaintext, senderClientId, identity) = decryptedMessage
// Handle the application message.
}
is DecryptedMessage.Commit -> {
val (isActive, bufferedMessages, identity) = decryptedMessage
// Handle the commit.
}
is DecryptedMessage.Proposal -> {
val (delay, identity) = decryptedMessage
// Handle the proposal.
}
is DecryptedMessage.Transient -> {
val (plaintext, senderClientId, identity) = decryptedMessage
// Handle the transient message.
}
is DecryptedMessage.TransientTargeted -> {
val (plaintext, senderClientId, identity) = decryptedMessage
// Handle the transient targeted message.
}
is DecryptedMessage.PersistedTargeted -> {
val (plaintext, senderClientId, identity) = decryptedMessage
// Handle the persisted targeted message.
}
}
Other
-
e2eiIsPkiEnvSetuphas been removed. You can callgetPkiEnvironmentto see if it is set. -
e2eiIsEnabledhas been removed. You can usefindCredentialsto check whether an X509 credential for a given cipher suite exists. -
proteusNewPrekeyis deprecated; useproteusNewPrekeyAutoinstead. -
ClientId.deserializecan now fail. Callingdeserializeon history client ids throws aCoreCryptoError. -
The documentation for
addCredentialpreviously stated that credentials registered with a single client must be distinct in credential type, signature scheme, and creation timestamp, and that you therefore had to wait a full second between registrations. This was never true of any released version; we fixed it before releasing 10.0.0. If you added a delay betweenaddCredentialcalls to comply, you can remove it. -
CoreCryptoContext.setDatais now a synchronous function, not async.