gitmark 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/git-mark-list +14 -7
  2. package/package.json +1 -1
package/bin/git-mark-list CHANGED
@@ -21,6 +21,13 @@ globalThis.data = {
21
21
  // console.log('data', data)
22
22
 
23
23
  // FUNCTIONS
24
+ function buf2hex(buffer) {
25
+ // buffer is an ArrayBuffer
26
+ return [...new Uint8Array(buffer)]
27
+ .map(x => x.toString(16).padStart(2, '0'))
28
+ .join('')
29
+ }
30
+
24
31
  const BITMARK = {
25
32
  messagePrefix: '\x19BITMARK Signed Message:\n',
26
33
  bech32: 'btm',
@@ -56,12 +63,6 @@ function addCryptoToCommit(commit) {
56
63
  )
57
64
  commit.wifkey = keyPair1.toWIF()
58
65
 
59
- function buf2hex(buffer) {
60
- // buffer is an ArrayBuffer
61
- return [...new Uint8Array(buffer)]
62
- .map(x => x.toString(16).padStart(2, '0'))
63
- .join('')
64
- }
65
66
 
66
67
  commit.pubkey = buf2hex(keyPair1.publicKey).substring(2)
67
68
  // console.log('private key WIF:', keyPair1.toWIF())
@@ -153,11 +154,17 @@ var b3
153
154
  // genesis
154
155
  var genesis = require('../gitmark.json')
155
156
  var genesisCommit = {
156
- "pubkey": genesis.pubkey,
157
157
  "hash": "genesis",
158
158
  "authorDate": genesis.created_at,
159
159
  "privkey": b1.toString(16)
160
160
  }
161
+ var keyPair1 = bitcoin.ECPair.fromPrivateKey(
162
+ Buffer.from(b1.toString(16), 'hex'),
163
+ { network: BITMARK }
164
+ )
165
+ genesisCommit.pubkey = buf2hex(keyPair1.publicKey).substring(2)
166
+
167
+
161
168
  // console.log('genesis', genesis)
162
169
  // console.log('genesisCommit', genesisCommit)
163
170
  if (!data.count) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "description": "gitmark",
5
5
  "main": "index.js",
6
6
  "scripts": {