Skip to content

Commit

Permalink
Merge branch 'release/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Sep 25, 2019
2 parents f5758b2 + fa65606 commit 4a9e48b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ UportHDSigner().signJwtBundle(activity, seedHandle, derivationPath, data, prompt

### Changelog

#### 0.3.5
* [feat] add `suspend` extension for `UportHDSigner.signTransaction()` (#21)

#### 0.3.4
* [support] upgrade to kethereum 0.76.1 (#19)

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ buildscript {
kotlin_common_version = "0.3.1"
jacoco_version = "0.8.4"

current_release_version = "0.3.4"
current_release_version = "0.3.5"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.uport.sdk.signer

import android.content.Context
import com.uport.sdk.signer.encryption.KeyProtection
import org.kethereum.model.SignatureData
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
Expand All @@ -24,6 +25,9 @@ suspend fun UportHDSigner.createHDSeed(
}
}

/**
* Extension function that wraps the `UportHDSigner.importHDSeed()` as a coroutine
*/
suspend fun UportHDSigner.importHDSeed(
context: Context,
level: KeyProtection.Level,
Expand All @@ -38,6 +42,26 @@ suspend fun UportHDSigner.importHDSeed(
}
}

/**
* Extension function that wraps the `UportHDSigner.signTransaction()` as a coroutine
*/

suspend fun UportHDSigner.signTransaction(
context: Context,
rootAddress: String,
derivationPath: String,
txPayload: String,
prompt: String): SignatureData = suspendCoroutine {

this.signTransaction(context, rootAddress, derivationPath, txPayload, prompt) { err, sigData ->
if (err != null) {
it.resumeWithException(err)
} else {
it.resume(sigData)
}
}
}

/**
* Extension function that wraps the `computeAddressForPath` as a coroutine
*/
Expand All @@ -56,6 +80,9 @@ suspend fun UportHDSigner.computeAddressForPath(
}
}

/**
* Extension function that wraps the `UportHDSigner.showHDSeed()` as a coroutine
*/
suspend fun UportHDSigner.showHDSeed(
context: Context,
rootAddress: String,
Expand Down

0 comments on commit 4a9e48b

Please sign in to comment.