Skip to content

Commit

Permalink
Refactor: dependencies dedup (such as keccaak, bip, etc) (#139)
Browse files Browse the repository at this point in the history
* test: add bls regression tests

* refactor: more deps gone

* refactor: types

* refactor: getWordList

* refactor: more deps gone

* fix: utils

* fix: keccak hash

* fix: various buffer fixes

* fix: force keccak to consider string as bytes

* chore: update docs

* fix: type

* refactor: rlp -> @ethereumjs/rlp

* refactor: eth-lib removal wip

* refactor: eth-lib removal

* chore: regenerate docs

* fix: ensure no 0x-prefixed string is passed to hextobytes

* fix: update snapshot

* fix: ensure r,s,v are 0x prefixed

* chore: regenerate docs

* test: bls

* test: some more signing-utils tests

* chore: regenerate docs

* chore: regenerate docs

* fix: web3 resolution

* fix: ledger SignMessage

* chore: add note

* chore: regenerate docs
  • Loading branch information
nicolasbrugneaux authored Mar 28, 2024
1 parent ff8b1bf commit 1c6d202
Show file tree
Hide file tree
Showing 65 changed files with 1,227 additions and 693 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
},
"resolutions": {
"ganache": "npm:@celo/[email protected]",
"bip39": "https://github.com/bitcoinjs/bip39#a7ecbfe2e60d0214ce17163d610cad9f7b23140c",
"web3": "1.10.4",
"web3-utils": "1.10.4",
"blind-threshold-bls": "npm:@celo/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"@oclif/plugin-not-found": "^3.0.9",
"@oclif/plugin-plugins": "^4.1.17",
"@oclif/plugin-warn-if-update-available": "^3.0.9",
"@scure/bip32": "^1.3.3",
"@types/command-exists": "^1.2.3",
"bignumber.js": "9.0.0",
"bip32": "3.1.0",
"chalk": "^2.4.2",
"command-exists": "^1.2.9",
"cross-fetch": "3.1.5",
Expand Down
12 changes: 6 additions & 6 deletions packages/docs/sdk/docs/base/interfaces/account.Bip39.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ ___

### mnemonicToSeed

**mnemonicToSeed**: (`mnemonic`: `string`, `password?`: `string`) => `Promise`\<`Buffer`\>
**mnemonicToSeed**: (`mnemonic`: `string`, `password?`: `string`) => `Promise`\<`Uint8Array`\>

#### Type declaration

▸ (`mnemonic`, `password?`): `Promise`\<`Buffer`\>
▸ (`mnemonic`, `password?`): `Promise`\<`Uint8Array`\>

##### Parameters

Expand All @@ -58,7 +58,7 @@ ___

##### Returns

`Promise`\<`Buffer`\>
`Promise`\<`Uint8Array`\>

#### Defined in

Expand All @@ -68,11 +68,11 @@ ___

### mnemonicToSeedSync

**mnemonicToSeedSync**: (`mnemonic`: `string`, `password?`: `string`) => `Buffer`
**mnemonicToSeedSync**: (`mnemonic`: `string`, `password?`: `string`) => `Uint8Array`

#### Type declaration

▸ (`mnemonic`, `password?`): `Buffer`
▸ (`mnemonic`, `password?`): `Uint8Array`

##### Parameters

Expand All @@ -83,7 +83,7 @@ ___

##### Returns

`Buffer`
`Uint8Array`

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ ___

### mnemonicToSeed

**mnemonicToSeed**: (`mnemonic`: `string`, `password?`: `string`) => `Promise`\<`Buffer`\>
**mnemonicToSeed**: (`mnemonic`: `string`, `password?`: `string`) => `Promise`\<`Uint8Array`\>

#### Type declaration

▸ (`mnemonic`, `password?`): `Promise`\<`Buffer`\>
▸ (`mnemonic`, `password?`): `Promise`\<`Uint8Array`\>

##### Parameters

Expand All @@ -58,7 +58,7 @@ ___

##### Returns

`Promise`\<`Buffer`\>
`Promise`\<`Uint8Array`\>

#### Defined in

Expand All @@ -68,11 +68,11 @@ ___

### mnemonicToSeedSync

**mnemonicToSeedSync**: (`mnemonic`: `string`, `password?`: `string`) => `Buffer`
**mnemonicToSeedSync**: (`mnemonic`: `string`, `password?`: `string`) => `Uint8Array`

#### Type declaration

▸ (`mnemonic`, `password?`): `Buffer`
▸ (`mnemonic`, `password?`): `Uint8Array`

##### Parameters

Expand All @@ -83,7 +83,7 @@ ___

##### Returns

`Buffer`
`Uint8Array`

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:16](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L16)
[cryptographic-utils/src/commentEncryption.ts:17](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L17)

___

