gitmark 0.0.27 → 0.0.28

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-init +42 -34
  2. package/package.json +3 -2
package/bin/git-mark-init CHANGED
@@ -57,58 +57,66 @@ console.log('data', data)
57
57
 
58
58
  // MAIN
59
59
  // check if already init
60
+ console.log('checking if init already')
61
+ // how
62
+ // config
63
+ // gitmark.json
64
+ // commits
60
65
 
61
- // get secret
62
- if (!data.secret) {
63
- var gen = $(`git config gitmark.secret $(git config--get remote.origin.url | ssh - keygen - Y sign - f ~/.ssh/id_rsa - n gitmark - | sha256sum | head - c 40)`)
64
- console.log(gen)
66
+ function getNewSecret() {
67
+ try {
68
+ var sshkey = `$HOME/.ssh/id_rsa`
69
+ var cmd = `pwd | ssh-keygen -Y sign -f ${sshkey} -n gitmark - | sha256sum | head -c 64`
70
+ var newSecret = $(cmd).toString()
71
+ return newSecret
72
+ } catch {
65
73
 
74
+ }
66
75
  }
67
76
 
77
+ // get secret
68
78
  // generate secret if none
79
+ if (data.secret) {
80
+ console.log('no secret found')
81
+ var newsecret = getNewSecret()
82
+ console.log('newsecret', newsecret)
83
+ data.secret = newsecret
69
84
 
70
- // generate address from secret
71
- const POINT = Buffer.from(data.secret, 'hex')
72
-
73
-
74
-
75
- // put all in config, if not there
76
-
77
-
78
- // get faucet
79
-
80
- // if new add to faucet
81
-
82
- // get tx value
83
-
84
- // print to screen
85
-
86
- // create gitmark.json
87
85
 
88
- // git mark genesis
86
+ // var gen = $(`git config gitmark.secret $(git config--get remote.origin.url | ssh - keygen - Y sign - f ~/.ssh/id_rsa - n gitmark - | sha256sum | head - c 40)`)
87
+ // console.log(gen)
89
88
 
89
+ }
90
90
 
91
- // OLD
92
- // priv keys
93
- const b1 = BigInt('0x' + data.secret)
91
+ console.log('using secret', data.secret)
94
92
 
95
- // pub keys
93
+ // generate address from secret
94
+ const POINT = Buffer.from(data.secret, 'hex')
96
95
  var keyPair1 = bitcoin.ECPair.fromPrivateKey(POINT)
97
-
98
-
99
- // print pub keys
100
96
  console.log('public keys hex buffer')
101
97
  console.log(keyPair1.publicKey)
102
-
103
- // print priv keys
104
98
  console.log('private keys hex')
105
- console.log(b1.toString(16))
106
-
107
- // address from priv key addition
108
99
  var { address } = bitcoin.payments.p2pkh({
109
100
  pubkey: keyPair1.publicKey,
110
101
  network: NETWORK
111
102
  })
112
103
  console.log('pubkey address computed from private', address)
113
104
 
105
+ // todo: put all in config, if not there
106
+
114
107
 
108
+ // get faucet
109
+ console.log('faucet', data.faucet)
110
+
111
+ // add to faucet
112
+ console.log('type', address, 'into', data.faucet, 'and wait for tx to get in a block')
113
+
114
+ // todo get tx value
115
+
116
+ // todo print to screen
117
+
118
+ // create gitmark.json
119
+ console.log('create gitmark.json and check in files')
120
+
121
+ // git mark genesis
122
+ console.log('run git mark --genesis tx')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "gitmark",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,8 @@
14
14
  "gitmark"
15
15
  ],
16
16
  "bin": {
17
- "git-mark": "bin/git-mark"
17
+ "git-mark": "bin/git-mark",
18
+ "git-mark-init": "bin/git-mark-init"
18
19
  },
19
20
  "author": "Melvin Carvalho",
20
21
  "license": "MIT",