Skip to content

Commit

Permalink
✨ Helper functions related to verifyMessage util fn (dawsbot#119)
Browse files Browse the repository at this point in the history
* ✨ Added `splitSignature` util fn (dawsbot#112)

* Added hashMessage to exports

* ✨ Added splitSignature util fn

* ✨ Added `recoverPublicKey` util fn (dawsbot#114)

* Added hashMessage to exports

* ✨ Added splitSignature util fn

* make gas price less flakey

* ✨ Added `computeAddress` util fn (dawsbot#116)

* Added initial computeAddress fn, relies on ethers at the moment

* Init computePublicKey util fn

* ✨ Added computePublicKey util fn

* 📝 Added documenation to computePublicKey

* ⬆ Pre-commit hook package bump, added @noble/secp256k1

* ✨ Added `computePublicKey` util fn (dawsbot#118)

* Init computePublicKey util fn

* ✨ Added computePublicKey util fn

* 📝 Added documenation to computePublicKey

* ⬆ Pre-commit hook package bump, added @noble/secp256k1

* 🧪 Pass computeAddress test

* 📝 Add docs for computeAddress

* 📝 Pre-commit script update readme and chains

* 🧪 Pass tests with recoverPublicKey

* 📝 Pre-commit script readme update

Co-authored-by: daws.eth <dawsonbotsford@gmail.com>

* ✨ Added recoverAddress util fn

* 📝 Pre-commit script readme and chain updates

* run pre-commit

* replace bloated iife

* ✨ Added recoverAddress util fn

# Conflicts:
#	src/index.ts

* 📝 Pre-commit script readme and chain updates

# Conflicts:
#	readme.md
#	scripts/markdown-magic/typedoc.out.json

* run pre-commit

* replace bloated iife

* ♻️ Clean up code before merging

* ⬆️ Pre-commit script

* ♻️ Fix leftover console.log

* 🧪 Fix broken test for computeAddress

* 🧪 Add 64 byte test for codecov

* 🧪 Added test designed to throw for codecov

* 🧪 Added test designed to throw on invalid v for codecov

* Latest pre-commit

* Remove recoverAddress from readme

Co-authored-by: daws.eth <dawsonbotsford@gmail.com>
  • Loading branch information
arimgibson and dawsbot authored May 15, 2022
1 parent a95999c commit 42034bb
Show file tree
Hide file tree
Showing 17 changed files with 921 additions and 9,220 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ node_modules
lib
coverage

// typedoc accidental html output
# typedoc accidental html output
docs

.versions
.eslintcache
*.docker*
docusaurus/docs/api
docusaurus/build

# build artifact from typedoc
scripts/markdown-magic/typedoc.out.json
2,615 changes: 485 additions & 2,130 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
},
"devDependencies": {
"@types/body-parser": "^1.19.1",
"@types/eslint": "^8.4.1",
"@types/eslint": "^8.4.2",
"@types/express": "^4.17.13",
"@types/jest": "^27.4.1",
"@types/jest-dev-server": "^5.0.0",
"@types/node": "^16.10.1",
"@types/prettier": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"body-parser": "^1.19.0",
"dotenv": "^16.0.0",
"eslint": "^8.14.0",
"eslint-plugin-jest": "^26.1.5",
"ethers": "^5.6.4",
"eslint": "^8.15.0",
"eslint-plugin-jest": "^26.2.2",
"ethers": "^5.6.6",
"express": "^4.17.1",
"husky": "^7.0.4",
"jest": "^27.5.1",
Expand All @@ -63,6 +63,7 @@
"web3": "^1.7.3"
},
"dependencies": {
"@noble/secp256k1": "^1.5.5",
"@types/big.js": "^6.1.3",
"big.js": "^6.1.1",
"isomorphic-unfetch": "^3.1.0",
Expand Down
53 changes: 53 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
- [Install](#install)
- [🛠 Utils](#-utils)
- [`arrayify`](#arrayify)
- [`computeAddress`](#computeaddress)
- [`computePublicKey`](#computepublickey)
- [`concat`](#concat)
- [`etherToGwei`](#ethertogwei)
- [`etherToWei`](#ethertowei)
Expand All @@ -67,6 +69,7 @@
- [`keccak256`](#keccak256)
- [`pack`](#pack)
- [`solidityKeccak256`](#soliditykeccak256)
- [`splitSignature`](#splitsignature)
- [`stripZeros`](#stripzeros)
- [`tinyBig`](#tinybig)
- [`toChecksumAddress`](#tochecksumaddress)
Expand Down Expand Up @@ -147,6 +150,22 @@ arrayify('0x1', { hexPad: 'right' });

<br/>

#### [`computeAddress`](https://essential-eth.vercel.app/docs/api/modules#computeaddress)

```typescript
computeAddress(key: string): string
```

<br/>

#### [`computePublicKey`](https://essential-eth.vercel.app/docs/api/modules#computepublickey)

```typescript
computePublicKey(privKey: BytesLike): string
```

<br/>

#### [`concat`](https://essential-eth.vercel.app/docs/api/modules#concat)

```typescript
Expand Down Expand Up @@ -598,6 +617,40 @@ solidityKeccak256(types, values);

<br/>

#### [`splitSignature`](https://essential-eth.vercel.app/docs/api/modules#splitsignature)

```typescript
splitSignature(signature: SignatureLike): Signature
```

<details>
<summary>View Example</summary>

```js
import { splitSignature } from 'essential-eth';

// or in a require environment
const { splitSignature } = require('essential-eth');
```

```javascript
const signature = '0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee331b';
splitSignature(signature);
{
r: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b39716",
s: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
_vs: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
recoveryParam: 0,
v: 27,
yParityAndS: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
compact: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33"
}
```

</details>

<br/>

#### [`stripZeros`](https://essential-eth.vercel.app/docs/api/modules#stripzeros)

```typescript
Expand Down
Loading

0 comments on commit 42034bb

Please sign in to comment.