From e65e0f0b93169ef1cf0b08f73aa1f74ade525113 Mon Sep 17 00:00:00 2001 From: goncalo-frade-iohk <87179681+goncalo-frade-iohk@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:47:35 +0000 Subject: [PATCH] feat(mnemonic): js doesnt handle List and swift doesnt handle Array this is the solution (#105) --- .scripts/TemplatePackage.swift | 12 +- Package.swift | 16 +- aes/build.gradle.kts | 225 - apollo/build.gradle.kts | 28 +- base-asymmetric-encryption/build.gradle.kts | 54 +- .../atala/prism/apollo/derivation/Mnemonic.kt | 23 + .../prism/apollo/derivation/MnemonicCode.kt | 13 + .../prism/apollo/derivation/MnemonicCode.kt | 21 - .../apollo/derivation/MnemonicCodeEnglish.kt | 4106 ++++++++--------- .../prism/apollo/derivation/MnemonicHelper.kt | 84 + .../iohk/atala/prism/apollo/utils/Mnemonic.kt | 49 - .../prism/apollo/utils/bip39/MnemonicCode.kt | 54 - .../atala/prism/apollo/utils/MnemonicTests.kt | 26 +- .../atala/prism/apollo/derivation/Mnemonic.kt | 23 + .../prism/apollo/derivation/MnemonicCode.kt | 13 + .../atala/prism/apollo/derivation/Mnemonic.kt | 25 + .../prism/apollo/derivation/MnemonicCode.kt | 30 + .../atala/prism/apollo/derivation/Mnemonic.kt | 23 + .../prism/apollo/derivation/MnemonicCode.kt | 13 + base-symmetric-encryption/build.gradle.kts | 36 +- base16/build.gradle.kts | 30 +- base32/build.gradle.kts | 30 +- base58/build.gradle.kts | 30 +- base64/build.gradle.kts | 30 +- hashing/build.gradle.kts | 36 +- iOSLibs/build.gradle.kts | 128 - multibase/build.gradle.kts | 30 +- rsa/build.gradle.kts | 276 -- secp256k1-kmp/build.gradle.kts | 24 +- secure-random/build.gradle.kts | 42 +- utils/build.gradle.kts | 36 +- uuid/build.gradle.kts | 36 +- varint/build.gradle.kts | 36 +- 33 files changed, 2524 insertions(+), 3114 deletions(-) delete mode 100644 aes/build.gradle.kts create mode 100644 base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt create mode 100644 base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt delete mode 100644 base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt create mode 100644 base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicHelper.kt delete mode 100644 base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/Mnemonic.kt delete mode 100644 base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/bip39/MnemonicCode.kt create mode 100644 base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt create mode 100644 base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt create mode 100644 base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt create mode 100644 base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt create mode 100644 base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt create mode 100644 base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt delete mode 100644 rsa/build.gradle.kts diff --git a/.scripts/TemplatePackage.swift b/.scripts/TemplatePackage.swift index 5c21b8775..a7aa9a750 100644 --- a/.scripts/TemplatePackage.swift +++ b/.scripts/TemplatePackage.swift @@ -2,27 +2,27 @@ import PackageDescription let package = Package( - name: "Apollo", + name: "ApolloLibrary", platforms: [ .iOS(.v13), .macOS(.v11) ], products: [ .library( - name: "Apollo", - targets: ["Apollo"] + name: "ApolloLibrary", + targets: ["ApolloBinary"] ), ], targets: [ // LOCAL // .binaryTarget( - // name: "Apollo", - // path: "./Apollo.xcframework" + // name: "ApolloBinary", + // path: "./base-asymmetric-encryption/build/packages/ApolloSwift/Apollo.xcframework.zip" // ), // RELEASE .binaryTarget( - name: "Apollo", + name: "ApolloBinary", url: "https://github.com/input-output-hk/atala-prism-apollo/releases/download//Apollo.xcframework.zip", checksum: "" ) diff --git a/Package.swift b/Package.swift index 0ac014798..4234c34ee 100644 --- a/Package.swift +++ b/Package.swift @@ -2,29 +2,29 @@ import PackageDescription let package = Package( - name: "Apollo", + name: "ApolloLibrary", platforms: [ .iOS(.v13), .macOS(.v11) ], products: [ .library( - name: "Apollo", - targets: ["Apollo"] + name: "ApolloLibrary", + targets: ["ApolloBinary"] ), ], targets: [ // LOCAL // .binaryTarget( - // name: "Apollo", - // path: "./Apollo.xcframework" + // name: "ApolloBinary", + // path: "./base-asymmetric-encryption/build/packages/ApolloSwift/Apollo.xcframework.zip" // ), // RELEASE .binaryTarget( - name: "Apollo", - url: "https://github.com/input-output-hk/atala-prism-apollo/releases/download/1.0.3/Apollo.xcframework.zip", - checksum: "89989b558887431844d5395c845a098678577b3c1dc867146ca058f0ce9e63dd" + name: "ApolloBinary", + url: "https://github.com/input-output-hk/atala-prism-apollo/releases/download/testSwift2/Apollo.xcframework.zip", + checksum: "817420e940206f912c5dcf92acb3b38bd2b87caef6caebc707ff1ff98c5778b8" ) ] ) diff --git a/aes/build.gradle.kts b/aes/build.gradle.kts deleted file mode 100644 index 0b3f92945..000000000 --- a/aes/build.gradle.kts +++ /dev/null @@ -1,225 +0,0 @@ -import org.gradle.internal.os.OperatingSystem -import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target - -val currentModuleName = "ApolloAES" -val os: OperatingSystem = OperatingSystem.current() - -plugins { - kotlin("multiplatform") - id("com.android.library") - id("org.jetbrains.dokka") -} - -kotlin { - android { - publishAllLibraryVariants() - } - jvm { - compilations.all { - kotlinOptions { - jvmTarget = "11" - } - } - testRuns["test"].executionTask.configure { - useJUnitPlatform() - } - } - if (os.isMacOsX) { - ios() -// tvos() -// watchos() - macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() -// tvosSimulatorArm64() -// watchosSimulatorArm64() - macosArm64() - } - } -// if (os.isWindows) { -// // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// mingwX64() -// } - js(IR) { - this.moduleName = currentModuleName - this.binaries.library() - this.useCommonJs() - this.compilations["main"].packageJson { - this.version = rootProject.version.toString() - } - this.compilations["test"].packageJson { - this.version = rootProject.version.toString() - } - browser { - this.webpackTask { - this.output.library = currentModuleName - this.output.libraryTarget = Target.VAR - } - this.commonWebpackConfig { - this.cssSupport { - this.enabled = true - } - } - this.testTask { - this.useKarma { - this.useChromeHeadless() - } - } - } - nodejs { - this.testTask { - this.useKarma { - this.useChromeHeadless() - } - } - } - } - - sourceSets { - val commonMain by getting { - dependencies { - implementation(project(":utils")) - implementation(project(":base-symmetric-encryption")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - } - } - val commonTest by getting { - dependencies { - implementation(kotlin("test")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") - } - } - val jvmMain by getting - val jvmTest by getting - val androidMain by getting - val androidTest by getting { - dependencies { - implementation("junit:junit:4.13.2") - } - } - val jsMain by getting { - dependencies { - implementation("org.jetbrains.kotlin-wrappers:kotlin-web:1.0.0-pre.461") - implementation("org.jetbrains.kotlin-wrappers:kotlin-node:18.11.13-pre.461") - - // Polyfill dependencies - implementation(npm("crypto-browserify", "3.12.0")) - implementation(npm("stream-browserify", "3.0.0")) - } - } - val jsTest by getting - if (os.isMacOsX) { - val iosMain by getting { - this.dependsOn(commonMain) - } - val iosTest by getting { - this.dependsOn(commonTest) - } -// val tvosMain by getting -// val tvosTest by getting -// val watchosMain by getting -// val watchosTest by getting - val macosX64Main by getting { - this.dependsOn(iosMain) - } - val macosX64Test by getting { - this.dependsOn(iosTest) - } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } -// val tvosSimulatorArm64Main by getting { -// this.dependsOn(tvosMain) -// } -// val tvosSimulatorArm64Test by getting { -// this.dependsOn(tvosTest) -// } -// val watchosSimulatorArm64Main by getting { -// this.dependsOn(watchosMain) -// } -// val watchosSimulatorArm64Test by getting { -// this.dependsOn(watchosTest) -// } - val macosArm64Main by getting { - this.dependsOn(macosX64Main) - } - val macosArm64Test by getting { - this.dependsOn(macosX64Test) - } - } - } -// if (os.isWindows) { -// // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// // val mingwX86Test by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// val mingwX64Main by getting -// val mingwX64Test by getting -// } - } - - if (os.isMacOsX) { - tasks.getByName("iosX64Test") { - deviceId = "iPhone 14 Plus" - } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - deviceId = "iPhone 14 Plus" - } - } - } -} - -android { - compileSdk = 32 - sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") - defaultConfig { - minSdk = 21 - targetSdk = 32 - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - /** - * Because Software Components will not be created automatically for Maven publishing from - * Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android. - * disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new - * publishing DSL. - */ - publishing { - multipleVariants { - withSourcesJar() - withJavadocJar() - allVariants() - } - } -} - -// Dokka implementation -tasks.withType { - moduleName.set(project.name) - moduleVersion.set(rootProject.version.toString()) - description = """ - This is a Kotlin Multiplatform Library for AES - """.trimIndent() - dokkaSourceSets { - // TODO: Figure out how to include files to the documentations - named("commonMain") { - includes.from("Module.md", "docs/Module.md") - } - } -} - -// afterEvaluate { -// tasks.withType { -// testLogging { -// events("passed", "skipped", "failed", "standard_out", "standard_error") -// showExceptions = true -// showStackTraces = true -// } -// } -// } diff --git a/apollo/build.gradle.kts b/apollo/build.gradle.kts index dce120572..ca8136edf 100644 --- a/apollo/build.gradle.kts +++ b/apollo/build.gradle.kts @@ -27,10 +27,8 @@ kotlin { } if (os.isMacOsX) { ios() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() - macosArm64() - } + iosSimulatorArm64() + macosArm64() } js(IR) { this.moduleName = currentModuleName @@ -99,16 +97,14 @@ kotlin { val iosMain by getting val iosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } - val macosArm64Main by getting - val macosArm64Test by getting + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } + val macosArm64Main by getting + val macosArm64Test by getting } } @@ -116,10 +112,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base-asymmetric-encryption/build.gradle.kts b/base-asymmetric-encryption/build.gradle.kts index 4dd763461..a23967f46 100644 --- a/base-asymmetric-encryption/build.gradle.kts +++ b/base-asymmetric-encryption/build.gradle.kts @@ -63,27 +63,25 @@ kotlin { } } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64 { - binaries.framework { - baseName = currentModuleName - embedBitcode("disable") - } - - swiftCinterop("IOHKCryptoKit", name) - swiftCinterop("IOHKSecureRandomGeneration", name) + iosSimulatorArm64 { + binaries.framework { + baseName = currentModuleName + embedBitcode("disable") } + + swiftCinterop("IOHKCryptoKit", name) + swiftCinterop("IOHKSecureRandomGeneration", name) + } // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64 { - binaries.framework { - baseName = currentModuleName - embedBitcode("disable") - } - - swiftCinterop("IOHKCryptoKit", name) - swiftCinterop("IOHKSecureRandomGeneration", name) + macosArm64 { + binaries.framework { + baseName = currentModuleName + embedBitcode("disable") } + + swiftCinterop("IOHKCryptoKit", name) + swiftCinterop("IOHKSecureRandomGeneration", name) } js(IR) { this.moduleName = currentModuleName @@ -207,16 +205,14 @@ kotlin { val iosTest by getting { this.dependsOn(commonTest) } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } - val macosArm64Main by getting { this.dependsOn(iosMain) } - val macosArm64Test by getting { this.dependsOn(iosTest) } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) } + val macosArm64Main by getting { this.dependsOn(iosMain) } + val macosArm64Test by getting { this.dependsOn(iosTest) } // if (os.isWindows) { // val mingwX64Main by getting // val mingwX64Test by getting @@ -227,10 +223,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt b/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt new file mode 100644 index 000000000..2860a981b --- /dev/null +++ b/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt @@ -0,0 +1,23 @@ +package io.iohk.atala.prism.apollo.derivation + +final class Mnemonic { + companion object { + class InvalidMnemonicCode(code: String) : RuntimeException(code) + + fun isValidMnemonicCode(code: List): Boolean { + return MnemonicHelper.isValidMnemonicCode(code) + } + + fun createRandomMnemonics(): List { + return MnemonicHelper.createRandomMnemonics() + } + + fun createSeed(mnemonics: List, passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createSeed(mnemonics.toList(), passphrase) + } + + fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createRandomSeed(passphrase) + } + } +} diff --git a/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt b/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt new file mode 100644 index 000000000..001eb037f --- /dev/null +++ b/base-asymmetric-encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt @@ -0,0 +1,13 @@ +package io.iohk.atala.prism.apollo.derivation + +final class MnemonicCode constructor(val words: List) { + init { + if (words.size % 3 != 0) { + throw MnemonicLengthException("Can't create a DID from mnemonic that is not dividable by 3") + } + } + + fun toMnemonic(entropy: ByteArray): List { + return MnemonicHelper.toMnemonicCode(words, entropy) + } +} diff --git a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt deleted file mode 100644 index 5aaeca65d..000000000 --- a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt +++ /dev/null @@ -1,21 +0,0 @@ -package io.iohk.atala.prism.apollo.derivation - -import kotlin.js.ExperimentalJsExport -import kotlin.js.JsExport - -/** - * A model representing the Mnemonic Code - * - * @exception MnemonicLengthException in case it is not 24 words - */ -@OptIn(ExperimentalJsExport::class) -@JsExport -data class MnemonicCode -@Throws(MnemonicLengthException::class) -constructor(val words: List) { - init { - if (words.size % 3 != 0) { - throw MnemonicLengthException("Can't create a DID from mnemonic that is not dividable by 3") - } - } -} diff --git a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCodeEnglish.kt b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCodeEnglish.kt index 4dfa3e067..ac728ebf5 100644 --- a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCodeEnglish.kt +++ b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCodeEnglish.kt @@ -1,2059 +1,2055 @@ package io.iohk.atala.prism.apollo.derivation -import kotlin.js.ExperimentalJsExport -import kotlin.js.JsExport - -@OptIn(ExperimentalJsExport::class) -@JsExport internal object MnemonicCodeEnglish { - val wordList: List = listOf( - "abandon", - "ability", - "able", - "about", - "above", - "absent", - "absorb", - "abstract", - "absurd", - "abuse", - "access", - "accident", - "account", - "accuse", - "achieve", - "acid", - "acoustic", - "acquire", - "across", - "act", - "action", - "actor", - "actress", - "actual", - "adapt", - "add", - "addict", - "address", - "adjust", - "admit", - "adult", - "advance", - "advice", - "aerobic", - "affair", - "afford", - "afraid", - "again", - "age", - "agent", - "agree", - "ahead", - "aim", - "air", - "airport", - "aisle", - "alarm", - "album", - "alcohol", - "alert", - "alien", - "all", - "alley", - "allow", - "almost", - "alone", - "alpha", - "already", - "also", - "alter", - "always", - "amateur", - "amazing", - "among", - "amount", - "amused", - "analyst", - "anchor", - "ancient", - "anger", - "angle", - "angry", - "animal", - "ankle", - "announce", - "annual", - "another", - "answer", - "antenna", - "antique", - "anxiety", - "any", - "apart", - "apology", - "appear", - "apple", - "approve", - "april", - "arch", - "arctic", - "area", - "arena", - "argue", - "arm", - "armed", - "armor", - "army", - "around", - "arrange", - "arrest", - "arrive", - "arrow", - "art", - "artefact", - "artist", - "artwork", - "ask", - "aspect", - "assault", - "asset", - "assist", - "assume", - "asthma", - "athlete", - "atom", - "attack", - "attend", - "attitude", - "attract", - "auction", - "audit", - "august", - "aunt", - "author", - "auto", - "autumn", - "average", - "avocado", - "avoid", - "awake", - "aware", - "away", - "awesome", - "awful", - "awkward", - "axis", - "baby", - "bachelor", - "bacon", - "badge", - "bag", - "balance", - "balcony", - "ball", - "bamboo", - "banana", - "banner", - "bar", - "barely", - "bargain", - "barrel", - "base", - "basic", - "basket", - "battle", - "beach", - "bean", - "beauty", - "because", - "become", - "beef", - "before", - "begin", - "behave", - "behind", - "believe", - "below", - "belt", - "bench", - "benefit", - "best", - "betray", - "better", - "between", - "beyond", - "bicycle", - "bid", - "bike", - "bind", - "biology", - "bird", - "birth", - "bitter", - "black", - "blade", - "blame", - "blanket", - "blast", - "bleak", - "bless", - "blind", - "blood", - "blossom", - "blouse", - "blue", - "blur", - "blush", - "board", - "boat", - "body", - "boil", - "bomb", - "bone", - "bonus", - "book", - "boost", - "border", - "boring", - "borrow", - "boss", - "bottom", - "bounce", - "box", - "boy", - "bracket", - "brain", - "brand", - "brass", - "brave", - "bread", - "breeze", - "brick", - "bridge", - "brief", - "bright", - "bring", - "brisk", - "broccoli", - "broken", - "bronze", - "broom", - "brother", - "brown", - "brush", - "bubble", - "buddy", - "budget", - "buffalo", - "build", - "bulb", - "bulk", - "bullet", - "bundle", - "bunker", - "burden", - "burger", - "burst", - "bus", - "business", - "busy", - "butter", - "buyer", - "buzz", - "cabbage", - "cabin", - "cable", - "cactus", - "cage", - "cake", - "call", - "calm", - "camera", - "camp", - "can", - "canal", - "cancel", - "candy", - "cannon", - "canoe", - "canvas", - "canyon", - "capable", - "capital", - "captain", - "car", - "carbon", - "card", - "cargo", - "carpet", - "carry", - "cart", - "case", - "cash", - "casino", - "castle", - "casual", - "cat", - "catalog", - "catch", - "category", - "cattle", - "caught", - "cause", - "caution", - "cave", - "ceiling", - "celery", - "cement", - "census", - "century", - "cereal", - "certain", - "chair", - "chalk", - "champion", - "change", - "chaos", - "chapter", - "charge", - "chase", - "chat", - "cheap", - "check", - "cheese", - "chef", - "cherry", - "chest", - "chicken", - "chief", - "child", - "chimney", - "choice", - "choose", - "chronic", - "chuckle", - "chunk", - "churn", - "cigar", - "cinnamon", - "circle", - "citizen", - "city", - "civil", - "claim", - "clap", - "clarify", - "claw", - "clay", - "clean", - "clerk", - "clever", - "click", - "client", - "cliff", - "climb", - "clinic", - "clip", - "clock", - "clog", - "close", - "cloth", - "cloud", - "clown", - "club", - "clump", - "cluster", - "clutch", - "coach", - "coast", - "coconut", - "code", - "coffee", - "coil", - "coin", - "collect", - "color", - "column", - "combine", - "come", - "comfort", - "comic", - "common", - "company", - "concert", - "conduct", - "confirm", - "congress", - "connect", - "consider", - "control", - "convince", - "cook", - "cool", - "copper", - "copy", - "coral", - "core", - "corn", - "correct", - "cost", - "cotton", - "couch", - "country", - "couple", - "course", - "cousin", - "cover", - "coyote", - "crack", - "cradle", - "craft", - "cram", - "crane", - "crash", - "crater", - "crawl", - "crazy", - "cream", - "credit", - "creek", - "crew", - "cricket", - "crime", - "crisp", - "critic", - "crop", - "cross", - "crouch", - "crowd", - "crucial", - "cruel", - "cruise", - "crumble", - "crunch", - "crush", - "cry", - "crystal", - "cube", - "culture", - "cup", - "cupboard", - "curious", - "current", - "curtain", - "curve", - "cushion", - "custom", - "cute", - "cycle", - "dad", - "damage", - "damp", - "dance", - "danger", - "daring", - "dash", - "daughter", - "dawn", - "day", - "deal", - "debate", - "debris", - "decade", - "december", - "decide", - "decline", - "decorate", - "decrease", - "deer", - "defense", - "define", - "defy", - "degree", - "delay", - "deliver", - "demand", - "demise", - "denial", - "dentist", - "deny", - "depart", - "depend", - "deposit", - "depth", - "deputy", - "derive", - "describe", - "desert", - "design", - "desk", - "despair", - "destroy", - "detail", - "detect", - "develop", - "device", - "devote", - "diagram", - "dial", - "diamond", - "diary", - "dice", - "diesel", - "diet", - "differ", - "digital", - "dignity", - "dilemma", - "dinner", - "dinosaur", - "direct", - "dirt", - "disagree", - "discover", - "disease", - "dish", - "dismiss", - "disorder", - "display", - "distance", - "divert", - "divide", - "divorce", - "dizzy", - "doctor", - "document", - "dog", - "doll", - "dolphin", - "domain", - "donate", - "donkey", - "donor", - "door", - "dose", - "double", - "dove", - "draft", - "dragon", - "drama", - "drastic", - "draw", - "dream", - "dress", - "drift", - "drill", - "drink", - "drip", - "drive", - "drop", - "drum", - "dry", - "duck", - "dumb", - "dune", - "during", - "dust", - "dutch", - "duty", - "dwarf", - "dynamic", - "eager", - "eagle", - "early", - "earn", - "earth", - "easily", - "east", - "easy", - "echo", - "ecology", - "economy", - "edge", - "edit", - "educate", - "effort", - "egg", - "eight", - "either", - "elbow", - "elder", - "electric", - "elegant", - "element", - "elephant", - "elevator", - "elite", - "else", - "embark", - "embody", - "embrace", - "emerge", - "emotion", - "employ", - "empower", - "empty", - "enable", - "enact", - "end", - "endless", - "endorse", - "enemy", - "energy", - "enforce", - "engage", - "engine", - "enhance", - "enjoy", - "enlist", - "enough", - "enrich", - "enroll", - "ensure", - "enter", - "entire", - "entry", - "envelope", - "episode", - "equal", - "equip", - "era", - "erase", - "erode", - "erosion", - "error", - "erupt", - "escape", - "essay", - "essence", - "estate", - "eternal", - "ethics", - "evidence", - "evil", - "evoke", - "evolve", - "exact", - "example", - "excess", - "exchange", - "excite", - "exclude", - "excuse", - "execute", - "exercise", - "exhaust", - "exhibit", - "exile", - "exist", - "exit", - "exotic", - "expand", - "expect", - "expire", - "explain", - "expose", - "express", - "extend", - "extra", - "eye", - "eyebrow", - "fabric", - "face", - "faculty", - "fade", - "faint", - "faith", - "fall", - "false", - "fame", - "family", - "famous", - "fan", - "fancy", - "fantasy", - "farm", - "fashion", - "fat", - "fatal", - "father", - "fatigue", - "fault", - "favorite", - "feature", - "february", - "federal", - "fee", - "feed", - "feel", - "female", - "fence", - "festival", - "fetch", - "fever", - "few", - "fiber", - "fiction", - "field", - "figure", - "file", - "film", - "filter", - "final", - "find", - "fine", - "finger", - "finish", - "fire", - "firm", - "first", - "fiscal", - "fish", - "fit", - "fitness", - "fix", - "flag", - "flame", - "flash", - "flat", - "flavor", - "flee", - "flight", - "flip", - "float", - "flock", - "floor", - "flower", - "fluid", - "flush", - "fly", - "foam", - "focus", - "fog", - "foil", - "fold", - "follow", - "food", - "foot", - "force", - "forest", - "forget", - "fork", - "fortune", - "forum", - "forward", - "fossil", - "foster", - "found", - "fox", - "fragile", - "frame", - "frequent", - "fresh", - "friend", - "fringe", - "frog", - "front", - "frost", - "frown", - "frozen", - "fruit", - "fuel", - "fun", - "funny", - "furnace", - "fury", - "future", - "gadget", - "gain", - "galaxy", - "gallery", - "game", - "gap", - "garage", - "garbage", - "garden", - "garlic", - "garment", - "gas", - "gasp", - "gate", - "gather", - "gauge", - "gaze", - "general", - "genius", - "genre", - "gentle", - "genuine", - "gesture", - "ghost", - "giant", - "gift", - "giggle", - "ginger", - "giraffe", - "girl", - "give", - "glad", - "glance", - "glare", - "glass", - "glide", - "glimpse", - "globe", - "gloom", - "glory", - "glove", - "glow", - "glue", - "goat", - "goddess", - "gold", - "good", - "goose", - "gorilla", - "gospel", - "gossip", - "govern", - "gown", - "grab", - "grace", - "grain", - "grant", - "grape", - "grass", - "gravity", - "great", - "green", - "grid", - "grief", - "grit", - "grocery", - "group", - "grow", - "grunt", - "guard", - "guess", - "guide", - "guilt", - "guitar", - "gun", - "gym", - "habit", - "hair", - "half", - "hammer", - "hamster", - "hand", - "happy", - "harbor", - "hard", - "harsh", - "harvest", - "hat", - "have", - "hawk", - "hazard", - "head", - "health", - "heart", - "heavy", - "hedgehog", - "height", - "hello", - "helmet", - "help", - "hen", - "hero", - "hidden", - "high", - "hill", - "hint", - "hip", - "hire", - "history", - "hobby", - "hockey", - "hold", - "hole", - "holiday", - "hollow", - "home", - "honey", - "hood", - "hope", - "horn", - "horror", - "horse", - "hospital", - "host", - "hotel", - "hour", - "hover", - "hub", - "huge", - "human", - "humble", - "humor", - "hundred", - "hungry", - "hunt", - "hurdle", - "hurry", - "hurt", - "husband", - "hybrid", - "ice", - "icon", - "idea", - "identify", - "idle", - "ignore", - "ill", - "illegal", - "illness", - "image", - "imitate", - "immense", - "immune", - "impact", - "impose", - "improve", - "impulse", - "inch", - "include", - "income", - "increase", - "index", - "indicate", - "indoor", - "industry", - "infant", - "inflict", - "inform", - "inhale", - "inherit", - "initial", - "inject", - "injury", - "inmate", - "inner", - "innocent", - "input", - "inquiry", - "insane", - "insect", - "inside", - "inspire", - "install", - "intact", - "interest", - "into", - "invest", - "invite", - "involve", - "iron", - "island", - "isolate", - "issue", - "item", - "ivory", - "jacket", - "jaguar", - "jar", - "jazz", - "jealous", - "jeans", - "jelly", - "jewel", - "job", - "join", - "joke", - "journey", - "joy", - "judge", - "juice", - "jump", - "jungle", - "junior", - "junk", - "just", - "kangaroo", - "keen", - "keep", - "ketchup", - "key", - "kick", - "kid", - "kidney", - "kind", - "kingdom", - "kiss", - "kit", - "kitchen", - "kite", - "kitten", - "kiwi", - "knee", - "knife", - "knock", - "know", - "lab", - "label", - "labor", - "ladder", - "lady", - "lake", - "lamp", - "language", - "laptop", - "large", - "later", - "latin", - "laugh", - "laundry", - "lava", - "law", - "lawn", - "lawsuit", - "layer", - "lazy", - "leader", - "leaf", - "learn", - "leave", - "lecture", - "left", - "leg", - "legal", - "legend", - "leisure", - "lemon", - "lend", - "length", - "lens", - "leopard", - "lesson", - "letter", - "level", - "liar", - "liberty", - "library", - "license", - "life", - "lift", - "light", - "like", - "limb", - "limit", - "link", - "lion", - "liquid", - "list", - "little", - "live", - "lizard", - "load", - "loan", - "lobster", - "local", - "lock", - "logic", - "lonely", - "long", - "loop", - "lottery", - "loud", - "lounge", - "love", - "loyal", - "lucky", - "luggage", - "lumber", - "lunar", - "lunch", - "luxury", - "lyrics", - "machine", - "mad", - "magic", - "magnet", - "maid", - "mail", - "main", - "major", - "make", - "mammal", - "man", - "manage", - "mandate", - "mango", - "mansion", - "manual", - "maple", - "marble", - "march", - "margin", - "marine", - "market", - "marriage", - "mask", - "mass", - "master", - "match", - "material", - "math", - "matrix", - "matter", - "maximum", - "maze", - "meadow", - "mean", - "measure", - "meat", - "mechanic", - "medal", - "media", - "melody", - "melt", - "member", - "memory", - "mention", - "menu", - "mercy", - "merge", - "merit", - "merry", - "mesh", - "message", - "metal", - "method", - "middle", - "midnight", - "milk", - "million", - "mimic", - "mind", - "minimum", - "minor", - "minute", - "miracle", - "mirror", - "misery", - "miss", - "mistake", - "mix", - "mixed", - "mixture", - "mobile", - "model", - "modify", - "mom", - "moment", - "monitor", - "monkey", - "monster", - "month", - "moon", - "moral", - "more", - "morning", - "mosquito", - "mother", - "motion", - "motor", - "mountain", - "mouse", - "move", - "movie", - "much", - "muffin", - "mule", - "multiply", - "muscle", - "museum", - "mushroom", - "music", - "must", - "mutual", - "myself", - "mystery", - "myth", - "naive", - "name", - "napkin", - "narrow", - "nasty", - "nation", - "nature", - "near", - "neck", - "need", - "negative", - "neglect", - "neither", - "nephew", - "nerve", - "nest", - "net", - "network", - "neutral", - "never", - "news", - "next", - "nice", - "night", - "noble", - "noise", - "nominee", - "noodle", - "normal", - "north", - "nose", - "notable", - "note", - "nothing", - "notice", - "novel", - "now", - "nuclear", - "number", - "nurse", - "nut", - "oak", - "obey", - "object", - "oblige", - "obscure", - "observe", - "obtain", - "obvious", - "occur", - "ocean", - "october", - "odor", - "off", - "offer", - "office", - "often", - "oil", - "okay", - "old", - "olive", - "olympic", - "omit", - "once", - "one", - "onion", - "online", - "only", - "open", - "opera", - "opinion", - "oppose", - "option", - "orange", - "orbit", - "orchard", - "order", - "ordinary", - "organ", - "orient", - "original", - "orphan", - "ostrich", - "other", - "outdoor", - "outer", - "output", - "outside", - "oval", - "oven", - "over", - "own", - "owner", - "oxygen", - "oyster", - "ozone", - "pact", - "paddle", - "page", - "pair", - "palace", - "palm", - "panda", - "panel", - "panic", - "panther", - "paper", - "parade", - "parent", - "park", - "parrot", - "party", - "pass", - "patch", - "path", - "patient", - "patrol", - "pattern", - "pause", - "pave", - "payment", - "peace", - "peanut", - "pear", - "peasant", - "pelican", - "pen", - "penalty", - "pencil", - "people", - "pepper", - "perfect", - "permit", - "person", - "pet", - "phone", - "photo", - "phrase", - "physical", - "piano", - "picnic", - "picture", - "piece", - "pig", - "pigeon", - "pill", - "pilot", - "pink", - "pioneer", - "pipe", - "pistol", - "pitch", - "pizza", - "place", - "planet", - "plastic", - "plate", - "play", - "please", - "pledge", - "pluck", - "plug", - "plunge", - "poem", - "poet", - "point", - "polar", - "pole", - "police", - "pond", - "pony", - "pool", - "popular", - "portion", - "position", - "possible", - "post", - "potato", - "pottery", - "poverty", - "powder", - "power", - "practice", - "praise", - "predict", - "prefer", - "prepare", - "present", - "pretty", - "prevent", - "price", - "pride", - "primary", - "print", - "priority", - "prison", - "private", - "prize", - "problem", - "process", - "produce", - "profit", - "program", - "project", - "promote", - "proof", - "property", - "prosper", - "protect", - "proud", - "provide", - "public", - "pudding", - "pull", - "pulp", - "pulse", - "pumpkin", - "punch", - "pupil", - "puppy", - "purchase", - "purity", - "purpose", - "purse", - "push", - "put", - "puzzle", - "pyramid", - "quality", - "quantum", - "quarter", - "question", - "quick", - "quit", - "quiz", - "quote", - "rabbit", - "raccoon", - "race", - "rack", - "radar", - "radio", - "rail", - "rain", - "raise", - "rally", - "ramp", - "ranch", - "random", - "range", - "rapid", - "rare", - "rate", - "rather", - "raven", - "raw", - "razor", - "ready", - "real", - "reason", - "rebel", - "rebuild", - "recall", - "receive", - "recipe", - "record", - "recycle", - "reduce", - "reflect", - "reform", - "refuse", - "region", - "regret", - "regular", - "reject", - "relax", - "release", - "relief", - "rely", - "remain", - "remember", - "remind", - "remove", - "render", - "renew", - "rent", - "reopen", - "repair", - "repeat", - "replace", - "report", - "require", - "rescue", - "resemble", - "resist", - "resource", - "response", - "result", - "retire", - "retreat", - "return", - "reunion", - "reveal", - "review", - "reward", - "rhythm", - "rib", - "ribbon", - "rice", - "rich", - "ride", - "ridge", - "rifle", - "right", - "rigid", - "ring", - "riot", - "ripple", - "risk", - "ritual", - "rival", - "river", - "road", - "roast", - "robot", - "robust", - "rocket", - "romance", - "roof", - "rookie", - "room", - "rose", - "rotate", - "rough", - "round", - "route", - "royal", - "rubber", - "rude", - "rug", - "rule", - "run", - "runway", - "rural", - "sad", - "saddle", - "sadness", - "safe", - "sail", - "salad", - "salmon", - "salon", - "salt", - "salute", - "same", - "sample", - "sand", - "satisfy", - "satoshi", - "sauce", - "sausage", - "save", - "say", - "scale", - "scan", - "scare", - "scatter", - "scene", - "scheme", - "school", - "science", - "scissors", - "scorpion", - "scout", - "scrap", - "screen", - "script", - "scrub", - "sea", - "search", - "season", - "seat", - "second", - "secret", - "section", - "security", - "seed", - "seek", - "segment", - "select", - "sell", - "seminar", - "senior", - "sense", - "sentence", - "series", - "service", - "session", - "settle", - "setup", - "seven", - "shadow", - "shaft", - "shallow", - "share", - "shed", - "shell", - "sheriff", - "shield", - "shift", - "shine", - "ship", - "shiver", - "shock", - "shoe", - "shoot", - "shop", - "short", - "shoulder", - "shove", - "shrimp", - "shrug", - "shuffle", - "shy", - "sibling", - "sick", - "side", - "siege", - "sight", - "sign", - "silent", - "silk", - "silly", - "silver", - "similar", - "simple", - "since", - "sing", - "siren", - "sister", - "situate", - "six", - "size", - "skate", - "sketch", - "ski", - "skill", - "skin", - "skirt", - "skull", - "slab", - "slam", - "sleep", - "slender", - "slice", - "slide", - "slight", - "slim", - "slogan", - "slot", - "slow", - "slush", - "small", - "smart", - "smile", - "smoke", - "smooth", - "snack", - "snake", - "snap", - "sniff", - "snow", - "soap", - "soccer", - "social", - "sock", - "soda", - "soft", - "solar", - "soldier", - "solid", - "solution", - "solve", - "someone", - "song", - "soon", - "sorry", - "sort", - "soul", - "sound", - "soup", - "source", - "south", - "space", - "spare", - "spatial", - "spawn", - "speak", - "special", - "speed", - "spell", - "spend", - "sphere", - "spice", - "spider", - "spike", - "spin", - "spirit", - "split", - "spoil", - "sponsor", - "spoon", - "sport", - "spot", - "spray", - "spread", - "spring", - "spy", - "square", - "squeeze", - "squirrel", - "stable", - "stadium", - "staff", - "stage", - "stairs", - "stamp", - "stand", - "start", - "state", - "stay", - "steak", - "steel", - "stem", - "step", - "stereo", - "stick", - "still", - "sting", - "stock", - "stomach", - "stone", - "stool", - "story", - "stove", - "strategy", - "street", - "strike", - "strong", - "struggle", - "student", - "stuff", - "stumble", - "style", - "subject", - "submit", - "subway", - "success", - "such", - "sudden", - "suffer", - "sugar", - "suggest", - "suit", - "summer", - "sun", - "sunny", - "sunset", - "super", - "supply", - "supreme", - "sure", - "surface", - "surge", - "surprise", - "surround", - "survey", - "suspect", - "sustain", - "swallow", - "swamp", - "swap", - "swarm", - "swear", - "sweet", - "swift", - "swim", - "swing", - "switch", - "sword", - "symbol", - "symptom", - "syrup", - "system", - "table", - "tackle", - "tag", - "tail", - "talent", - "talk", - "tank", - "tape", - "target", - "task", - "taste", - "tattoo", - "taxi", - "teach", - "team", - "tell", - "ten", - "tenant", - "tennis", - "tent", - "term", - "test", - "text", - "thank", - "that", - "theme", - "then", - "theory", - "there", - "they", - "thing", - "this", - "thought", - "three", - "thrive", - "throw", - "thumb", - "thunder", - "ticket", - "tide", - "tiger", - "tilt", - "timber", - "time", - "tiny", - "tip", - "tired", - "tissue", - "title", - "toast", - "tobacco", - "today", - "toddler", - "toe", - "together", - "toilet", - "token", - "tomato", - "tomorrow", - "tone", - "tongue", - "tonight", - "tool", - "tooth", - "top", - "topic", - "topple", - "torch", - "tornado", - "tortoise", - "toss", - "total", - "tourist", - "toward", - "tower", - "town", - "toy", - "track", - "trade", - "traffic", - "tragic", - "train", - "transfer", - "trap", - "trash", - "travel", - "tray", - "treat", - "tree", - "trend", - "trial", - "tribe", - "trick", - "trigger", - "trim", - "trip", - "trophy", - "trouble", - "truck", - "true", - "truly", - "trumpet", - "trust", - "truth", - "try", - "tube", - "tuition", - "tumble", - "tuna", - "tunnel", - "turkey", - "turn", - "turtle", - "twelve", - "twenty", - "twice", - "twin", - "twist", - "two", - "type", - "typical", - "ugly", - "umbrella", - "unable", - "unaware", - "uncle", - "uncover", - "under", - "undo", - "unfair", - "unfold", - "unhappy", - "uniform", - "unique", - "unit", - "universe", - "unknown", - "unlock", - "until", - "unusual", - "unveil", - "update", - "upgrade", - "uphold", - "upon", - "upper", - "upset", - "urban", - "urge", - "usage", - "use", - "used", - "useful", - "useless", - "usual", - "utility", - "vacant", - "vacuum", - "vague", - "valid", - "valley", - "valve", - "van", - "vanish", - "vapor", - "various", - "vast", - "vault", - "vehicle", - "velvet", - "vendor", - "venture", - "venue", - "verb", - "verify", - "version", - "very", - "vessel", - "veteran", - "viable", - "vibrant", - "vicious", - "victory", - "video", - "view", - "village", - "vintage", - "violin", - "virtual", - "virus", - "visa", - "visit", - "visual", - "vital", - "vivid", - "vocal", - "voice", - "void", - "volcano", - "volume", - "vote", - "voyage", - "wage", - "wagon", - "wait", - "walk", - "wall", - "walnut", - "want", - "warfare", - "warm", - "warrior", - "wash", - "wasp", - "waste", - "water", - "wave", - "way", - "wealth", - "weapon", - "wear", - "weasel", - "weather", - "web", - "wedding", - "weekend", - "weird", - "welcome", - "west", - "wet", - "whale", - "what", - "wheat", - "wheel", - "when", - "where", - "whip", - "whisper", - "wide", - "width", - "wife", - "wild", - "will", - "win", - "window", - "wine", - "wing", - "wink", - "winner", - "winter", - "wire", - "wisdom", - "wise", - "wish", - "witness", - "wolf", - "woman", - "wonder", - "wood", - "wool", - "word", - "work", - "world", - "worry", - "worth", - "wrap", - "wreck", - "wrestle", - "wrist", - "write", - "wrong", - "yard", - "year", - "yellow", - "you", - "young", - "youth", - "zebra", - "zero", - "zone", - "zoo", - ) + val wordList: List = + listOf( + "abandon", + "ability", + "able", + "about", + "above", + "absent", + "absorb", + "abstract", + "absurd", + "abuse", + "access", + "accident", + "account", + "accuse", + "achieve", + "acid", + "acoustic", + "acquire", + "across", + "act", + "action", + "actor", + "actress", + "actual", + "adapt", + "add", + "addict", + "address", + "adjust", + "admit", + "adult", + "advance", + "advice", + "aerobic", + "affair", + "afford", + "afraid", + "again", + "age", + "agent", + "agree", + "ahead", + "aim", + "air", + "airport", + "aisle", + "alarm", + "album", + "alcohol", + "alert", + "alien", + "all", + "alley", + "allow", + "almost", + "alone", + "alpha", + "already", + "also", + "alter", + "always", + "amateur", + "amazing", + "among", + "amount", + "amused", + "analyst", + "anchor", + "ancient", + "anger", + "angle", + "angry", + "animal", + "ankle", + "announce", + "annual", + "another", + "answer", + "antenna", + "antique", + "anxiety", + "any", + "apart", + "apology", + "appear", + "apple", + "approve", + "april", + "arch", + "arctic", + "area", + "arena", + "argue", + "arm", + "armed", + "armor", + "army", + "around", + "arrange", + "arrest", + "arrive", + "arrow", + "art", + "artefact", + "artist", + "artwork", + "ask", + "aspect", + "assault", + "asset", + "assist", + "assume", + "asthma", + "athlete", + "atom", + "attack", + "attend", + "attitude", + "attract", + "auction", + "audit", + "august", + "aunt", + "author", + "auto", + "autumn", + "average", + "avocado", + "avoid", + "awake", + "aware", + "away", + "awesome", + "awful", + "awkward", + "axis", + "baby", + "bachelor", + "bacon", + "badge", + "bag", + "balance", + "balcony", + "ball", + "bamboo", + "banana", + "banner", + "bar", + "barely", + "bargain", + "barrel", + "base", + "basic", + "basket", + "battle", + "beach", + "bean", + "beauty", + "because", + "become", + "beef", + "before", + "begin", + "behave", + "behind", + "believe", + "below", + "belt", + "bench", + "benefit", + "best", + "betray", + "better", + "between", + "beyond", + "bicycle", + "bid", + "bike", + "bind", + "biology", + "bird", + "birth", + "bitter", + "black", + "blade", + "blame", + "blanket", + "blast", + "bleak", + "bless", + "blind", + "blood", + "blossom", + "blouse", + "blue", + "blur", + "blush", + "board", + "boat", + "body", + "boil", + "bomb", + "bone", + "bonus", + "book", + "boost", + "border", + "boring", + "borrow", + "boss", + "bottom", + "bounce", + "box", + "boy", + "bracket", + "brain", + "brand", + "brass", + "brave", + "bread", + "breeze", + "brick", + "bridge", + "brief", + "bright", + "bring", + "brisk", + "broccoli", + "broken", + "bronze", + "broom", + "brother", + "brown", + "brush", + "bubble", + "buddy", + "budget", + "buffalo", + "build", + "bulb", + "bulk", + "bullet", + "bundle", + "bunker", + "burden", + "burger", + "burst", + "bus", + "business", + "busy", + "butter", + "buyer", + "buzz", + "cabbage", + "cabin", + "cable", + "cactus", + "cage", + "cake", + "call", + "calm", + "camera", + "camp", + "can", + "canal", + "cancel", + "candy", + "cannon", + "canoe", + "canvas", + "canyon", + "capable", + "capital", + "captain", + "car", + "carbon", + "card", + "cargo", + "carpet", + "carry", + "cart", + "case", + "cash", + "casino", + "castle", + "casual", + "cat", + "catalog", + "catch", + "category", + "cattle", + "caught", + "cause", + "caution", + "cave", + "ceiling", + "celery", + "cement", + "census", + "century", + "cereal", + "certain", + "chair", + "chalk", + "champion", + "change", + "chaos", + "chapter", + "charge", + "chase", + "chat", + "cheap", + "check", + "cheese", + "chef", + "cherry", + "chest", + "chicken", + "chief", + "child", + "chimney", + "choice", + "choose", + "chronic", + "chuckle", + "chunk", + "churn", + "cigar", + "cinnamon", + "circle", + "citizen", + "city", + "civil", + "claim", + "clap", + "clarify", + "claw", + "clay", + "clean", + "clerk", + "clever", + "click", + "client", + "cliff", + "climb", + "clinic", + "clip", + "clock", + "clog", + "close", + "cloth", + "cloud", + "clown", + "club", + "clump", + "cluster", + "clutch", + "coach", + "coast", + "coconut", + "code", + "coffee", + "coil", + "coin", + "collect", + "color", + "column", + "combine", + "come", + "comfort", + "comic", + "common", + "company", + "concert", + "conduct", + "confirm", + "congress", + "connect", + "consider", + "control", + "convince", + "cook", + "cool", + "copper", + "copy", + "coral", + "core", + "corn", + "correct", + "cost", + "cotton", + "couch", + "country", + "couple", + "course", + "cousin", + "cover", + "coyote", + "crack", + "cradle", + "craft", + "cram", + "crane", + "crash", + "crater", + "crawl", + "crazy", + "cream", + "credit", + "creek", + "crew", + "cricket", + "crime", + "crisp", + "critic", + "crop", + "cross", + "crouch", + "crowd", + "crucial", + "cruel", + "cruise", + "crumble", + "crunch", + "crush", + "cry", + "crystal", + "cube", + "culture", + "cup", + "cupboard", + "curious", + "current", + "curtain", + "curve", + "cushion", + "custom", + "cute", + "cycle", + "dad", + "damage", + "damp", + "dance", + "danger", + "daring", + "dash", + "daughter", + "dawn", + "day", + "deal", + "debate", + "debris", + "decade", + "december", + "decide", + "decline", + "decorate", + "decrease", + "deer", + "defense", + "define", + "defy", + "degree", + "delay", + "deliver", + "demand", + "demise", + "denial", + "dentist", + "deny", + "depart", + "depend", + "deposit", + "depth", + "deputy", + "derive", + "describe", + "desert", + "design", + "desk", + "despair", + "destroy", + "detail", + "detect", + "develop", + "device", + "devote", + "diagram", + "dial", + "diamond", + "diary", + "dice", + "diesel", + "diet", + "differ", + "digital", + "dignity", + "dilemma", + "dinner", + "dinosaur", + "direct", + "dirt", + "disagree", + "discover", + "disease", + "dish", + "dismiss", + "disorder", + "display", + "distance", + "divert", + "divide", + "divorce", + "dizzy", + "doctor", + "document", + "dog", + "doll", + "dolphin", + "domain", + "donate", + "donkey", + "donor", + "door", + "dose", + "double", + "dove", + "draft", + "dragon", + "drama", + "drastic", + "draw", + "dream", + "dress", + "drift", + "drill", + "drink", + "drip", + "drive", + "drop", + "drum", + "dry", + "duck", + "dumb", + "dune", + "during", + "dust", + "dutch", + "duty", + "dwarf", + "dynamic", + "eager", + "eagle", + "early", + "earn", + "earth", + "easily", + "east", + "easy", + "echo", + "ecology", + "economy", + "edge", + "edit", + "educate", + "effort", + "egg", + "eight", + "either", + "elbow", + "elder", + "electric", + "elegant", + "element", + "elephant", + "elevator", + "elite", + "else", + "embark", + "embody", + "embrace", + "emerge", + "emotion", + "employ", + "empower", + "empty", + "enable", + "enact", + "end", + "endless", + "endorse", + "enemy", + "energy", + "enforce", + "engage", + "engine", + "enhance", + "enjoy", + "enlist", + "enough", + "enrich", + "enroll", + "ensure", + "enter", + "entire", + "entry", + "envelope", + "episode", + "equal", + "equip", + "era", + "erase", + "erode", + "erosion", + "error", + "erupt", + "escape", + "essay", + "essence", + "estate", + "eternal", + "ethics", + "evidence", + "evil", + "evoke", + "evolve", + "exact", + "example", + "excess", + "exchange", + "excite", + "exclude", + "excuse", + "execute", + "exercise", + "exhaust", + "exhibit", + "exile", + "exist", + "exit", + "exotic", + "expand", + "expect", + "expire", + "explain", + "expose", + "express", + "extend", + "extra", + "eye", + "eyebrow", + "fabric", + "face", + "faculty", + "fade", + "faint", + "faith", + "fall", + "false", + "fame", + "family", + "famous", + "fan", + "fancy", + "fantasy", + "farm", + "fashion", + "fat", + "fatal", + "father", + "fatigue", + "fault", + "favorite", + "feature", + "february", + "federal", + "fee", + "feed", + "feel", + "female", + "fence", + "festival", + "fetch", + "fever", + "few", + "fiber", + "fiction", + "field", + "figure", + "file", + "film", + "filter", + "final", + "find", + "fine", + "finger", + "finish", + "fire", + "firm", + "first", + "fiscal", + "fish", + "fit", + "fitness", + "fix", + "flag", + "flame", + "flash", + "flat", + "flavor", + "flee", + "flight", + "flip", + "float", + "flock", + "floor", + "flower", + "fluid", + "flush", + "fly", + "foam", + "focus", + "fog", + "foil", + "fold", + "follow", + "food", + "foot", + "force", + "forest", + "forget", + "fork", + "fortune", + "forum", + "forward", + "fossil", + "foster", + "found", + "fox", + "fragile", + "frame", + "frequent", + "fresh", + "friend", + "fringe", + "frog", + "front", + "frost", + "frown", + "frozen", + "fruit", + "fuel", + "fun", + "funny", + "furnace", + "fury", + "future", + "gadget", + "gain", + "galaxy", + "gallery", + "game", + "gap", + "garage", + "garbage", + "garden", + "garlic", + "garment", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaze", + "general", + "genius", + "genre", + "gentle", + "genuine", + "gesture", + "ghost", + "giant", + "gift", + "giggle", + "ginger", + "giraffe", + "girl", + "give", + "glad", + "glance", + "glare", + "glass", + "glide", + "glimpse", + "globe", + "gloom", + "glory", + "glove", + "glow", + "glue", + "goat", + "goddess", + "gold", + "good", + "goose", + "gorilla", + "gospel", + "gossip", + "govern", + "gown", + "grab", + "grace", + "grain", + "grant", + "grape", + "grass", + "gravity", + "great", + "green", + "grid", + "grief", + "grit", + "grocery", + "group", + "grow", + "grunt", + "guard", + "guess", + "guide", + "guilt", + "guitar", + "gun", + "gym", + "habit", + "hair", + "half", + "hammer", + "hamster", + "hand", + "happy", + "harbor", + "hard", + "harsh", + "harvest", + "hat", + "have", + "hawk", + "hazard", + "head", + "health", + "heart", + "heavy", + "hedgehog", + "height", + "hello", + "helmet", + "help", + "hen", + "hero", + "hidden", + "high", + "hill", + "hint", + "hip", + "hire", + "history", + "hobby", + "hockey", + "hold", + "hole", + "holiday", + "hollow", + "home", + "honey", + "hood", + "hope", + "horn", + "horror", + "horse", + "hospital", + "host", + "hotel", + "hour", + "hover", + "hub", + "huge", + "human", + "humble", + "humor", + "hundred", + "hungry", + "hunt", + "hurdle", + "hurry", + "hurt", + "husband", + "hybrid", + "ice", + "icon", + "idea", + "identify", + "idle", + "ignore", + "ill", + "illegal", + "illness", + "image", + "imitate", + "immense", + "immune", + "impact", + "impose", + "improve", + "impulse", + "inch", + "include", + "income", + "increase", + "index", + "indicate", + "indoor", + "industry", + "infant", + "inflict", + "inform", + "inhale", + "inherit", + "initial", + "inject", + "injury", + "inmate", + "inner", + "innocent", + "input", + "inquiry", + "insane", + "insect", + "inside", + "inspire", + "install", + "intact", + "interest", + "into", + "invest", + "invite", + "involve", + "iron", + "island", + "isolate", + "issue", + "item", + "ivory", + "jacket", + "jaguar", + "jar", + "jazz", + "jealous", + "jeans", + "jelly", + "jewel", + "job", + "join", + "joke", + "journey", + "joy", + "judge", + "juice", + "jump", + "jungle", + "junior", + "junk", + "just", + "kangaroo", + "keen", + "keep", + "ketchup", + "key", + "kick", + "kid", + "kidney", + "kind", + "kingdom", + "kiss", + "kit", + "kitchen", + "kite", + "kitten", + "kiwi", + "knee", + "knife", + "knock", + "know", + "lab", + "label", + "labor", + "ladder", + "lady", + "lake", + "lamp", + "language", + "laptop", + "large", + "later", + "latin", + "laugh", + "laundry", + "lava", + "law", + "lawn", + "lawsuit", + "layer", + "lazy", + "leader", + "leaf", + "learn", + "leave", + "lecture", + "left", + "leg", + "legal", + "legend", + "leisure", + "lemon", + "lend", + "length", + "lens", + "leopard", + "lesson", + "letter", + "level", + "liar", + "liberty", + "library", + "license", + "life", + "lift", + "light", + "like", + "limb", + "limit", + "link", + "lion", + "liquid", + "list", + "little", + "live", + "lizard", + "load", + "loan", + "lobster", + "local", + "lock", + "logic", + "lonely", + "long", + "loop", + "lottery", + "loud", + "lounge", + "love", + "loyal", + "lucky", + "luggage", + "lumber", + "lunar", + "lunch", + "luxury", + "lyrics", + "machine", + "mad", + "magic", + "magnet", + "maid", + "mail", + "main", + "major", + "make", + "mammal", + "man", + "manage", + "mandate", + "mango", + "mansion", + "manual", + "maple", + "marble", + "march", + "margin", + "marine", + "market", + "marriage", + "mask", + "mass", + "master", + "match", + "material", + "math", + "matrix", + "matter", + "maximum", + "maze", + "meadow", + "mean", + "measure", + "meat", + "mechanic", + "medal", + "media", + "melody", + "melt", + "member", + "memory", + "mention", + "menu", + "mercy", + "merge", + "merit", + "merry", + "mesh", + "message", + "metal", + "method", + "middle", + "midnight", + "milk", + "million", + "mimic", + "mind", + "minimum", + "minor", + "minute", + "miracle", + "mirror", + "misery", + "miss", + "mistake", + "mix", + "mixed", + "mixture", + "mobile", + "model", + "modify", + "mom", + "moment", + "monitor", + "monkey", + "monster", + "month", + "moon", + "moral", + "more", + "morning", + "mosquito", + "mother", + "motion", + "motor", + "mountain", + "mouse", + "move", + "movie", + "much", + "muffin", + "mule", + "multiply", + "muscle", + "museum", + "mushroom", + "music", + "must", + "mutual", + "myself", + "mystery", + "myth", + "naive", + "name", + "napkin", + "narrow", + "nasty", + "nation", + "nature", + "near", + "neck", + "need", + "negative", + "neglect", + "neither", + "nephew", + "nerve", + "nest", + "net", + "network", + "neutral", + "never", + "news", + "next", + "nice", + "night", + "noble", + "noise", + "nominee", + "noodle", + "normal", + "north", + "nose", + "notable", + "note", + "nothing", + "notice", + "novel", + "now", + "nuclear", + "number", + "nurse", + "nut", + "oak", + "obey", + "object", + "oblige", + "obscure", + "observe", + "obtain", + "obvious", + "occur", + "ocean", + "october", + "odor", + "off", + "offer", + "office", + "often", + "oil", + "okay", + "old", + "olive", + "olympic", + "omit", + "once", + "one", + "onion", + "online", + "only", + "open", + "opera", + "opinion", + "oppose", + "option", + "orange", + "orbit", + "orchard", + "order", + "ordinary", + "organ", + "orient", + "original", + "orphan", + "ostrich", + "other", + "outdoor", + "outer", + "output", + "outside", + "oval", + "oven", + "over", + "own", + "owner", + "oxygen", + "oyster", + "ozone", + "pact", + "paddle", + "page", + "pair", + "palace", + "palm", + "panda", + "panel", + "panic", + "panther", + "paper", + "parade", + "parent", + "park", + "parrot", + "party", + "pass", + "patch", + "path", + "patient", + "patrol", + "pattern", + "pause", + "pave", + "payment", + "peace", + "peanut", + "pear", + "peasant", + "pelican", + "pen", + "penalty", + "pencil", + "people", + "pepper", + "perfect", + "permit", + "person", + "pet", + "phone", + "photo", + "phrase", + "physical", + "piano", + "picnic", + "picture", + "piece", + "pig", + "pigeon", + "pill", + "pilot", + "pink", + "pioneer", + "pipe", + "pistol", + "pitch", + "pizza", + "place", + "planet", + "plastic", + "plate", + "play", + "please", + "pledge", + "pluck", + "plug", + "plunge", + "poem", + "poet", + "point", + "polar", + "pole", + "police", + "pond", + "pony", + "pool", + "popular", + "portion", + "position", + "possible", + "post", + "potato", + "pottery", + "poverty", + "powder", + "power", + "practice", + "praise", + "predict", + "prefer", + "prepare", + "present", + "pretty", + "prevent", + "price", + "pride", + "primary", + "print", + "priority", + "prison", + "private", + "prize", + "problem", + "process", + "produce", + "profit", + "program", + "project", + "promote", + "proof", + "property", + "prosper", + "protect", + "proud", + "provide", + "public", + "pudding", + "pull", + "pulp", + "pulse", + "pumpkin", + "punch", + "pupil", + "puppy", + "purchase", + "purity", + "purpose", + "purse", + "push", + "put", + "puzzle", + "pyramid", + "quality", + "quantum", + "quarter", + "question", + "quick", + "quit", + "quiz", + "quote", + "rabbit", + "raccoon", + "race", + "rack", + "radar", + "radio", + "rail", + "rain", + "raise", + "rally", + "ramp", + "ranch", + "random", + "range", + "rapid", + "rare", + "rate", + "rather", + "raven", + "raw", + "razor", + "ready", + "real", + "reason", + "rebel", + "rebuild", + "recall", + "receive", + "recipe", + "record", + "recycle", + "reduce", + "reflect", + "reform", + "refuse", + "region", + "regret", + "regular", + "reject", + "relax", + "release", + "relief", + "rely", + "remain", + "remember", + "remind", + "remove", + "render", + "renew", + "rent", + "reopen", + "repair", + "repeat", + "replace", + "report", + "require", + "rescue", + "resemble", + "resist", + "resource", + "response", + "result", + "retire", + "retreat", + "return", + "reunion", + "reveal", + "review", + "reward", + "rhythm", + "rib", + "ribbon", + "rice", + "rich", + "ride", + "ridge", + "rifle", + "right", + "rigid", + "ring", + "riot", + "ripple", + "risk", + "ritual", + "rival", + "river", + "road", + "roast", + "robot", + "robust", + "rocket", + "romance", + "roof", + "rookie", + "room", + "rose", + "rotate", + "rough", + "round", + "route", + "royal", + "rubber", + "rude", + "rug", + "rule", + "run", + "runway", + "rural", + "sad", + "saddle", + "sadness", + "safe", + "sail", + "salad", + "salmon", + "salon", + "salt", + "salute", + "same", + "sample", + "sand", + "satisfy", + "satoshi", + "sauce", + "sausage", + "save", + "say", + "scale", + "scan", + "scare", + "scatter", + "scene", + "scheme", + "school", + "science", + "scissors", + "scorpion", + "scout", + "scrap", + "screen", + "script", + "scrub", + "sea", + "search", + "season", + "seat", + "second", + "secret", + "section", + "security", + "seed", + "seek", + "segment", + "select", + "sell", + "seminar", + "senior", + "sense", + "sentence", + "series", + "service", + "session", + "settle", + "setup", + "seven", + "shadow", + "shaft", + "shallow", + "share", + "shed", + "shell", + "sheriff", + "shield", + "shift", + "shine", + "ship", + "shiver", + "shock", + "shoe", + "shoot", + "shop", + "short", + "shoulder", + "shove", + "shrimp", + "shrug", + "shuffle", + "shy", + "sibling", + "sick", + "side", + "siege", + "sight", + "sign", + "silent", + "silk", + "silly", + "silver", + "similar", + "simple", + "since", + "sing", + "siren", + "sister", + "situate", + "six", + "size", + "skate", + "sketch", + "ski", + "skill", + "skin", + "skirt", + "skull", + "slab", + "slam", + "sleep", + "slender", + "slice", + "slide", + "slight", + "slim", + "slogan", + "slot", + "slow", + "slush", + "small", + "smart", + "smile", + "smoke", + "smooth", + "snack", + "snake", + "snap", + "sniff", + "snow", + "soap", + "soccer", + "social", + "sock", + "soda", + "soft", + "solar", + "soldier", + "solid", + "solution", + "solve", + "someone", + "song", + "soon", + "sorry", + "sort", + "soul", + "sound", + "soup", + "source", + "south", + "space", + "spare", + "spatial", + "spawn", + "speak", + "special", + "speed", + "spell", + "spend", + "sphere", + "spice", + "spider", + "spike", + "spin", + "spirit", + "split", + "spoil", + "sponsor", + "spoon", + "sport", + "spot", + "spray", + "spread", + "spring", + "spy", + "square", + "squeeze", + "squirrel", + "stable", + "stadium", + "staff", + "stage", + "stairs", + "stamp", + "stand", + "start", + "state", + "stay", + "steak", + "steel", + "stem", + "step", + "stereo", + "stick", + "still", + "sting", + "stock", + "stomach", + "stone", + "stool", + "story", + "stove", + "strategy", + "street", + "strike", + "strong", + "struggle", + "student", + "stuff", + "stumble", + "style", + "subject", + "submit", + "subway", + "success", + "such", + "sudden", + "suffer", + "sugar", + "suggest", + "suit", + "summer", + "sun", + "sunny", + "sunset", + "super", + "supply", + "supreme", + "sure", + "surface", + "surge", + "surprise", + "surround", + "survey", + "suspect", + "sustain", + "swallow", + "swamp", + "swap", + "swarm", + "swear", + "sweet", + "swift", + "swim", + "swing", + "switch", + "sword", + "symbol", + "symptom", + "syrup", + "system", + "table", + "tackle", + "tag", + "tail", + "talent", + "talk", + "tank", + "tape", + "target", + "task", + "taste", + "tattoo", + "taxi", + "teach", + "team", + "tell", + "ten", + "tenant", + "tennis", + "tent", + "term", + "test", + "text", + "thank", + "that", + "theme", + "then", + "theory", + "there", + "they", + "thing", + "this", + "thought", + "three", + "thrive", + "throw", + "thumb", + "thunder", + "ticket", + "tide", + "tiger", + "tilt", + "timber", + "time", + "tiny", + "tip", + "tired", + "tissue", + "title", + "toast", + "tobacco", + "today", + "toddler", + "toe", + "together", + "toilet", + "token", + "tomato", + "tomorrow", + "tone", + "tongue", + "tonight", + "tool", + "tooth", + "top", + "topic", + "topple", + "torch", + "tornado", + "tortoise", + "toss", + "total", + "tourist", + "toward", + "tower", + "town", + "toy", + "track", + "trade", + "traffic", + "tragic", + "train", + "transfer", + "trap", + "trash", + "travel", + "tray", + "treat", + "tree", + "trend", + "trial", + "tribe", + "trick", + "trigger", + "trim", + "trip", + "trophy", + "trouble", + "truck", + "true", + "truly", + "trumpet", + "trust", + "truth", + "try", + "tube", + "tuition", + "tumble", + "tuna", + "tunnel", + "turkey", + "turn", + "turtle", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "type", + "typical", + "ugly", + "umbrella", + "unable", + "unaware", + "uncle", + "uncover", + "under", + "undo", + "unfair", + "unfold", + "unhappy", + "uniform", + "unique", + "unit", + "universe", + "unknown", + "unlock", + "until", + "unusual", + "unveil", + "update", + "upgrade", + "uphold", + "upon", + "upper", + "upset", + "urban", + "urge", + "usage", + "use", + "used", + "useful", + "useless", + "usual", + "utility", + "vacant", + "vacuum", + "vague", + "valid", + "valley", + "valve", + "van", + "vanish", + "vapor", + "various", + "vast", + "vault", + "vehicle", + "velvet", + "vendor", + "venture", + "venue", + "verb", + "verify", + "version", + "very", + "vessel", + "veteran", + "viable", + "vibrant", + "vicious", + "victory", + "video", + "view", + "village", + "vintage", + "violin", + "virtual", + "virus", + "visa", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "voice", + "void", + "volcano", + "volume", + "vote", + "voyage", + "wage", + "wagon", + "wait", + "walk", + "wall", + "walnut", + "want", + "warfare", + "warm", + "warrior", + "wash", + "wasp", + "waste", + "water", + "wave", + "way", + "wealth", + "weapon", + "wear", + "weasel", + "weather", + "web", + "wedding", + "weekend", + "weird", + "welcome", + "west", + "wet", + "whale", + "what", + "wheat", + "wheel", + "when", + "where", + "whip", + "whisper", + "wide", + "width", + "wife", + "wild", + "will", + "win", + "window", + "wine", + "wing", + "wink", + "winner", + "winter", + "wire", + "wisdom", + "wise", + "wish", + "witness", + "wolf", + "woman", + "wonder", + "wood", + "wool", + "word", + "work", + "world", + "worry", + "worth", + "wrap", + "wreck", + "wrestle", + "wrist", + "write", + "wrong", + "yard", + "year", + "yellow", + "you", + "young", + "youth", + "zebra", + "zero", + "zone", + "zoo", + ) } diff --git a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicHelper.kt b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicHelper.kt new file mode 100644 index 000000000..ac5e1256e --- /dev/null +++ b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicHelper.kt @@ -0,0 +1,84 @@ +package io.iohk.atala.prism.apollo.derivation + +import io.iohk.atala.prism.apollo.hashing.PBKDF2SHA512 +import io.iohk.atala.prism.apollo.hashing.SHA256 +import io.iohk.atala.prism.apollo.securerandom.SecureRandom + +final class MnemonicHelper { + companion object { + private const val SEED_ENTROPY_BITS_24_WORDS = 256 + + private const val PBKDF2C = 2048 + private const val PBKDF2_DK_LEN = 64 + + class InvalidMnemonicCode(code: String) : RuntimeException(code) + + fun isValidMnemonicCode(code: List): Boolean { + return code.all { it in MnemonicCodeEnglish.wordList } + } + + fun createRandomMnemonics(): List { + val entropyBytes = SecureRandom.generateSeed(SEED_ENTROPY_BITS_24_WORDS / 8) + return toMnemonicCode(MnemonicCodeEnglish.wordList, entropyBytes) + } + + @Throws(InvalidMnemonicCode::class) + fun createSeed(mnemonics: List, passphrase: String = "AtalaPrism"): ByteArray { + if (!isValidMnemonicCode(mnemonics)) { + throw InvalidMnemonicCode(mnemonics.joinToString(separator = " ")) + } + val mnemonicString = mnemonics.joinToString(separator = " ") + return PBKDF2SHA512.derive( + mnemonicString, + passphrase, + PBKDF2C, + PBKDF2_DK_LEN + ) + } + + fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { + val mnemonics = this.createRandomMnemonics() + return this.createSeed(mnemonics, passphrase) + } + + fun toMnemonicCode(words: List, entropy: ByteArray): List { + if (entropy.size % 4 > 0) { + throw Exception("Entropy length not multiple of 32 bits.") + } + if (entropy.isEmpty()) { + throw Exception("Entropy is empty.") + } + + val sha = SHA256() + sha.update(entropy) + val hash = sha.digest() + val checksumLengthBits = entropy.size / 4 + val checksum = hash[0].toInt() ushr (8 - checksumLengthBits) + + val concatBits = BooleanArray(entropy.size * 8 + checksumLengthBits) + for (i in entropy.indices) { + for (j in 0 until 8) { + concatBits[i * 8 + j] = entropy[i].toInt() and (1 shl (7 - j)) != 0 + } + } + for (i in 0 until checksumLengthBits) { + concatBits[entropy.size * 8 + i] = checksum and (1 shl (checksumLengthBits - i - 1)) != 0 + } + + val resultWords = ArrayList() + val nwords = concatBits.size / 11 + for (i in 0 until nwords) { + var index = 0 + for (j in 0 until 11) { + index = index shl 1 + if (concatBits[i * 11 + j]) { + index = index or 0x1 + } + } + resultWords.add(words[index]) // Assuming wordList is a list of words according to BIP-39 + } + + return resultWords + } + } +} diff --git a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/Mnemonic.kt b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/Mnemonic.kt deleted file mode 100644 index 7c2344278..000000000 --- a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/Mnemonic.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.iohk.atala.prism.apollo.utils - -import io.iohk.atala.prism.apollo.derivation.MnemonicCodeEnglish -import io.iohk.atala.prism.apollo.hashing.PBKDF2SHA512 -import io.iohk.atala.prism.apollo.securerandom.SecureRandom -import io.iohk.atala.prism.apollo.utils.bip39.MnemonicCode -import kotlin.js.ExperimentalJsExport -import kotlin.js.JsExport - -@OptIn(ExperimentalJsExport::class) -@JsExport -final class Mnemonic { - - companion object { - private const val SEED_ENTROPY_BITS_24_WORDS = 256 - - private const val PBKDF2C = 2048 - private const val PBKDF2DKLen = 64 - class InvalidMnemonicCode(code: String) : RuntimeException(code) - - fun isValidMnemonicCode(code: Array): Boolean { - return code.all { it in MnemonicCodeEnglish.wordList } - } - - fun createRandomMnemonics(): Array { - val entropyBytes = SecureRandom.generateSeed(SEED_ENTROPY_BITS_24_WORDS / 8) - return MnemonicCode(MnemonicCodeEnglish.wordList.toTypedArray()).toMnemonic(entropyBytes) - } - - @Throws(InvalidMnemonicCode::class) - fun createSeed(mnemonics: Array, passphrase: String = "AtalaPrism"): ByteArray { - if (!isValidMnemonicCode(mnemonics)) { - throw InvalidMnemonicCode(mnemonics.joinToString(separator = " ")) - } - val mnemonicString = mnemonics.joinToString(separator = " ") - return PBKDF2SHA512.derive( - mnemonicString, - passphrase, - PBKDF2C, - PBKDF2DKLen - ) - } - - fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { - val mnemonics = this.createRandomMnemonics() - return this.createSeed(mnemonics, passphrase) - } - } -} diff --git a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/bip39/MnemonicCode.kt b/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/bip39/MnemonicCode.kt deleted file mode 100644 index 15c0246d9..000000000 --- a/base-asymmetric-encryption/src/commonMain/kotlin/io/iohk/atala/prism/apollo/utils/bip39/MnemonicCode.kt +++ /dev/null @@ -1,54 +0,0 @@ -package io.iohk.atala.prism.apollo.utils.bip39 - -import io.iohk.atala.prism.apollo.hashing.SHA256 -import kotlin.js.ExperimentalJsExport -import kotlin.js.JsExport - -/** - * A model representing the Mnemonic Code - * - * @exception MnemonicLengthException in case it is not 24 words - */ -@OptIn(ExperimentalJsExport::class) -@JsExport -final class MnemonicCode(val words: Array) { - fun toMnemonic(entropy: ByteArray): Array { - if (entropy.size % 4 > 0) { - throw Exception("Entropy length not multiple of 32 bits.") - } - if (entropy.isEmpty()) { - throw Exception("Entropy is empty.") - } - - val sha = SHA256() - sha.update(entropy) - val hash = sha.digest() - val checksumLengthBits = entropy.size / 4 - val checksum = hash[0].toInt() ushr (8 - checksumLengthBits) - - val concatBits = BooleanArray(entropy.size * 8 + checksumLengthBits) - for (i in entropy.indices) { - for (j in 0 until 8) { - concatBits[i * 8 + j] = entropy[i].toInt() and (1 shl (7 - j)) != 0 - } - } - for (i in 0 until checksumLengthBits) { - concatBits[entropy.size * 8 + i] = checksum and (1 shl (checksumLengthBits - i - 1)) != 0 - } - - val words = ArrayList() - val nwords = concatBits.size / 11 - for (i in 0 until nwords) { - var index = 0 - for (j in 0 until 11) { - index = index shl 1 - if (concatBits[i * 11 + j]) { - index = index or 0x1 - } - } - words.add(this.words[index]) // Assuming wordList is a list of words according to BIP-39 - } - - return words.toTypedArray() - } -} diff --git a/base-asymmetric-encryption/src/commonTest/kotlin/io/iohk/atala/prism/apollo/utils/MnemonicTests.kt b/base-asymmetric-encryption/src/commonTest/kotlin/io/iohk/atala/prism/apollo/utils/MnemonicTests.kt index 3796eba37..3cf22a4f3 100644 --- a/base-asymmetric-encryption/src/commonTest/kotlin/io/iohk/atala/prism/apollo/utils/MnemonicTests.kt +++ b/base-asymmetric-encryption/src/commonTest/kotlin/io/iohk/atala/prism/apollo/utils/MnemonicTests.kt @@ -1,5 +1,6 @@ package io.iohk.atala.prism.apollo.utils +import io.iohk.atala.prism.apollo.derivation.MnemonicHelper import io.iohk.atala.prism.apollo.hashing.PBKDF2SHA512 import io.iohk.atala.prism.apollo.hashing.internal.toHexString import kotlin.test.Test @@ -9,30 +10,29 @@ import kotlin.test.assertFailsWith import kotlin.test.assertFalse class MnemonicTests { - @Test fun testValidateMnemonics() { - val invalidMnemonics = arrayOf("abc", "ddd", "inv") - assertFalse(Mnemonic.isValidMnemonicCode(invalidMnemonics)) + val invalidMnemonics = listOf("abc", "ddd", "inv") + assertFalse(MnemonicHelper.isValidMnemonicCode(invalidMnemonics)) } @Test fun testCreateRandomMnemonics() { - val mnemonics = Mnemonic.createRandomMnemonics() - val seed = Mnemonic.createSeed(mnemonics) + val mnemonics = MnemonicHelper.createRandomMnemonics() + val seed = MnemonicHelper.createSeed(mnemonics) assertEquals(seed.size, 64) } @Test fun testCreateRandomSeedWithPW() { - val seed = Mnemonic.createRandomSeed("Demo passphrase") + val seed = MnemonicHelper.createRandomSeed("Demo passphrase") assertEquals(seed.size, 64) } @Test fun testCreateSeed() { - val mnemonics = arrayOf("adjust", "animal", "anger", "around") - val seed = Mnemonic.createSeed(mnemonics) + val mnemonics = listOf("adjust", "animal", "anger", "around") + val seed = MnemonicHelper.createSeed(mnemonics) assertEquals(seed.size, 64) @@ -42,18 +42,18 @@ class MnemonicTests { @Test fun testCreateSeedInvalidMnemonics() { - val mnemonics = arrayOf("abc", "ddd", "adsada", "testing") + val mnemonics = listOf("abc", "ddd", "adsada", "testing") - assertFailsWith { - Mnemonic.createSeed(mnemonics) + assertFailsWith { + MnemonicHelper.createSeed(mnemonics) } } @Test fun testCreateSeedWithPW() { - val mnemonics = arrayOf("adjust", "animal", "anger", "around") + val mnemonics = listOf("adjust", "animal", "anger", "around") val password = "123456" - val seed = Mnemonic.createSeed(mnemonics, password) + val seed = MnemonicHelper.createSeed(mnemonics, password) assertEquals(seed.size, 64) diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt new file mode 100644 index 000000000..2860a981b --- /dev/null +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt @@ -0,0 +1,23 @@ +package io.iohk.atala.prism.apollo.derivation + +final class Mnemonic { + companion object { + class InvalidMnemonicCode(code: String) : RuntimeException(code) + + fun isValidMnemonicCode(code: List): Boolean { + return MnemonicHelper.isValidMnemonicCode(code) + } + + fun createRandomMnemonics(): List { + return MnemonicHelper.createRandomMnemonics() + } + + fun createSeed(mnemonics: List, passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createSeed(mnemonics.toList(), passphrase) + } + + fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createRandomSeed(passphrase) + } + } +} diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt new file mode 100644 index 000000000..001eb037f --- /dev/null +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt @@ -0,0 +1,13 @@ +package io.iohk.atala.prism.apollo.derivation + +final class MnemonicCode constructor(val words: List) { + init { + if (words.size % 3 != 0) { + throw MnemonicLengthException("Can't create a DID from mnemonic that is not dividable by 3") + } + } + + fun toMnemonic(entropy: ByteArray): List { + return MnemonicHelper.toMnemonicCode(words, entropy) + } +} diff --git a/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt b/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt new file mode 100644 index 000000000..b4cfdc768 --- /dev/null +++ b/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt @@ -0,0 +1,25 @@ +package io.iohk.atala.prism.apollo.derivation + +@OptIn(ExperimentalJsExport::class) +@JsExport +final class Mnemonic { + companion object { + class InvalidMnemonicCode(code: String) : RuntimeException(code) + + fun isValidMnemonicCode(code: Array): Boolean { + return MnemonicHelper.isValidMnemonicCode(code.toList()) + } + + fun createRandomMnemonics(): Array { + return MnemonicHelper.createRandomMnemonics().toTypedArray() + } + + fun createSeed(mnemonics: Array, passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createSeed(mnemonics.toList(), passphrase) + } + + fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createRandomSeed(passphrase) + } + } +} diff --git a/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt b/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt new file mode 100644 index 000000000..ff2301f18 --- /dev/null +++ b/base-asymmetric-encryption/src/jsMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt @@ -0,0 +1,30 @@ +package io.iohk.atala.prism.apollo.derivation + +@OptIn(ExperimentalJsExport::class) +@JsExport +final class MnemonicCode constructor(val words: Array) { + init { + if (words.size % 3 != 0) { + throw MnemonicLengthException("Can't create a DID from mnemonic that is not dividable by 3") + } + } + + fun toMnemonic(entropy: ByteArray): Array { + return MnemonicHelper.toMnemonicCode(words.toList(), entropy).toTypedArray() + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class.js != other::class.js) return false + + other as MnemonicCode + + if (!words.contentEquals(other.words)) return false + + return true + } + + override fun hashCode(): Int { + return words.contentHashCode() + } +} diff --git a/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt b/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt new file mode 100644 index 000000000..2860a981b --- /dev/null +++ b/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/Mnemonic.kt @@ -0,0 +1,23 @@ +package io.iohk.atala.prism.apollo.derivation + +final class Mnemonic { + companion object { + class InvalidMnemonicCode(code: String) : RuntimeException(code) + + fun isValidMnemonicCode(code: List): Boolean { + return MnemonicHelper.isValidMnemonicCode(code) + } + + fun createRandomMnemonics(): List { + return MnemonicHelper.createRandomMnemonics() + } + + fun createSeed(mnemonics: List, passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createSeed(mnemonics.toList(), passphrase) + } + + fun createRandomSeed(passphrase: String = "AtalaPrism"): ByteArray { + return MnemonicHelper.createRandomSeed(passphrase) + } + } +} diff --git a/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt b/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt new file mode 100644 index 000000000..001eb037f --- /dev/null +++ b/base-asymmetric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/derivation/MnemonicCode.kt @@ -0,0 +1,13 @@ +package io.iohk.atala.prism.apollo.derivation + +final class MnemonicCode constructor(val words: List) { + init { + if (words.size % 3 != 0) { + throw MnemonicLengthException("Can't create a DID from mnemonic that is not dividable by 3") + } + } + + fun toMnemonic(entropy: ByteArray): List { + return MnemonicHelper.toMnemonicCode(words, entropy) + } +} diff --git a/base-symmetric-encryption/build.gradle.kts b/base-symmetric-encryption/build.gradle.kts index 4a1913d72..8644853da 100644 --- a/base-symmetric-encryption/build.gradle.kts +++ b/base-symmetric-encryption/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -113,13 +111,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -132,12 +129,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } // if (os.isWindows) { @@ -152,10 +148,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base16/build.gradle.kts b/base16/build.gradle.kts index c4e92cda7..41081df21 100644 --- a/base16/build.gradle.kts +++ b/base16/build.gradle.kts @@ -30,12 +30,10 @@ kotlin { // tvos() // watchos() // macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // mingwX64() @@ -106,13 +104,12 @@ kotlin { // val watchosTest by getting // val macosX64Main by getting // val macosX64Test by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -125,9 +122,8 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting - val macosArm64Test by getting - } + val macosArm64Main by getting + val macosArm64Test by getting } // if (os.isWindows) { // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -141,10 +137,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base32/build.gradle.kts b/base32/build.gradle.kts index 0d4d55e51..f55d12c3e 100644 --- a/base32/build.gradle.kts +++ b/base32/build.gradle.kts @@ -30,12 +30,10 @@ kotlin { // tvos() // watchos() // macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // mingwX64() @@ -110,13 +108,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -129,9 +126,8 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting - val macosArm64Test by getting - } + val macosArm64Main by getting + val macosArm64Test by getting } // if (os.isWindows) { // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -145,10 +141,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base58/build.gradle.kts b/base58/build.gradle.kts index 3471740e8..bd730c1a0 100644 --- a/base58/build.gradle.kts +++ b/base58/build.gradle.kts @@ -30,12 +30,10 @@ kotlin { // tvos() // watchos() // macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // mingwX64() @@ -110,13 +108,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -129,9 +126,8 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting - val macosArm64Test by getting - } + val macosArm64Main by getting + val macosArm64Test by getting } // if (os.isWindows) { // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -145,10 +141,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/base64/build.gradle.kts b/base64/build.gradle.kts index d1f06674f..bfa445c88 100644 --- a/base64/build.gradle.kts +++ b/base64/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // mingwX64() @@ -105,13 +103,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -124,9 +121,8 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting - val macosArm64Test by getting - } + val macosArm64Main by getting + val macosArm64Test by getting } // if (os.isWindows) { // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -140,10 +136,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/hashing/build.gradle.kts b/hashing/build.gradle.kts index ff6838b61..73c1fffe4 100644 --- a/hashing/build.gradle.kts +++ b/hashing/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } if (os.isWindows) { mingwX64() @@ -129,13 +127,12 @@ kotlin { val iosTest by getting { this.dependsOn(allButJSTest) } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -148,12 +145,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } if (os.isWindows) { @@ -179,10 +175,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/iOSLibs/build.gradle.kts b/iOSLibs/build.gradle.kts index 528fa6fc1..6fd7bb623 100644 --- a/iOSLibs/build.gradle.kts +++ b/iOSLibs/build.gradle.kts @@ -63,134 +63,6 @@ libraries.forEach { library -> } } } -// -// tasks.create("build${library.capitalize()}IosX64") { -// group = "build" -// -// if (os.isMacOsX) { -// commandLine( -// "xcodebuild", -// "-project", -// "$library/$library.xcodeproj", -// "-target", -// "$library", -// "-sdk", -// "iphonesimulator", -// // "-arch", -// // "x86_64", -// // "CONFIGURATION_BUILD_DIR=$projectDir/$library/build/x86_64-iphonesimulator", -// ) -// } else { -// commandLine("echo", "Unsupported platform.") -// } -// -// workingDir(projectDir) -// -// inputs.files( -// fileTree("$projectDir/$library.xcodeproj") { exclude("**/xcuserdata") }, -// fileTree("$projectDir/$library"), -// ) -// -// outputs.files( -// fileTree("$projectDir/$library/build/x86_64-iphonesimulator"), -// ) -// } -// -// tasks.create("build${library.capitalize()}IosSimulatorArm64") { -// group = "build" -// -// if (os.isMacOsX) { -// commandLine( -// "xcodebuild", -// "-project", -// "$library/$library.xcodeproj", -// "-target", -// "$library", -// "-sdk", -// "iphonesimulator", -// // "-arch", -// // "arm64", -// // "CONFIGURATION_BUILD_DIR=$projectDir/$library/build/arm64-iphonesimulator", -// ) -// } else { -// commandLine("echo", "Unsupported platform.") -// } -// -// workingDir(projectDir) -// -// inputs.files( -// fileTree("$projectDir/$library.xcodeproj") { exclude("**/xcuserdata") }, -// fileTree("$projectDir/$library"), -// ) -// -// outputs.files( -// fileTree("$projectDir/$library/build/arm64-iphonesimulator"), -// ) -// } -// -// tasks.create("build${library.capitalize()}MacosX64") { -// group = "build" -// -// if (os.isMacOsX) { -// commandLine( -// "xcodebuild", -// "-project", -// "$library/$library.xcodeproj", -// "-target", -// "${library}Macos", -// "-sdk", -// "macosx", -// // "-arch", -// // "x86_64", -// "CONFIGURATION_BUILD_DIR=$projectDir/$library/build/x86_64-macos", -// ) -// } else { -// commandLine("echo", "Unsupported platform.") -// } -// -// workingDir(projectDir) -// -// inputs.files( -// fileTree("$projectDir/$library.xcodeproj") { exclude("**/xcuserdata") }, -// fileTree("$projectDir/$library"), -// ) -// -// outputs.files( -// fileTree("$projectDir/$library/build/x86_64-macos"), -// ) -// } -// -// tasks.create("build${library.capitalize()}MacosArm64") { -// group = "build" -// -// if (os.isMacOsX) { -// commandLine( -// "xcodebuild", -// "-project", -// "$library/$library.xcodeproj", -// "-target", -// "${library}Macos", -// "-sdk", -// "macosx", -// "-arch", -// "arm64", -// "CONFIGURATION_BUILD_DIR=$projectDir/$library/build/arm64-macos", -// ) -// } else { -// commandLine("echo", "Unsupported platform.") -// } -// -// workingDir(projectDir) -// -// inputs.files( -// fileTree("$projectDir/$library.xcodeproj") { exclude("**/xcuserdata") }, -// fileTree("$projectDir/$library"), -// ) -// -// outputs.files( -// fileTree("$projectDir/$library/build/arm64-macos"), -// ) -// } } tasks.create("clean") { diff --git a/multibase/build.gradle.kts b/multibase/build.gradle.kts index 824e36a47..9dc6d420c 100644 --- a/multibase/build.gradle.kts +++ b/multibase/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // mingwX64() @@ -112,13 +110,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -131,9 +128,8 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting - val macosArm64Test by getting - } + val macosArm64Main by getting + val macosArm64Test by getting } // if (os.isWindows) { // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -147,10 +143,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/rsa/build.gradle.kts b/rsa/build.gradle.kts deleted file mode 100644 index 4898e85f9..000000000 --- a/rsa/build.gradle.kts +++ /dev/null @@ -1,276 +0,0 @@ -import org.gradle.internal.os.OperatingSystem -import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target - -val currentModuleName = "ApolloRSA" -val os: OperatingSystem = OperatingSystem.current() - -plugins { - kotlin("multiplatform") - kotlin("native.cocoapods") - id("com.android.library") - id("org.jetbrains.dokka") -} - -kotlin { - android { - publishAllLibraryVariants() - } - jvm { - compilations.all { - kotlinOptions { - jvmTarget = "11" - } - } - testRuns["test"].executionTask.configure { - useJUnitPlatform() - } - } - if (os.isMacOsX) { - ios() -// tvos() -// watchos() - macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() -// tvosSimulatorArm64() -// watchosSimulatorArm64() - macosArm64() - } - } -// if (os.isWindows) { -// // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// mingwX64() -// } - js(IR) { - this.moduleName = currentModuleName - this.binaries.library() - this.useCommonJs() - this.compilations["main"].packageJson { - this.version = rootProject.version.toString() - } - this.compilations["test"].packageJson { - this.version = rootProject.version.toString() - } - browser { - this.webpackTask { - this.output.library = currentModuleName - this.output.libraryTarget = Target.VAR - } - this.commonWebpackConfig { - this.cssSupport { - this.enabled = true - } - } - this.testTask { - this.useKarma { - this.useChromeHeadless() - } - } - } - nodejs { - this.testTask { - this.useKarma { - this.useChromeHeadless() - } - } - } - } - - if (os.isMacOsX) { - cocoapods { - this.summary = "ApolloRSA is an RSA lib" - this.version = rootProject.version.toString() - this.authors = "IOG" - this.ios.deploymentTarget = "13.0" - this.osx.deploymentTarget = "12.0" - this.tvos.deploymentTarget = "13.0" - this.watchos.deploymentTarget = "8.0" - framework { - this.baseName = currentModuleName - } - - pod("IOHKRSA") { - version = "1.0.0" - packageName = "IOHKRSA1" - source = path(project.file("../iOSLibs/IOHKRSA")) - } - } - } - - sourceSets { - val commonMain by getting { - dependencies { - implementation(project(":utils")) - implementation(project(":base-asymmetric-encryption")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - } - } - val commonTest by getting { - dependencies { - implementation(kotlin("test")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") - } - } - val jvmMain by getting { - dependencies { - implementation("org.bouncycastle:bcprov-jdk15on:1.68") - } - } - val jvmTest by getting - val androidMain by getting { - dependencies { - implementation("org.bouncycastle:bcprov-jdk15on:1.68") - } - } - val androidTest by getting { - dependencies { - implementation("junit:junit:4.13.2") - } - } - val jsMain by getting { - dependencies { - implementation("org.jetbrains.kotlin-wrappers:kotlin-web:1.0.0-pre.461") - implementation("org.jetbrains.kotlin-wrappers:kotlin-node:18.11.13-pre.461") - - // Polyfill dependencies - implementation(npm("crypto-browserify", "3.12.0")) - implementation(npm("stream-browserify", "3.0.0")) - } - } - val jsTest by getting - if (os.isMacOsX) { - val iosMain by getting - val iosTest by getting -// val tvosMain by getting -// val tvosTest by getting -// val watchosMain by getting -// val watchosTest by getting - val macosX64Main by getting { - this.dependsOn(iosMain) - } - val macosX64Test by getting { - this.dependsOn(iosTest) - } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } -// val tvosSimulatorArm64Main by getting { -// this.dependsOn(tvosMain) -// } -// val tvosSimulatorArm64Test by getting { -// this.dependsOn(tvosTest) -// } -// val watchosSimulatorArm64Main by getting { -// this.dependsOn(watchosMain) -// } -// val watchosSimulatorArm64Test by getting { -// this.dependsOn(watchosTest) -// } - val macosArm64Main by getting { - this.dependsOn(macosX64Main) - } - val macosArm64Test by getting { - this.dependsOn(macosX64Test) - } - } - } -// if (os.isWindows) { -// // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// // val mingwX86Test by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well -// val mingwX64Main by getting -// val mingwX64Test by getting -// } - } - - if (os.isMacOsX) { - tasks.getByName("iosX64Test") { - deviceId = "iPhone 14 Plus" - } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - deviceId = "iPhone 14 Plus" - } - } - } -} - -android { - compileSdk = 32 - sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") - defaultConfig { - minSdk = 21 - targetSdk = 32 - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - /** - * Because Software Components will not be created automatically for Maven publishing from - * Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android. - * disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new - * publishing DSL. - */ - publishing { - multipleVariants { - withSourcesJar() - withJavadocJar() - allVariants() - } - } -} - -// Dokka implementation -tasks.withType { - moduleName.set(project.name) - moduleVersion.set(rootProject.version.toString()) - description = """ - This is a Kotlin Multiplatform Library for RSA - """.trimIndent() - dokkaSourceSets { - // TODO: Figure out how to include files to the documentations - named("commonMain") { - includes.from("Module.md", "docs/Module.md") - } - } -} - -// afterEvaluate { -// tasks.withType { -// testLogging { -// events("passed", "skipped", "failed", "standard_out", "standard_error") -// showExceptions = true -// showStackTraces = true -// } -// } -// } - -// TODO(Investigate why the below tasks fails) -tasks.matching { - fun String.isOneOf(values: List): Boolean { - for (value in values) { - if (this == value) { - return true - } - } - return false - } - - it.name.isOneOf( - listOf( - "linkPodReleaseFrameworkIosFat", - ":linkPodReleaseFrameworkIosFat", - ":base-asymmetric-encryption:linkPodReleaseFrameworkIosFat", - "linkPodDebugFrameworkIosFat", - ":linkPodDebugFrameworkIosFat", - ":base-asymmetric-encryption:linkPodDebugFrameworkIosFat" - ) - ) -}.all { - this.enabled = false -} diff --git a/secp256k1-kmp/build.gradle.kts b/secp256k1-kmp/build.gradle.kts index d9044bc8c..701449d9a 100644 --- a/secp256k1-kmp/build.gradle.kts +++ b/secp256k1-kmp/build.gradle.kts @@ -61,20 +61,18 @@ kotlin { compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/x86_x64-macosx/libsecp256k1.a") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64 { - secp256k1CInterop("iosSimulatorArm64") - compilations["main"].defaultSourceSet.dependsOn(nativeMain) - // https://youtrack.jetbrains.com/issue/KT-39396 - compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/arm64-iphonesimulator/libsecp256k1.a") - } + iosSimulatorArm64 { + secp256k1CInterop("iosSimulatorArm64") + compilations["main"].defaultSourceSet.dependsOn(nativeMain) + // https://youtrack.jetbrains.com/issue/KT-39396 + compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/arm64-iphonesimulator/libsecp256k1.a") + } - macosArm64 { - secp256k1CInterop("macosArm64") - compilations["main"].defaultSourceSet.dependsOn(nativeMain) - // https://youtrack.jetbrains.com/issue/KT-39396 - compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/arm64-macosx/libsecp256k1.a") - } + macosArm64 { + secp256k1CInterop("macosArm64") + compilations["main"].defaultSourceSet.dependsOn(nativeMain) + // https://youtrack.jetbrains.com/issue/KT-39396 + compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/arm64-macosx/libsecp256k1.a") } } diff --git a/secure-random/build.gradle.kts b/secure-random/build.gradle.kts index b7f5438e1..1190886e1 100644 --- a/secure-random/build.gradle.kts +++ b/secure-random/build.gradle.kts @@ -54,15 +54,13 @@ kotlin { } // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64 { - swiftCinterop("IOHKSecureRandomGeneration", name) - } + iosSimulatorArm64 { + swiftCinterop("IOHKSecureRandomGeneration", name) + } // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64 { - swiftCinterop("IOHKSecureRandomGeneration", name) - } + macosArm64 { + swiftCinterop("IOHKSecureRandomGeneration", name) } } // if (os.isWindows) { @@ -138,13 +136,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -157,12 +154,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } // if (os.isWindows) { @@ -175,10 +171,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/utils/build.gradle.kts b/utils/build.gradle.kts index 9bbe0221d..bef8b7c60 100644 --- a/utils/build.gradle.kts +++ b/utils/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -115,13 +113,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -134,12 +131,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } // if (os.isWindows) { @@ -154,10 +150,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/uuid/build.gradle.kts b/uuid/build.gradle.kts index e0bb8e2f2..f06bd914f 100644 --- a/uuid/build.gradle.kts +++ b/uuid/build.gradle.kts @@ -29,12 +29,10 @@ kotlin { ios() // tvos() // watchos() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -112,13 +110,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -131,12 +128,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } // if (os.isWindows) { @@ -151,10 +147,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } } diff --git a/varint/build.gradle.kts b/varint/build.gradle.kts index 3d619def9..e5bd08409 100644 --- a/varint/build.gradle.kts +++ b/varint/build.gradle.kts @@ -30,12 +30,10 @@ kotlin { // tvos() // watchos() macosX64() - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - iosSimulatorArm64() + iosSimulatorArm64() // tvosSimulatorArm64() // watchosSimulatorArm64() - macosArm64() - } + macosArm64() } // if (os.isWindows) { // // mingwX86() // it depend on kotlinx-datetime lib to support this platform before we can support it as well @@ -109,13 +107,12 @@ kotlin { // val tvosTest by getting // val watchosMain by getting // val watchosTest by getting - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - val iosSimulatorArm64Main by getting { - this.dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - this.dependsOn(iosTest) - } + val iosSimulatorArm64Main by getting { + this.dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + this.dependsOn(iosTest) + } // val tvosSimulatorArm64Main by getting { // this.dependsOn(tvosMain) // } @@ -128,12 +125,11 @@ kotlin { // val watchosSimulatorArm64Test by getting { // this.dependsOn(watchosTest) // } - val macosArm64Main by getting { - this.dependsOn(iosMain) - } - val macosArm64Test by getting { - this.dependsOn(iosTest) - } + val macosArm64Main by getting { + this.dependsOn(iosMain) + } + val macosArm64Test by getting { + this.dependsOn(iosTest) } } // if (os.isWindows) { @@ -148,10 +144,8 @@ kotlin { tasks.getByName("iosX64Test") { device.set("iPhone 14 Plus") } - if (System.getProperty("os.arch") != "x86_64") { // M1Chip - tasks.getByName("iosSimulatorArm64Test") { - device.set("iPhone 14 Plus") - } + tasks.getByName("iosSimulatorArm64Test") { + device.set("iPhone 14 Plus") } } }