Merge pull request #4447 from vector-im/feature/bca/fix_fallback_key_support

Fix fallback otk support
This commit is contained in:
Valere 2021-11-12 14:33:07 +01:00 committed by GitHub
commit c8577eb951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

1
changelog.d/4446.bugfix Normal file
View File

@ -0,0 +1 @@
Unable to establish Olm outbound session from fallback key

View File

@ -38,14 +38,22 @@ data class MXKey(
/**
* signature user Id to [deviceid][signature]
*/
private val signatures: Map<String, Map<String, String>>
private val signatures: Map<String, Map<String, String>>,
/**
* We have to store the original json because it can contain other fields
* that we don't support yet but they would be needed to check signatures
*/
private val rawMap: JsonDict
) {
/**
* @return the signed data map
*/
fun signalableJSONDictionary(): Map<String, Any> {
return mapOf("key" to value)
return rawMap.filter {
it.key != "signatures" && it.key != "unsigned"
}
}
/**
@ -82,6 +90,7 @@ data class MXKey(
* <pre>
* "signed_curve25519:AAAAFw": {
* "key": "IjwIcskng7YjYcn0tS8TUOT2OHHtBSfMpcfIczCgXj4",
* "fallback" : true|false
* "signatures": {
* "@userId:matrix.org": {
* "ed25519:GMJRREOASV": "EUjp6pXzK9u3SDFR\/qLbzpOi3bEREeI6qMnKzXu992HsfuDDZftfJfiUXv9b\/Hqq1og4qM\/vCQJGTHAWMmgkCg"
@ -107,7 +116,8 @@ data class MXKey(
type = components[0],
keyId = components[1],
value = params["key"] as String,
signatures = params["signatures"] as Map<String, Map<String, String>>
signatures = params["signatures"] as Map<String, Map<String, String>>,
rawMap = params
)
}
}