GithubHelp home page GithubHelp logo

electric-coin-company / kotlin-bip39 Goto Github PK

View Code? Open in Web Editor NEW
35.0 14.0 8.0 752 KB

A concise implementation of BIP-0039 in Kotlin for Android. In order, it prioritizes being secure, concise and idiomatic.

License: MIT License

Kotlin 100.00%
zcash android bip39 bip39-mnemonic-codes mnemonic kotlin library aar ecc

kotlin-bip39's People

Contributors

burnoo avatar ccjernigan avatar dependabot[bot] avatar gasstan avatar gmale avatar honzar avatar luca992 avatar pacu avatar rex4539 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlin-bip39's Issues

Kotlin 1.7.0

For a Gradle dependency:

  1. Update the dependency version in the root gradle.properties
  2. Update the dependency locks
    1. For Gradle plugins: ./gradlew dependencies --write-locks
    2. For Gradle dependencies: ./gradlew resolveAll --write-locks
  3. Verify no unexpected entries appear in the lockfiles. A supply chain attack could occur during this stage. The lockfile narrows the supply chain attack window to this very moment (as opposed to every time a build occurs).
  4. Are there any new APIs or possible migrations for this dependency?
    1. This should be relatively minor for our library
    2. There are some new regex APIs
    3. min/max are back on collections
    4. https://kotlinlang.org/docs/whatsnew17.html

Rename default branch

Is your feature request related to a problem? Please describe.

Our default branch names are not consistent for our Android projects.

Describe the solution you'd like

Align branch names for consistency, changing the default branch to main.

required changes include:

  • Setting the GitHub setting for the default branch
  • Verifying that branch protection/security rules are still in place and that deployment secrets are only available to the branch called main
  • Updating the deploy-snapshot.yml and deploy-release.yml to run on the main branch instead of master

Prepare for 1.0.3 release

We need to prepare for a future release by:

  • Bumping the version to 1.0.3
  • Updating the Maven properties
  • Updating the changelog
  • Adding documentation on deployment
  • Testing out automated deployment

Configure Deployment through GitHub Actions

Is your feature request related to a problem? Please describe.

In order to be able to release updates to the library, we should have automated deployments.

Describe the solution you'd like

Create an automated deployment with GitHub Actions, similar to the deployment configured in the Zcash Android SDK.

Steps that need to be completed:

  1. Add markdown documentation on how CI works in this repo
  2. Add documentation on how to consume snapshot deployments
  3. Add secrets to GitHub for the main branch deployments. The necessary secrets are defined here: https://github.com/zcash/kotlin-bip39/blob/main/.github/workflows/deploy-release.yml
  4. Test the deployments

Configure Dependabot for GitHub Actions Versions

Is your feature request related to a problem? Please describe.

It is annoying to keep GitHub Actions dependencies updated.

Describe the solution you'd like

Although dependabot does not support Gradle yet, it does support GitHub Actions. So we can configure dependabot to help with this.

Configure dependency locking

Is your feature request related to a problem? Please describe.

To reduce the risk of software supply chain issues, we should enable dependency locking.

Although the published library itself doesn't depend on third party libraries, the Gradle build does rely on some plug-ins and the tests rely on some third party libraries.

Describe the solution you'd like

Enable dependency locking for the build scripts, build-conventions, as well as add a new dependency locking convention similar to https://github.com/zcash/secant-android-wallet/blob/main/build-convention/src/main/kotlin/zcash.dependency-conventions.gradle.kts

Dokka 1.6.21

For a Gradle dependency:

  1. Update the dependency version in the root gradle.properties
  2. Update the dependency locks
  1. Are there any new APIs or possible migrations for this dependency?

Update readme to remove reference to Jcenter

The artifact is published in Maven Central, so the readme can be updated to reflect this. There are two changes:

  • Replace jcenter with maven central
  • Bump the version in the readme, since maven central only has a slightly newer version.

MnemonicCode Doesn't Implement Iterator Interface Correctly

Running detekt points out:

kotlin-bip39/lib/src/jvmMain/kotlin/cash/z/ecc/android/bip39/Mnemonics.kt:85:53: This implementation of Iterator does not correctly implement the next() method as it doesn't throw a NoSuchElementException when no elements remain in the Iterator. [IteratorNotThrowingNoSuchElementException]