Expand All @@ -29,4 +29,4 @@ ___

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:15](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L15)
[cryptographic-utils/src/commentEncryption.ts:16](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L16)
1 change: 1 addition & 0 deletions packages/docs/sdk/docs/cryptographic-utils/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
- [dataEncryptionKey](modules/dataEncryptionKey.md)
- [index](modules/index.md)
- [types](modules/types.md)
- [wordlists](modules/wordlists.md)
49 changes: 35 additions & 14 deletions packages/docs/sdk/docs/cryptographic-utils/modules/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- [generateMnemonic](account.md#generatemnemonic)
- [generateSeed](account.md#generateseed)
- [getAllLanguages](account.md#getalllanguages)
- [getWordList](account.md#getwordlist)
- [invalidMnemonicWords](account.md#invalidmnemonicwords)
- [mnemonicLengthFromStrength](account.md#mnemoniclengthfromstrength)
- [normalizeMnemonic](account.md#normalizemnemonic)
Expand Down Expand Up @@ -85,7 +86,7 @@ base/lib/account.d.ts:18

#### Defined in

[cryptographic-utils/src/account.ts:465](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L465)
[cryptographic-utils/src/account.ts:455](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L455)

___

Expand Down Expand Up @@ -125,7 +126,7 @@ malformed. It may occasionally occur that a typo results in word from another la

#### Defined in

[cryptographic-utils/src/account.ts:233](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L233)
[cryptographic-utils/src/account.ts:220](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L220)

___

Expand All @@ -149,7 +150,7 @@ now an alias for normalizeMnemonic.

#### Defined in

[cryptographic-utils/src/account.ts:159](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L159)
[cryptographic-utils/src/account.ts:166](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L166)

___

Expand Down Expand Up @@ -178,7 +179,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:416](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L416)
[cryptographic-utils/src/account.ts:403](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L403)

___

Expand All @@ -203,7 +204,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:403](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L403)
[cryptographic-utils/src/account.ts:390](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L390)

___

Expand Down Expand Up @@ -232,7 +233,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:444](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L444)
[cryptographic-utils/src/account.ts:431](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L431)

___

Expand All @@ -254,7 +255,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L54)
[cryptographic-utils/src/account.ts:61](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L61)

___

Expand All @@ -277,7 +278,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:429](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L429)
[cryptographic-utils/src/account.ts:416](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L416)

___

Expand All @@ -291,7 +292,27 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:188](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L188)
[cryptographic-utils/src/account.ts:175](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L175)

___

### getWordList

**getWordList**(`language?`): `string`[]

#### Parameters

| Name | Type | Default value |
| :------ | :------ | :------ |
| `language` | [`MnemonicLanguages`](../enums/account.MnemonicLanguages.md) | `MnemonicLanguages.english` |

#### Returns

`string`[]

#### Defined in

[cryptographic-utils/src/account.ts:171](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L171)

___

Expand Down Expand Up @@ -320,7 +341,7 @@ invalid, or half of the valid words are from one language and the other half fro

#### Defined in

[cryptographic-utils/src/account.ts:88](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L88)
[cryptographic-utils/src/account.ts:95](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L95)

___

Expand All @@ -340,7 +361,7 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:202](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L202)
[cryptographic-utils/src/account.ts:189](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L189)

___

Expand Down Expand Up @@ -369,7 +390,7 @@ that all the words in the phrase are contained in a valid wordlist.

#### Defined in

[cryptographic-utils/src/account.ts:109](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L109)
[cryptographic-utils/src/account.ts:116](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L116)

___

Expand Down Expand Up @@ -410,7 +431,7 @@ It is recommended to normalize the mnemonic phrase before inputting to this func

#### Defined in

[cryptographic-utils/src/account.ts:288](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L288)
[cryptographic-utils/src/account.ts:275](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L275)

___

Expand All @@ -432,4 +453,4 @@ ___

#### Defined in

[cryptographic-utils/src/account.ts:62](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L62)
[cryptographic-utils/src/account.ts:69](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L69)
14 changes: 7 additions & 7 deletions packages/docs/sdk/docs/cryptographic-utils/modules/bls.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#### Defined in

[cryptographic-utils/src/bls.ts:12](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L12)
[cryptographic-utils/src/bls.ts:11](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L11)

___

Expand All @@ -33,13 +33,13 @@ ___

#### Defined in

[cryptographic-utils/src/bls.ts:11](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L11)
[cryptographic-utils/src/bls.ts:10](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L10)

## Functions

### blsPrivateKeyToProcessedPrivateKey

**blsPrivateKeyToProcessedPrivateKey**(`privateKeyHex`): `any`
**blsPrivateKeyToProcessedPrivateKey**(`privateKeyHex`): `Buffer`

#### Parameters

Expand All @@ -49,11 +49,11 @@ ___

#### Returns

`any`
`Buffer`

#### Defined in

[cryptographic-utils/src/bls.ts:14](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L14)
[cryptographic-utils/src/bls.ts:13](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L13)

___

Expand All @@ -74,7 +74,7 @@ ___

#### Defined in

[cryptographic-utils/src/bls.ts:53](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L53)
[cryptographic-utils/src/bls.ts:51](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L51)

___

Expand All @@ -94,4 +94,4 @@ ___

#### Defined in

[cryptographic-utils/src/bls.ts:48](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L48)
[cryptographic-utils/src/bls.ts:46](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L46)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:115](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L115)
[cryptographic-utils/src/commentEncryption.ts:119](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L119)

## Functions

Expand All @@ -61,7 +61,7 @@ Decrypted comment if can decrypt, otherwise comment.

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:104](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L104)
[cryptographic-utils/src/commentEncryption.ts:108](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L108)

___

Expand All @@ -87,7 +87,7 @@ Decrypted data.

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:45](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L45)
[cryptographic-utils/src/commentEncryption.ts:46](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L46)

___

Expand Down Expand Up @@ -115,7 +115,7 @@ base64 string of encrypted comment if can encrypt, otherwise comment.

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:69](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L69)
[cryptographic-utils/src/commentEncryption.ts:73](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L73)

___

Expand All @@ -141,4 +141,4 @@ Encrypted data to sender and recipient.

#### Defined in

[cryptographic-utils/src/commentEncryption.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L27)
[cryptographic-utils/src/commentEncryption.ts:28](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L28)
Loading

0 comments on commit 1c6d202

Please sign in to comment.