diff --git a/sdk/java/core/README.md b/sdk/java/core/README.md index 593eb955..058bd672 100644 --- a/sdk/java/core/README.md +++ b/sdk/java/core/README.md @@ -5,8 +5,9 @@ For more information see our official documentation page https://docs.keeper.io/ # Change Log ## 16.6.5 -- Upgraded package dependencies to latest versions and switched to gradle-8.10 -- Make sure autogenerated UIDs don't start with '-' +- KSM-548 - Make sure autogenerated UIDs don't start with '-' +- KSM-553 - Added new field types and updated PAM field types +- Upgraded package dependencies to latest versions and switched to gradle-8.10.1 ## 16.6.4 - KSM-501 - Switched to non-strict JSON parser @@ -32,7 +33,7 @@ For more information see our official documentation page https://docs.keeper.io/ - KSM-421 - Improved Logging ## 16.5.3 -- KSM-401 - Update PAM Record types and Field types to have latest updates +- KSM-401 - Update PAM Record types and Field types to have the latest updates - KSM-406 - New field type: Passkey - KSM-382 - Support for record Transactions diff --git a/sdk/java/core/build.gradle.kts b/sdk/java/core/build.gradle.kts index 68b053c0..eff0e7c7 100644 --- a/sdk/java/core/build.gradle.kts +++ b/sdk/java/core/build.gradle.kts @@ -11,8 +11,8 @@ version = "16.6.5" plugins { `java-library` - kotlin("jvm") version "2.0.10" - kotlin("plugin.serialization") version "2.0.10" + kotlin("jvm") version "2.0.20" + kotlin("plugin.serialization") version "2.0.20" `maven-publish` signing id("io.github.gradle-nexus.publish-plugin") version "2.0.0" @@ -43,18 +43,18 @@ repositories { dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.10")) + implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.20")) // Use the Kotlin JDK 8 standard library. - api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") - implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.10") + api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2") + implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.20") // Use the Kotlin test library. - testImplementation("org.jetbrains.kotlin:kotlin-test:2.0.10") + testImplementation("org.jetbrains.kotlin:kotlin-test:2.0.20") // Use the Kotlin JUnit integration. - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.0.10") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.0.20") testImplementation("org.bouncycastle:bc-fips:2.0.0") // testImplementation("org.bouncycastle:bcprov-jdk15on:1.70") diff --git a/sdk/java/core/gradle/wrapper/gradle-wrapper.properties b/sdk/java/core/gradle/wrapper/gradle-wrapper.properties index 003a2b8b..793ed65e 100644 --- a/sdk/java/core/gradle/wrapper/gradle-wrapper.properties +++ b/sdk/java/core/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/CryptoUtils.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/CryptoUtils.kt index 9b157812..3b4da08e 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/CryptoUtils.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/CryptoUtils.kt @@ -3,7 +3,7 @@ package com.keepersecurity.secretsManager.core import java.math.BigInteger -import java.net.URL +import java.net.URI import java.net.URLDecoder import java.nio.ByteBuffer import java.security.* @@ -250,7 +250,7 @@ data class TotpCode(val code: String, val timeLeft: Int, val period: Int) { if (protocol != "otpauth") return null - val totpUrl = URL("http://" + url.substring(10)) + val totpUrl = URI.create("http://" + url.substring(10)).toURL() val queryPairs = mutableMapOf() val pairs: List = totpUrl.query.split("&") for (pair in pairs) { diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/Notation.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/Notation.kt index 0bb9af98..90f8139e 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/Notation.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/Notation.kt @@ -135,6 +135,7 @@ internal fun fieldType(field: KeeperRecordField): String { @ExperimentalSerializationApi internal fun getFieldValuesCount(field: KeeperRecordField): Int { return when (field) { + is AppFillers -> field.value.size is AccountNumber -> field.value.size is AddressRef -> field.value.size is Addresses -> field.value.size @@ -142,14 +143,17 @@ internal fun getFieldValuesCount(field: KeeperRecordField): Int { is BirthDate -> field.value.size is CardRef -> field.value.size is Checkbox -> field.value.size + is Controller -> field.value.size is DatabaseType -> field.value.size is Date -> field.value.size is DirectoryType -> field.value.size + is Dropdown -> field.value.size is Email -> field.value.size is ExpirationDate -> field.value.size is FileRef -> field.value.size is HiddenField -> field.value.size is Hosts -> field.value.size + is IsSsidHidden -> field.value.size is KeyPairs -> field.value.size is LicenseNumber -> field.value.size is Login -> field.value.size @@ -158,19 +162,26 @@ internal fun getFieldValuesCount(field: KeeperRecordField): Int { is OneTimeCode -> field.value.size is OneTimePassword -> field.value.size is PamHostnames -> field.value.size + is PamProvider -> field.value.size + is PamRemoteBrowserSettings -> field.value.size is PamResources -> field.value.size + is PamSettings -> field.value.size is Passkeys -> field.value.size is Password -> field.value.size is PaymentCards -> field.value.size is Phones -> field.value.size is PinCode -> field.value.size + is RbiUrl -> field.value.size is RecordRef -> field.value.size is Schedules -> field.value.size is Scripts -> field.value.size is SecureNote -> field.value.size is SecurityQuestions -> field.value.size is Text -> field.value.size + is TrafficEncryptionKey -> field.value.size + is TrafficEncryptionSeed -> field.value.size is Url -> field.value.size + is WifiEncryption -> field.value.size } } @@ -181,6 +192,14 @@ internal fun getFieldValuesCount(field: KeeperRecordField): Int { internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, property: String? = null): List { val emptyRes = listOf() return when (field) { + is AppFillers -> if (index >= field.value.size) emptyRes + else if (index < 0) { + if (property == null) field.value.map { Json.encodeToString(it) }.toList() + else field.value.map { getObjectProperty(it, property) }.toList() + } else { + if (property == null) listOf(Json.encodeToString(field.value[index])) + else listOf(getObjectProperty(field.value[index], property)) + } is AccountNumber -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) is AddressRef -> if (index >= field.value.size || property != null) emptyRes @@ -207,12 +226,16 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro else if (index < 0) field.value else listOf(field.value[index]) is Checkbox -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value.map { it.toString() }.toList() else listOf(field.value[index].toString()) + is Controller -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) is DatabaseType -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) is Date -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value.map { it.toString() }.toList() else listOf(field.value[index].toString()) is DirectoryType -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) + is Dropdown -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) is Email -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) is ExpirationDate -> if (index >= field.value.size || property != null) emptyRes @@ -229,6 +252,8 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro if (property == null) listOf(Json.encodeToString(field.value[index])) else listOf(getObjectProperty(field.value[index], property)) } + is IsSsidHidden -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value.map { it.toString() }.toList() else listOf(field.value[index].toString()) is KeyPairs -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value.map { it.toString() }.toList() else listOf(field.value[index].toString()) is LicenseNumber -> if (index >= field.value.size || property != null) emptyRes @@ -257,6 +282,16 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro if (property == null) listOf(Json.encodeToString(field.value[index])) else listOf(getObjectProperty(field.value[index], property)) } + is PamProvider -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) + is PamRemoteBrowserSettings -> if (index >= field.value.size) emptyRes + else if (index < 0) { + if (property == null) field.value.map { Json.encodeToString(it) }.toList() + else field.value.map { getObjectProperty(it, property) }.toList() + } else { + if (property == null) listOf(Json.encodeToString(field.value[index])) + else listOf(getObjectProperty(field.value[index], property)) + } is PamResources -> if (index >= field.value.size) emptyRes else if (index < 0) { if (property == null) field.value.map { Json.encodeToString(it) }.toList() @@ -265,6 +300,14 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro if (property == null) listOf(Json.encodeToString(field.value[index])) else listOf(getObjectProperty(field.value[index], property)) } + is PamSettings -> if (index >= field.value.size) emptyRes + else if (index < 0) { + if (property == null) field.value.map { Json.encodeToString(it) }.toList() + else field.value.map { getObjectProperty(it, property) }.toList() + } else { + if (property == null) listOf(Json.encodeToString(field.value[index])) + else listOf(getObjectProperty(field.value[index], property)) + } is Passkeys -> if (index >= field.value.size) emptyRes else if (index < 0) { if (property == null) field.value.map { Json.encodeToString(it) }.toList() @@ -293,6 +336,8 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro } is PinCode -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) + is RbiUrl -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) is RecordRef -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) is Schedules -> if (index >= field.value.size) emptyRes @@ -323,14 +368,21 @@ internal fun getFieldStringValues(field: KeeperRecordField, index: Int = -1, pro } is Text -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) + is TrafficEncryptionKey -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) + is TrafficEncryptionSeed -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) is Url -> if (index >= field.value.size || property != null) emptyRes else if (index < 0) field.value else listOf(field.value[index]) + is WifiEncryption -> if (index >= field.value.size || property != null) emptyRes + else if (index < 0) field.value else listOf(field.value[index]) } } @ExperimentalSerializationApi private fun getFieldStringValue(field: KeeperRecordField, valueIdx: Int): String { return when (field) { + is AppFillers -> Json.encodeToString(field.value[valueIdx]) is AccountNumber -> field.value[valueIdx] is AddressRef -> field.value[valueIdx] is Addresses -> Json.encodeToString(field.value[valueIdx]) @@ -338,14 +390,17 @@ private fun getFieldStringValue(field: KeeperRecordField, valueIdx: Int): String is BirthDate -> field.value[valueIdx].toString() is CardRef -> field.value[valueIdx] is Checkbox -> field.value[valueIdx].toString() + is Controller -> field.value[valueIdx] is DatabaseType -> field.value[valueIdx] is Date -> field.value[valueIdx].toString() is DirectoryType -> field.value[valueIdx] + is Dropdown -> field.value[valueIdx] is Email -> field.value[valueIdx] is ExpirationDate -> field.value[valueIdx].toString() is FileRef -> field.value[valueIdx] is HiddenField -> field.value[valueIdx] is Hosts -> Json.encodeToString(field.value[valueIdx]) + is IsSsidHidden -> field.value[valueIdx].toString() is KeyPairs -> field.value[valueIdx].toString() is LicenseNumber -> field.value[valueIdx] is Login -> field.value[valueIdx] @@ -354,30 +409,40 @@ private fun getFieldStringValue(field: KeeperRecordField, valueIdx: Int): String is OneTimeCode -> field.value[valueIdx] is OneTimePassword -> field.value[valueIdx] is PamHostnames -> Json.encodeToString(field.value[valueIdx]) + is PamProvider -> field.value[valueIdx] + is PamRemoteBrowserSettings -> Json.encodeToString(field.value[valueIdx]) is PamResources -> Json.encodeToString(field.value[valueIdx]) + is PamSettings -> Json.encodeToString(field.value[valueIdx]) is Passkeys -> Json.encodeToString(field.value[valueIdx]) is Password -> field.value[valueIdx] is PaymentCards -> Json.encodeToString(field.value[valueIdx]) is Phones -> Json.encodeToString(field.value[valueIdx]) is PinCode -> field.value[valueIdx] + is RbiUrl -> field.value[valueIdx] is RecordRef -> field.value[valueIdx] is Schedules -> Json.encodeToString(field.value[valueIdx]) is Scripts -> Json.encodeToString(field.value[valueIdx]) is SecureNote -> field.value[valueIdx] is SecurityQuestions -> Json.encodeToString(field.value[valueIdx]) is Text -> field.value[valueIdx] + is TrafficEncryptionKey -> field.value[valueIdx] + is TrafficEncryptionSeed -> field.value[valueIdx] is Url -> field.value[valueIdx] + is WifiEncryption -> field.value[valueIdx] } } private fun getFieldValueProperty(field: KeeperRecordField, valueIdx: Int, propertyName: String): String { return when (field) { + is AppFillers -> getObjectProperty(field.value[valueIdx], propertyName) is Addresses -> getObjectProperty(field.value[valueIdx], propertyName) is BankAccounts -> getObjectProperty(field.value[valueIdx], propertyName) is Hosts -> getObjectProperty(field.value[valueIdx], propertyName) is Names -> getObjectProperty(field.value[valueIdx], propertyName) is PamHostnames -> getObjectProperty(field.value[valueIdx], propertyName) + is PamRemoteBrowserSettings -> getObjectProperty(field.value[valueIdx], propertyName) is PamResources -> getObjectProperty(field.value[valueIdx], propertyName) + is PamSettings -> getObjectProperty(field.value[valueIdx], propertyName) is Passkeys -> getObjectProperty(field.value[valueIdx], propertyName) is PaymentCards -> getObjectProperty(field.value[valueIdx], propertyName) is Phones -> getObjectProperty(field.value[valueIdx], propertyName) @@ -395,6 +460,7 @@ private fun getObjectProperty(obj: Any, propertyName: String): String { @ExperimentalSerializationApi private fun getFieldJsonValue(field: KeeperRecordField): String { return when (field) { + is AppFillers -> Json.encodeToString(field.value) is AccountNumber -> Json.encodeToString(field.value) is AddressRef -> Json.encodeToString(field.value) is Addresses -> Json.encodeToString(field.value) @@ -402,14 +468,17 @@ private fun getFieldJsonValue(field: KeeperRecordField): String { is BirthDate -> Json.encodeToString(field.value) is CardRef -> Json.encodeToString(field.value) is Checkbox -> Json.encodeToString(field.value) + is Controller -> Json.encodeToString(field.value) is DatabaseType -> Json.encodeToString(field.value) is Date -> Json.encodeToString(field.value) is DirectoryType -> Json.encodeToString(field.value) + is Dropdown -> Json.encodeToString(field.value) is Email -> Json.encodeToString(field.value) is ExpirationDate -> Json.encodeToString(field.value) is FileRef -> Json.encodeToString(field.value) is HiddenField -> Json.encodeToString(field.value) is Hosts -> Json.encodeToString(field.value) + is IsSsidHidden -> Json.encodeToString(field.value) is KeyPairs -> Json.encodeToString(field.value) is LicenseNumber -> Json.encodeToString(field.value) is Login -> Json.encodeToString(field.value) @@ -418,19 +487,26 @@ private fun getFieldJsonValue(field: KeeperRecordField): String { is OneTimeCode -> Json.encodeToString(field.value) is OneTimePassword -> Json.encodeToString(field.value) is PamHostnames -> Json.encodeToString(field.value) + is PamProvider -> Json.encodeToString(field.value) + is PamRemoteBrowserSettings -> Json.encodeToString(field.value) is PamResources -> Json.encodeToString(field.value) + is PamSettings -> Json.encodeToString(field.value) is Passkeys -> Json.encodeToString(field.value) is Password -> Json.encodeToString(field.value) is PaymentCards -> Json.encodeToString(field.value) is Phones -> Json.encodeToString(field.value) is PinCode -> Json.encodeToString(field.value) + is RbiUrl -> Json.encodeToString(field.value) is RecordRef -> Json.encodeToString(field.value) is Schedules -> Json.encodeToString(field.value) is Scripts -> Json.encodeToString(field.value) is SecureNote -> Json.encodeToString(field.value) is SecurityQuestions -> Json.encodeToString(field.value) is Text -> Json.encodeToString(field.value) + is TrafficEncryptionKey -> Json.encodeToString(field.value) + is TrafficEncryptionSeed -> Json.encodeToString(field.value) is Url -> Json.encodeToString(field.value) + is WifiEncryption -> Json.encodeToString(field.value) } } diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt index beaa0444..033be2fe 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt @@ -28,6 +28,15 @@ sealed class KeeperRecordField { abstract val label: String? } +@Serializable +data class KeeperFileData( + val title: String, + val name: String, + val type: String? = null, + val size: Long, + val lastModified: Long +) + @Serializable @SerialName("login") data class Login @JvmOverloads constructor( @@ -36,10 +45,6 @@ data class Login @JvmOverloads constructor( var privacyScreen: Boolean? = null, val value: MutableList ) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -62,10 +67,6 @@ data class Password @JvmOverloads constructor( var complexity: PasswordComplexity? = null, val value: MutableList ) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, null, null, mutableListOf(value)) } @@ -76,22 +77,16 @@ data class Url @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } +// "file" - obsolete and removed legacy field - "fldt_file": { key: 'file_or_photo', default: "File or Photo" }, @Serializable @SerialName("fileRef") data class FileRef @JvmOverloads constructor( override var label: String? = null, var required: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, mutableListOf(value)) } @@ -102,11 +97,6 @@ data class OneTimeCode @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - * @param value TOTP URL. Ex. otpauth://totp/asdfsadf:asdf@asdf.com?secret=2355666655444334&issuer=asdfsadf&algorithm=SHA256&digits=6&period=30 - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -117,10 +107,6 @@ data class OneTimePassword @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -134,10 +120,6 @@ data class Names @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Name): this(null, null, null, mutableListOf(value)) } @@ -148,10 +130,6 @@ data class BirthDate @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Long): this(null, null, null, mutableListOf(value)) } @@ -162,10 +140,6 @@ data class Date @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Long): this(null, null, null, mutableListOf(value)) } @@ -176,10 +150,6 @@ data class ExpirationDate @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Long): this(null, null, null, mutableListOf(value)) } @@ -190,10 +160,6 @@ data class Text @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, var value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -208,10 +174,6 @@ data class SecurityQuestions @JvmOverloads constructor( var privacyScreen: Boolean? = null, val value: MutableList ) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: SecurityQuestion): this(null, null, null, mutableListOf(value)) } @@ -222,10 +184,6 @@ data class Multiline @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -236,10 +194,6 @@ data class Email @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -250,10 +204,6 @@ data class CardRef @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -264,10 +214,6 @@ data class AddressRef @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -278,10 +224,6 @@ data class PinCode @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -316,10 +258,6 @@ data class Phones @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: List) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Phone): this(null, null, null, mutableListOf(value)) } @@ -330,10 +268,6 @@ data class HiddenField @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: List) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -344,10 +278,6 @@ data class SecureNote @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: List) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -358,10 +288,6 @@ data class AccountNumber @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: List) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } @@ -379,10 +305,6 @@ data class PaymentCards @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField(){ - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: PaymentCard): this(null, null, null, mutableListOf(value)) } @@ -401,10 +323,6 @@ data class BankAccounts @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField() { - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: BankAccount): this(null, null, null, mutableListOf(value)) } @@ -421,10 +339,6 @@ data class KeyPairs @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField() { - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: KeyPair): this(null, null, null, mutableListOf(value)) } @@ -441,10 +355,6 @@ data class Hosts @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField() { - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Host): this(null, null, null, mutableListOf(value)) } @@ -465,10 +375,6 @@ data class Addresses @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList
) : KeeperRecordField() { - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: Address): this(null, null, null, mutableListOf(value)) } @@ -479,18 +385,24 @@ data class LicenseNumber @JvmOverloads constructor( var required: Boolean? = null, var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField() { - - /** - * Constructor with the single value to eliminate the complexity of the passing List as a value - */ constructor(value: String): this(null, null, null, mutableListOf(value)) } +@Serializable +@SerialName("allowedSettings") +data class AllowedSettings @JvmOverloads constructor( + val connections: Boolean? = null, + val portForwards: Boolean? = null, + val rotation: Boolean? = null, + val sessionRecording: Boolean? = null, + val typescriptRecording: Boolean? = null +) @Serializable data class PamResource @JvmOverloads constructor( val controllerUid: String? = null, val folderUid: String? = null, - val resourceRef: MutableList + val resourceRef: MutableList? = null, + val allowedSettings: AllowedSettings? = null ) @Serializable @@ -505,7 +417,10 @@ data class PamResources @JvmOverloads constructor( @Serializable data class Schedule @JvmOverloads constructor( val type: String? = null, - val utcTime: String? = null, + val cron: String? = null, + // utcTime - replaced by time and tz + val time: String? = null, + val tz: String? = null, val weekday: String? = null, val intervalCount: Int? = null ) @@ -571,7 +486,7 @@ data class PrivateKey @JvmOverloads constructor( val crv: String? = null, val d: String? = null, val ext: Boolean? = null, - val key_ops: List? = null, + @SerialName("key_ops") val keyOps: List? = null, val kty: String? = null, val x: String? = null, val y: String? = null @@ -616,10 +531,155 @@ data class Scripts @JvmOverloads constructor( } @Serializable -data class KeeperFileData( - val title: String, - val name: String, - val type: String? = null, - val size: Long, - val lastModified: Long -) \ No newline at end of file +@SerialName("isSSIDHidden") +data class IsSsidHidden @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + val value: MutableList) : KeeperRecordField(){ + constructor(value: Boolean): this(null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("wifiEncryption") +data class WifiEncryption @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("dropdown") +data class Dropdown @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("rbiUrl") +data class RbiUrl @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +@Serializable +data class AppFiller @JvmOverloads constructor( + val applicationTitle: String? = null, + val contentFilter: String? = null, + val macroSequence: String? = null, +) + +@Serializable +@SerialName("appFiller") +data class AppFillers @JvmOverloads constructor( + override val label: String? = null, + var required: Boolean? = null, + var privacyScreen: Boolean? = null, + val value: MutableList) : KeeperRecordField() { + constructor(value: AppFiller): this(null, null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("connection") +data class PamRbiConnection @JvmOverloads constructor( + val protocol: String? = null, + val enabled: Boolean? = null, + @SerialName("user_records") val userRecords: MutableList? = null, + @SerialName("allow-url-manipulation") val allowUrlManipulation: Boolean? = null, + @SerialName("allowed-url-patterns") val allowedUrlPatterns: String? = null, + @SerialName("allowed-resource-url-patterns") val allowedResourceUrlPatterns: String? = null, + @SerialName("http-credentials-uid") val httpCredentialsUid: String? = null, + @SerialName("autofill-configuration") val autofillConfiguration: String? = null +) +@Serializable +data class PamRemoteBrowserSetting @JvmOverloads constructor( + val connection: MutableList? = null, +) + +@Serializable +@SerialName("pamRemoteBrowserSettings") +data class PamRemoteBrowserSettings @JvmOverloads constructor( + override val label: String? = null, + var required: Boolean? = null, + val value: MutableList) : KeeperRecordField() { + constructor(value: PamRemoteBrowserSetting): this(null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("connection") +data class PamSettingsConnection @JvmOverloads constructor( + val protocol: String? = null, + val enabled: Boolean? = null, + @SerialName("user_records") val userRecords: MutableList? = null, + val security: String? = null, + @SerialName("ignore-cert") val ignoreCert: Boolean? = null, + @SerialName("resize-method") val resizeMethod: String? = null, + @SerialName("color-scheme") val colorScheme: String? = null +) +@Serializable +@SerialName("portForward") +data class PamSettingsPortForward @JvmOverloads constructor( + val enabled: Boolean? = null, + val reusePort: Boolean? = null, + val port: String? = null +) +@Serializable +data class PamSetting @JvmOverloads constructor( + val configUid: String? = null, + val adminCredentialUid: String? = null, + val portForward: MutableList? = null, + val connection: MutableList? = null, +) + +@Serializable +@SerialName("pamSettings") +data class PamSettings @JvmOverloads constructor( + override val label: String? = null, + var required: Boolean? = null, + val value: MutableList) : KeeperRecordField() { + constructor(value: PamSetting): this(null, null, mutableListOf(value)) +} + +@Serializable +@SerialName("trafficEncryptionSeed") +data class TrafficEncryptionSeed @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +// List of retired field types: +// Replaced by trafficEncryptionSeed +@Serializable +@SerialName("trafficEncryptionKey") +internal data class TrafficEncryptionKey @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +// Deprecated for legacy/internal use only +@Serializable +@SerialName("pamProvider") +internal data class PamProvider @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} + +// Deprecated for legacy/internal use only +@Serializable +@SerialName("controller") +internal data class Controller @JvmOverloads constructor( + override var label: String? = null, + var required: Boolean? = null, + var value: MutableList) : KeeperRecordField(){ + constructor(value: String): this(null, null, mutableListOf(value)) +} diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt index d5e3f3b3..b0091a7e 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.jsonPrimitive import java.net.HttpURLConnection.HTTP_OK -import java.net.URL +import java.net.URI import java.security.KeyManagementException import java.security.NoSuchAlgorithmException import java.security.SecureRandom @@ -669,7 +669,7 @@ fun downloadThumbnail(file: KeeperFile): ByteArray { } private fun downloadFile(file: KeeperFile, url: String): ByteArray { - with(URL(url).openConnection() as HttpsURLConnection) { + with(URI.create(url).toURL().openConnection() as HttpsURLConnection) { requestMethod = "GET" val statusCode = responseCode val data = when { @@ -689,7 +689,7 @@ private fun uploadFile(url: String, parameters: String, fileData: ByteArray): Ke val boundary = String.format("----------%x", Instant.now().epochSecond) val boundaryBytes: ByteArray = stringToBytes("\r\n--$boundary") val paramJson = Json.parseToJsonElement(parameters) as JsonObject - with(URL(url).openConnection() as HttpsURLConnection) { + with(URI.create(url).toURL().openConnection() as HttpsURLConnection) { requestMethod = "POST" useCaches = false doInput = true @@ -1055,7 +1055,7 @@ fun postFunction( ): KeeperHttpResponse { var statusCode: Int var data: ByteArray - with(URL(url).openConnection() as HttpsURLConnection) { + with(URI.create(url).toURL().openConnection() as HttpsURLConnection) { if (allowUnverifiedCertificate) { sslSocketFactory = trustAllSocketFactory() }