Skip to content

Commit

Permalink
refactor scryptsy into jellyfish-wallet-encrypted/test (#516)
Browse files Browse the repository at this point in the history
* move Scryptsy to dev dep

* refactor simple scryptsy implementation into test, prevent main package bundling include it
  • Loading branch information
ivan-zynesis authored Jul 29, 2021
1 parent 956f990 commit 053839f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 56 deletions.
12 changes: 7 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import scrypt from 'scryptsy'
import { ScryptProvider } from './scrypt_provider'
import { ScryptProvider } from '../src/provider/scrypt_provider'

export interface ScryptParams {
N: number
Expand All @@ -13,13 +13,6 @@ const DEFAULT_SCRYPT_PARAMS: ScryptParams = {
p: 8
}

/**
* A simple ScryptProvider implementation using
* {@link https://www.npmjs.com/package/scryptsy} (Javascript implementation of the scrypt key derivation)
*
* Mainly for testing and prototyping purpose
* Scryptsy library may not compatible with other platforms, eg: react-native
*/
export class SimpleScryptsy implements ScryptProvider {
constructor (private readonly params: ScryptParams = DEFAULT_SCRYPT_PARAMS) {
}
Expand Down
3 changes: 2 additions & 1 deletion packages/jellyfish-wallet-encrypted/__tests__/bip32.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import BigNumber from 'bignumber.js'
import { EncryptedHdNodeProvider, EncryptedMnemonicHdNode, Scrypt, SimpleScryptsy } from '../src'
import { EncryptedHdNodeProvider, EncryptedMnemonicHdNode, Scrypt } from '../src'
import { MnemonicHdNode, MnemonicHdNodeProvider } from '@defichain/jellyfish-wallet-mnemonic'
import { OP_CODES, Transaction, Vout } from '@defichain/jellyfish-transaction'
import { HASH160 } from '@defichain/jellyfish-crypto'
import { SimpleScryptsy } from './SimpleScryptsy'

const regTestBip32Options = {
bip32: {
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion packages/jellyfish-wallet-encrypted/__tests__/scrypt.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Scrypt, SimpleScryptsy } from '../src'
import { Scrypt } from '../src'
import { SimpleScryptsy } from './SimpleScryptsy'

const scrypt = new Scrypt(new SimpleScryptsy())

Expand Down
4 changes: 2 additions & 2 deletions packages/jellyfish-wallet-encrypted/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"build": "tsc -b ./tsconfig.build.json"
},
"dependencies": {
"@defichain/jellyfish-wallet-mnemonic": "0.0.0",
"scryptsy": "^2.1.0"
"@defichain/jellyfish-wallet-mnemonic": "0.0.0"
},
"devDependencies": {
"scryptsy": "^2.1.0",
"@types/scryptsy": "^2.0.0"
}
}
1 change: 0 additions & 1 deletion packages/jellyfish-wallet-encrypted/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './hd_node'
export * from './provider/scrypt_provider'
export * from './provider/scrypt_simple'
export * from './scrypt'

0 comments on commit 053839f

Please sign in to comment.