Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [ATL-2857][Wallet SDK][Pluto] Define secure storage interfaces #1

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
.idea
.DS_Store
build
*/build
captures
.externalNativeBuild
.cxx
local.properties
xcuserdata/
Pods/
/androidApp/key
*.jks
*yarn.lock
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Atala Prism Wallet SDK - Kotlin Multiplatform (Android/JVM/JS/Apple)

[![Kotlin](https://img.shields.io/badge/kotlin-1.7.20-blue.svg?logo=kotlin)](http://kotlinlang.org)

![android](https://camo.githubusercontent.com/b1d9ad56ab51c4ad1417e9a5ad2a8fe63bcc4755e584ec7defef83755c23f923/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d616e64726f69642d3645444238442e7376673f7374796c653d666c6174)
Expand All @@ -12,6 +13,7 @@
![watchos](https://camo.githubusercontent.com/135dbadae40f9cabe7a3a040f9380fb485cff36c90909f3c1ae36b81c304426b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d77617463686f732d4330433043302e7376673f7374796c653d666c6174)

The wallet SDK will have the following features:

- Secure Local Storage
- Key Managment
- DIDComm Operations
Expand Down
147 changes: 147 additions & 0 deletions authenticate-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target

version = rootProject.version
val currentModuleName: String = "authenticate_sdk"
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()
}
}

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("com.benasher44:uuid:0.3.0") // TODO("use Apollo UUID")
implementation(project(":core-sdk"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
val androidMain by getting
val androidTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
val jsMain by getting
val jsTest by getting

all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
}
}

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<DokkaTask> {
moduleName.set(project.name)
moduleVersion.set(rootProject.version.toString())
description = """
This is a Kotlin Multiplatform Authenticate-SDK Library
""".trimIndent()
dokkaSourceSets {
// TODO: Figure out how to include files to the documentations
named("commonMain") {
includes.from("Module.md", "docs/Module.md")
}
}
}

// afterEvaluate {
// tasks.withType<AbstractTestTask> {
// testLogging {
// events("passed", "skipped", "failed", "standard_out", "standard_error")
// showExceptions = true
// showStackTraces = true
// }
// }
// }
2 changes: 2 additions & 0 deletions authenticate-sdk/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.iohk.prism.io.iohk.atala.prism.authenticatesdk.authenticate" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun authenticate(did: String, signature: String, originalText: String): String {
return "hola"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun createChallenge(expiration: Int): String {
return "hola"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package io.iohk.atala.prism.authenticatesdk

expect fun authenticate(did: String, signature: String, originalText: String): String
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package io.iohk.atala.prism.authenticatesdk

expect fun createChallenge(expiration: Int): String
14 changes: 14 additions & 0 deletions authenticate-sdk/src/jsMain/kotlin/JSExport.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import io.iohk.atala.prism.authenticatesdk.authenticate
import io.iohk.atala.prism.authenticatesdk.createChallenge

@JsExport
@JsName("authenticate")
fun jsAuthenticate(did: String, signature: String, originalText: String): String {
return authenticate(did, signature, originalText)
}

@JsExport
@JsName("createChallenge")
fun jsCreateChallenge(expiration: Int): String {
return createChallenge(expiration)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun authenticate(did: String, signature: String, originalText: String): String {
return "hola"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun createChallenge(expiration: Int): String {
return "hola"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun authenticate(did: String, signature: String, originalText: String): String {
return "hola"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.iohk.atala.prism.authenticatesdk

actual fun createChallenge(expiration: Int): String {
return "hola"
}
92 changes: 92 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin

version = "1.0.0-alpha"
group = "io.iohk.atala.prism"

plugins {
java
kotlin("jvm") version "1.7.20"
kotlin("plugin.serialization") version "1.7.20"
id("maven-publish")
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("org.jetbrains.dokka") version "1.7.10"
id("com.google.protobuf") version "0.9.1"
// The following should be removed
// id(Plugins.npmPublish) version PluginVersions.npmPublish apply false
// id(Plugins.gitVersion) version PluginVersions.gitVersion
// id(Plugins.compatibilityValidator) version PluginVersions.compatibilityValidator
// id(Plugins.gitOps) version PluginVersions.gitOps
// id(Plugins.koverage) version PluginVersions.koverage
}

buildscript {
repositories {
mavenCentral()
mavenLocal()
google()
gradlePluginPortal()
maven("https://plugins.gradle.org/m2/")
// Needed for Kotlin coroutines that support new memory management mode
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
classpath("com.android.tools.build:gradle:7.2.2")
classpath("com.google.protobuf:protobuf-gradle-plugin:0.9.1")
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
}
}

allprojects {
repositories {
mavenCentral()
mavenLocal()
google()
maven("https://plugins.gradle.org/m2/")
// Needed for Kotlin coroutines that support new memory management mode
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
}

// apply(plugin = "org.gradle.maven-publish")

// publishing {
// repositories {
// maven {
// this.name = "GitHubPackages"
// this.url = uri("https://maven.pkg.github.com/input-output-hk/atala-prism-wallet-sdk-kmm/")
// credentials {
// this.username = System.getenv("ATALA_GITHUB_ACTOR")
// this.password = System.getenv("ATALA_GITHUB_TOKEN")
// }
// }
// }
// }
}

subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
verbose.set(true)
outputToConsole.set(true)
}
}

rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
rootProject.extensions.getByType(NodeJsRootExtension::class.java).nodeVersion = "16.17.0"
}

tasks.dokkaGfmMultiModule.configure {
outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
}
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
30 changes: 30 additions & 0 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
object Deps {
const val kotlinSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerializationJson}"
const val kotlinBignum = "com.ionspin.kotlin:bignum:${Versions.kotlinBignum}"
const val kotlinCoroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
const val kotlinCoroutinesJDK8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.kotlinCoroutinesJDK8}"
const val kotlinNodejs = "org.jetbrains.kotlinx:kotlinx-nodejs:${Versions.kotlinNodejs}"
const val kotlinDatetime = "org.jetbrains.kotlinx:kotlinx-datetime:${Versions.kotlinDatetime}"
const val grpcKotlinStub = "io.grpc:grpc-kotlin-stub:${Versions.grpcKotlinStub}"
const val grpcKotlinOkhttp = "io.grpc:grpc-okhttp:${Versions.grpcKotlinOkhttp}"

const val bitcoinj = "org.bitcoinj:bitcoinj-core:${Versions.bitcoinj}"
const val bitcoinKmp = "fr.acinq.bitcoin:bitcoin-kmp:${Versions.bitcoinKmp}"

const val pbandkRuntime = "io.iohk:pbandk-runtime:${Versions.pbandk}"
const val pbandkProtocGen = "io.iohk:protoc-gen-pbandk-lib-jvm:${Versions.pbandk}"
// NOTE: this adds Kotlin interop with some of the jvm8 features (e.g. CompletableFuture).
const val pbandkProtocGenJDK8 = "io.iohk:protoc-gen-pbandk-jvm:${Versions.pbandk}:jvm8@jar"
const val pbandkPrismClientsGenerator = "io.iohk.atala:pbandk-prism-clients-generator:${Versions.pbandk}"

const val protobufJava = "com.google.protobuf:protobuf-java:${Versions.protobuf}"
const val protobufProtoc = "com.google.protobuf:protoc:${Versions.protobuf}"
const val protobufLite = "io.grpc:grpc-protobuf-lite:${Versions.protobufLite}"

const val betterParse = "com.github.h0tk3y.betterParse:better-parse:${Versions.betterParse}"
const val krypto = "com.soywiz.korlibs.krypto:krypto:${Versions.krypto}"
const val guava = "com.google.guava:guava:${Versions.guava}"
const val spongyCastle = "com.madgag.spongycastle:prov:${Versions.spongyCastle}"
const val bouncyCastle = "org.bouncycastle:bcprov-jdk15on:${Versions.bouncyCastle}"
const val uuid = "com.benasher44:uuid:${Versions.uuid}"
}
14 changes: 14 additions & 0 deletions buildSrc/src/main/kotlin/PluginVersions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
object PluginVersions {
const val multiplatform = "1.6.0"
const val androidLibrary = "4.1.2"
const val protobuf = "0.8.14"
const val npmPublish = "2.0.2"
const val gitVersion = "0.12.3"
const val klint = "10.0.0"
const val multiplatformSwift = "2.0.3"
const val kfcDefinitions = "4.32.0"
const val compatibilityValidator = "0.8.0-RC"
const val gitOps = "5.0.0-rc.3"
const val koverage = "0.5.0"
const val dokka = "1.7.0"
}
Loading