diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt b/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt index 35c1469cc1..f4a625fd4f 100644 --- a/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt +++ b/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt @@ -41,7 +41,7 @@ class CredentialExchangeImportManagerImpl( ) }, folders = emptyList(), - folderRelationships = emptyMap(), + folderRelationships = emptyList(), ), ) } diff --git a/network/src/main/kotlin/com/bitwarden/network/model/ImportCiphersJsonRequest.kt b/network/src/main/kotlin/com/bitwarden/network/model/ImportCiphersJsonRequest.kt index 95446be687..a59636aef4 100644 --- a/network/src/main/kotlin/com/bitwarden/network/model/ImportCiphersJsonRequest.kt +++ b/network/src/main/kotlin/com/bitwarden/network/model/ImportCiphersJsonRequest.kt @@ -8,9 +8,8 @@ import kotlinx.serialization.Serializable * * @property folders A list of folders to import. * @property ciphers A list of ciphers to import. - * @property folderRelationships A map of cipher folder relationships to import. Key correlates to - * the index of the cipher in the ciphers list. Value correlates to the index of the folder in the - * folders list. + * @property folderRelationships A list of cipher-folder relationships to import. Each entry maps a + * cipher index (Key) to a folder index (Value). */ @Serializable data class ImportCiphersJsonRequest( @@ -19,7 +18,7 @@ data class ImportCiphersJsonRequest( @SerialName("ciphers") val ciphers: List, @SerialName("folderRelationships") - val folderRelationships: Map, + val folderRelationships: List, ) { /** * Represents a folder request with an optional [id] if the folder already exists. @@ -34,4 +33,18 @@ data class ImportCiphersJsonRequest( @SerialName("id") val id: String?, ) + + /** + * A key-value pair of 32-bit integers, used for mapping relationships. + * + * @property key The key, typically an index. + * @property value The value, typically an index. + */ + @Serializable + data class Int32Int32KeyValuePairJson( + @SerialName("key") + val key: Int, + @SerialName("value") + val value: Int, + ) } diff --git a/network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt b/network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt index 3abe6f2ada..b705c62085 100644 --- a/network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt +++ b/network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt @@ -350,7 +350,7 @@ class CiphersServiceTest : BaseServiceTest() { request = ImportCiphersJsonRequest( ciphers = listOf(createMockCipherJsonRequest(number = 1)), folders = emptyList(), - folderRelationships = emptyMap(), + folderRelationships = emptyList(), ), ) assertEquals(ImportCiphersResponseJson.Success, result.getOrThrow()) @@ -363,7 +363,7 @@ class CiphersServiceTest : BaseServiceTest() { request = ImportCiphersJsonRequest( ciphers = listOf(createMockCipherJsonRequest(number = 1)), folders = emptyList(), - folderRelationships = emptyMap(), + folderRelationships = emptyList(), ), ) assertTrue(result.isFailure)