Skip to content

Commit

Permalink
Merge pull request #17 from Nesopie/feat/hybrid
Browse files Browse the repository at this point in the history
Feat/hybrid
  • Loading branch information
junderw authored Jun 26, 2024
2 parents e6cbf72 + b532e4e commit bcbdbf2
Show file tree
Hide file tree
Showing 14 changed files with 4,102 additions and 8,316 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ jobs:
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run standard
gitdiff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run gitdiff
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,37 @@ See [bip66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki).
## Example

``` javascript
var bip66 = require('bip66')
var r = new Buffer('1ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777', 'hex')
var s = new Buffer('29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex')
import * as bip66 from"bip66"
const r = Buffer.from('1ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777', 'hex')
const s = Buffer.from('29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex')

// Buffer or UInt8Array can be passed in to the encode/decode functions
const signature = bip66.encode(r, s)
// Uint8Array(69) [
// 48, 67, 2, 32, 30, 161, 253, 255, 129, 179, 162,
// 113, 101, 157, 244, 170, 209, 155, 196, 239, 131, 222,
// 243, 137, 19, 26, 54, 53, 143, 230, 75, 36, 86,
// 50, 231, 119, 2, 31, 41, 225, 100, 101, 139, 233,
// 206, 129, 9, 33, 191, 129, 214, 184, 102, 148, 120,
// 90, 121, 234, 30, 82, 219, 250, 81, 5, 20, 141,
// 31, 11, 193
// ]

bip66.encode(r, s)
// Buffer <30 43 02 20 1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77 02 1f 29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1>

var signature = new Buffer('304302201ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777021f29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex')
bip66.decode(signature)
// => {
// r: Buffer <1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77>,
// s: Buffer <29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1>
// r: Uint8Array(32) [
// 30, 161, 253, 255, 129, 179, 162,
// 113, 101, 157, 244, 170, 209, 155,
// 196, 239, 131, 222, 243, 137, 19,
// 26, 54, 53, 143, 230, 75, 36,
// 86, 50, 231, 119
// ],
// s: Uint8Array(31) [
// 41, 225, 100, 101, 139, 233, 206, 129,
// 9, 33, 191, 129, 214, 184, 102, 148,
// 120, 90, 121, 234, 30, 82, 219, 250,
// 81, 5, 20, 141, 31, 11, 193
// ]
// }
```

Expand Down
113 changes: 0 additions & 113 deletions index.js

This file was deleted.

Loading

0 comments on commit bcbdbf2

Please sign in to comment.