Make SignedKeyList.data and signature nullable.
There are some cases where the backend will return null strings for SignedKeyList.signature, we adapt the model to be able to handle these cases.
This commit is contained in:
parent
d9e2002051
commit
17316b31b6
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,3 +1,14 @@
|
|||
## Key [1.16.1]
|
||||
|
||||
08 Nov, 2021
|
||||
|
||||
### Changes
|
||||
Handle the case where the signed key list has a null signature.
|
||||
Modifies:
|
||||
- `SignedKeyListEntity` (embedded in `PublicAddressEntity` and `AddressEntity`)
|
||||
- `PublicSignedKeyList`
|
||||
- `SignedKeyListResponse`
|
||||
|
||||
## Test Android Instrumented [1.15.3]
|
||||
|
||||
05 Nov, 2021
|
||||
|
|
|
@ -23,7 +23,7 @@ plugins {
|
|||
kotlin("android")
|
||||
}
|
||||
|
||||
libVersion = Version(1, 16, 0)
|
||||
libVersion = Version(1, 16, 1)
|
||||
|
||||
android()
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import kotlinx.serialization.Serializable
|
|||
@Serializable
|
||||
data class SignedKeyListResponse(
|
||||
@SerialName("Data")
|
||||
val data: String,
|
||||
val data: String?,
|
||||
@SerialName("Signature")
|
||||
val signature: String
|
||||
val signature: String?
|
||||
)
|
||||
|
|
|
@ -22,6 +22,6 @@ import androidx.room.Entity
|
|||
|
||||
@Entity
|
||||
data class SignedKeyListEntity(
|
||||
val data: String,
|
||||
val signature: String
|
||||
val data: String?,
|
||||
val signature: String?
|
||||
)
|
||||
|
|
|
@ -40,7 +40,7 @@ class PrivateKeyRepositoryImpl(
|
|||
) : PrivateKeyRepository {
|
||||
|
||||
private fun PrivateAddressKey.creationRequest(): CreateAddressKeyRequest {
|
||||
val signedKeyList = checkNotNull(signedKeyList) { "Signed key list for key creation is null"}
|
||||
val signedKeyList = checkNotNull(signedKeyList) { "Signed key list for key creation is null" }
|
||||
return CreateAddressKeyRequest(
|
||||
addressId = addressId,
|
||||
privateKey = privateKey.key,
|
||||
|
@ -48,8 +48,8 @@ class PrivateKeyRepositoryImpl(
|
|||
token = token,
|
||||
signature = signature,
|
||||
signedKeyList = SignedKeyListRequest(
|
||||
signedKeyList.data,
|
||||
signedKeyList.signature
|
||||
checkNotNull(signedKeyList.data) { "Signed key list's data of new key can't be null" },
|
||||
checkNotNull(signedKeyList.signature) { "Signed key list's signature of new key can't be null" },
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ package me.proton.core.key.domain.entity.key
|
|||
import me.proton.core.crypto.common.pgp.Signature
|
||||
|
||||
data class PublicSignedKeyList(
|
||||
val data: String,
|
||||
val signature: Signature
|
||||
val data: String?,
|
||||
val signature: Signature?
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue