Skip to content
Merged
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
70 changes: 31 additions & 39 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
# OS X
# Built application files
android/**/*.apk
android/**/*.ap_

# Files for the Dalvik VM
android/**/*.dex

# Java class files
android/**/*.class
android/**/bcprov*.jar

# Generated files
android/**/bin/
android/**/gen/
android/**/jniLibs/
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes

# Xcode
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
*.xcscmblueprint
*.gcno
*.gcda
# Gradle files
android/**/.gradle/
android/**/build/
android/**/captures

# Carthage
/Carthage/Checkouts
Carthage/Build/Mac
Carthage/Build/tvOS
Carthage/Build/watchOS
Carthage/Build/.*.version
# Local configuration file (sdk path, etc)
android/**/local.properties

# AppCode
/.idea
# Log Files
android/**/*.log

# Ruby/Node
vendor/bundle
.bundle/
node_modules/
*.xcbkptlist
# IDE Files
.idea/
android/**/.idea/
android/**/*.iml
android/**/.gradle
android/**/.project
android/**/.settings
android/**/.classpath
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
format:
ios/Pods/SwiftFormat/CommandLineTool/swiftformat ios/Source --header "Copyright (c) 2017-{year} Coinbase Inc. See LICENSE"
# android/gradlew ktlintFormat -p android
android/gradlew ktlintFormat -p android

lint:
Pods/SwiftLint/swiftlint
Expand Down
28 changes: 28 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
apply from: rootProject.file('gradle/dependencies.gradle')

repositories {
google()
jcenter()
}

dependencies {
classpath "com.android.tools.build:gradle:${versions.gradle}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions android/crypto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
64 changes: 64 additions & 0 deletions android/crypto/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../gradle/dependencies.gradle'


android {
compileSdkVersion 28
buildToolsVersion "29.0.0"


defaultConfig {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

}

configurations {
ktlint
}


dependencies {
ktlint "com.pinterest:ktlint:${otherVersions.ktlint}"


implementation(
// kotlin
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
)

testImplementation(
"junit:junit:${testVersions.junit4}"

)

androidTestImplementation(
"androidx.test.ext:junit:${testVersions.androidXTestExtJUnit}",
"androidx.test:runner:${testVersions.androidXTestRunner}",
"androidx.test:core:${testVersions.androidXTestCore}"
)
}


task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
}

check.dependsOn ktlint

task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}
2 changes: 2 additions & 0 deletions android/crypto/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.coinbase.wallet.crypto"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.coinbase.wallet.crypto.extensions

/**
* Convert ByteArray to hex encoded string
*/
fun ByteArray.toHexString(): String {
val result = StringBuffer()
for (byt in this) {
val hex = Integer.toString((byt and 0xff) + 0x100, 16).substring(1)
result.append(hex)
}

return result.toString()
}

private infix fun Byte.and(value: Int) = toInt() and value
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.coinbase.wallet.crypto.extensions

import java.security.MessageDigest
import java.security.NoSuchAlgorithmException

/**
* Hash the string using sha256
*
* @throws `NoSuchAlgorithmException` when unable to sha256
*/
@Throws(NoSuchAlgorithmException::class)
fun String.sha256(): String {
val md = MessageDigest.getInstance("SHA-256")
md.update(this.toByteArray())
return md.digest().toHexString()
}
15 changes: 15 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
19 changes: 19 additions & 0 deletions android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ext {
versions = [
gradle : '3.4.2',

kotlin : "1.3.41",
]

testVersions = [
junit4 : "4.12",

androidXTestCore : "1.1.0",
androidXTestExtJUnit: "1.0.0",
androidXTestRunner : "1.1.1",
]

otherVersions = [
ktlint: "0.32.0"
]
}
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Jul 31 06:31:22 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Loading