Note that the detekt baseline will suppress this warning. When implementing this change, be sure to update the detekt baseline file to remove this suppression.

ktlint 0.46.0

  1. Update the dependency version in the root gradle.properties
  2. Update the dependency locks
    1. For Gradle plugins: ./gradlew dependencies --write-locks
  3. Verify no unexpected entries appear in the lockfiles. A supply chain attack could occur during this stage. The lockfile narrows the supply chain attack window to this very moment (as opposed to every time a build occurs)
  4. Are there any new APIs or possible migrations for this dependency?
    1. Note there are some new rules introduced with this update that will require formatting changes or new @Suppress statements.

Configure GitHub Actions

Create a basic GitHub action script to validate the gradle wrapper, compile the library, run ktlint, and detekt.

#24 is a followup issue to run the tests. Note that tests aren't being configured in this issue, because running the Android tests on CI can be complex. If we migrate to Multiplatform, then running those tests would be easier.

Switch to Adoptium JDK

Is your feature request related to a problem? Please describe.

Gradle toolchains only support Adoptium JDKs, however we have been recommending Zulu. This means different developers may have inconsistent JVMs. Although they should be compatible, it would be great to eliminate this variability in builds.

Describe the solution you'd like

Now that Adoptium publishes a Mac ARM JDK 11, we can remove using Zulu.

  • Update readme to remove references to Azul
  • Update GitHub Actions to use Adoptium

Convert build scripts to kts

For consistency with our other Gradle and Kotlin projects, convert our build scripts to kts.

This should likely be implemented after #15 and #16 since those have some syntax changes for build scripts.

Coroutines 1.6.3

For a Gradle dependency:

  1. Update the dependency version in the root gradle.properties
  2. Update the dependency locks
    1. For Gradle dependencies: ./gradlew resolveAll --write-locks
  3. Verify no unexpected entries appear in the lockfiles. A supply chain attack could occur during this stage. The lockfile narrows the supply chain attack window to this very moment (as opposed to every time a build occurs).
  4. Are there any new APIs or possible migrations for this dependency?
    1. Minor update
    2. https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.6.3

Configure Code Coverage Reports

Is your feature request related to a problem? Please describe.

Developers have a hard time understanding how well the tests cover the library.

Describe the solution you'd like

Introduce code coverage, most likely with the JetBrains Kover Gradle plugin.

Alternatives you've considered

We can manually apply Jacoco to generate coverage, although Kover will be more robust.

Improve performance initializing Mnemonics

When Mnemonics is first touched, it performs an initialization of SecureRandom which is known to be slow.

While documenting this could be helpful, it doesn't give clients using this library a lot of options to work around it. That's because Mnemonics is an object, so initialization is effectively a JVM static initializer when means it runs as soon as something touches the object.

Possible alternative implementations:

  • Defer SecureRandom initialization until it is needed, giving clients better control over timing
  • Convert Mnemonics to a class, so that initialization happens during construction which allows clients better control over timing of the initialization
  • Create a companion object initializer. This could be a suspend function, allowing secure random injection into a private constructor for Mnemonics
  • ... There may be other options to consider as well

Configure for included builds

Is your feature request related to a problem? Please describe.

When doing multiple included builds with build-conventions, things can break when modules or conventions have the same name.

This will be a problem if trying to use an included build for both bip-39 and the Android SDK.

Describe the solution you'd like

Rename the build-conventions folder to have a namespace.

Block plugins from adding maven repositories

Is your feature request related to a problem? Please describe.

When Gradle plugins are applied, they can define their own Maven repositories. This could allow dependencies to come from sources that we don't trust.

Describe the solution you'd like

In settings.gradle.kts, configure

repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)

This is likely blocked until this is resolved: https://youtrack.jetbrains.com/issue/KT-52383/Kotlin-Multiplatform-Gradle-Plugin-Unable-to-disable-project-rep

Duplicate Gradle Wrapper

There's a duplicate copy of the Gradle wrapper under lib/. We just need the copies of these in the repo root. To resolve this, delete the following paths:

  • lib/gradle
  • lib/gradlew
  • lib/gradlew.bat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.