Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved logic to disable use of secp256k1 library into crypto project * Fixed secp doc
- Loading branch information
Showing
6 changed files
with
99 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
crypto/src/main/scala/org/bitcoins/crypto/CryptoContext.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.bitcoins.crypto | ||
|
||
import org.bitcoin.Secp256k1Context | ||
|
||
sealed trait CryptoContext | ||
|
||
object CryptoContext { | ||
|
||
case object LibSecp256k1 extends CryptoContext | ||
|
||
case object BouncyCastle extends CryptoContext | ||
|
||
def default: CryptoContext = { | ||
val secpDisabled = System.getenv("DISABLE_SECP256K1") | ||
if (secpDisabled != null && (secpDisabled.toLowerCase == "true" || secpDisabled == "1")) { | ||
BouncyCastle | ||
} else { | ||
if (Secp256k1Context.isEnabled) { | ||
LibSecp256k1 | ||
} else { | ||
BouncyCastle | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters