gitmark 0.0.64 → 0.0.65

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.
package/bin/git-mark-list CHANGED
@@ -83,10 +83,11 @@ function addCryptoToCommit(commit) {
83
83
 
84
84
  function renderCommit(commit, type) {
85
85
  if (!commit) return
86
+ commit.tags = commit.tags || []
86
87
  if (type === 'nostr') {
87
- var canon = [0, commit.pubkey, commit.authorDate, 17, [], commit.hash]
88
+ var canon = [0, commit.pubkey, commit.authorDate, 17, commit.tags, commit.hash]
88
89
 
89
- canon = JSON.stringify(canon)
90
+ canon = JSON.stringify(canon).replace(/\\"/g, '"')
90
91
  var id = sha256(canon)
91
92
 
92
93
  // console.log(canon)
@@ -102,7 +103,7 @@ function renderCommit(commit, type) {
102
103
  // console.log(sig)
103
104
  // var sig = 1
104
105
 
105
- var event = `["EVENT",{"id":"${id}","pubkey":"${commit.pubkey}","created_at":${commit.authorDate},"kind":${KIND_CODE},"tags":[],"content":"${commit.hash}","sig":"${sig}"}]`
106
+ var event = `["EVENT",{"id":"${id}","pubkey":"${commit.pubkey}","created_at":${commit.authorDate},"kind":${KIND_CODE},"tags":${JSON.stringify(commit.tags)},"content":"${commit.hash}","sig":"${sig}"}]`
106
107
 
107
108
  console.log(event)
108
109
  } else {
@@ -136,6 +137,7 @@ function getPrivKey() {
136
137
 
137
138
  // INIT
138
139
  data.privkey = argv._[0] || getPrivKey() || data.privkey
140
+ data.g = argv.g
139
141
  data.count = argv.count
140
142
 
141
143
  var POINT = Buffer.from(data.privkey, 'hex')
@@ -163,6 +165,9 @@ var keyPair1 = bitcoin.ECPair.fromPrivateKey(
163
165
  { network: BITMARK }
164
166
  )
165
167
  genesisCommit.pubkey = buf2hex(keyPair1.publicKey).substring(2)
168
+ if (data.g) {
169
+ genesisCommit.tags = [["g", data.g]]
170
+ }
166
171
 
167
172
 
168
173
  // console.log('genesis', genesis)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "description": "gitmark",
5
5
  "main": "index.js",
6
6
  "scripts": {