gitmark 0.0.65 → 0.0.68

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-init CHANGED
@@ -145,6 +145,7 @@ console.log(`{
145
145
  "genesis": "gitmark:${tx}:0",
146
146
  "nick": "gitmark",
147
147
  "package": "./package.json",
148
+ "pubkey": "${keyPair1.publicKey.toString('hex')}",
148
149
  "repository": "./"
149
150
  }`)
150
151
 
package/bin/git-mark-list CHANGED
@@ -84,6 +84,7 @@ function addCryptoToCommit(commit) {
84
84
  function renderCommit(commit, type) {
85
85
  if (!commit) return
86
86
  commit.tags = commit.tags || []
87
+ if (commit.c) commit.tags.push(["c", commit.c])
87
88
  if (type === 'nostr') {
88
89
  var canon = [0, commit.pubkey, commit.authorDate, 17, commit.tags, commit.hash]
89
90
 
@@ -139,6 +140,8 @@ function getPrivKey() {
139
140
  data.privkey = argv._[0] || getPrivKey() || data.privkey
140
141
  data.g = argv.g
141
142
  data.count = argv.count
143
+ data.genesis = argv.genesis
144
+ data.created_at = argv.created
142
145
 
143
146
  var POINT = Buffer.from(data.privkey, 'hex')
144
147
 
@@ -154,11 +157,11 @@ var b3
154
157
 
155
158
 
156
159
  // genesis
157
- var genesis = require('../gitmark.json')
158
160
  var genesisCommit = {
159
161
  "hash": "genesis",
160
- "authorDate": genesis.created_at,
161
- "privkey": b1.toString(16)
162
+ "authorDate": data.created_at,
163
+ "privkey": b1.toString(16),
164
+ "c": data.genesis,
162
165
  }
163
166
  var keyPair1 = bitcoin.ECPair.fromPrivateKey(
164
167
  Buffer.from(b1.toString(16), 'hex'),
@@ -197,8 +200,13 @@ for (var i = commits.length - 1; i >= 0; i--) {
197
200
  hash: commits[i + 1]?.hash,
198
201
  subject: commits[i].subject,
199
202
  authorDate: Math.floor(new Date(commits[i].authorDate).getTime() / 1000),
200
- privkey: b1.toString(16)
203
+ privkey: b1.toString(16),
204
+ c: commits[i].subject
201
205
  }
206
+ if (commit.c && commit.c.split(":").length <= 2) {
207
+ commit.c = commit.c + ':0'
208
+ }
209
+ commit.c = commit?.c?.replace('gitmark ', 'gitmark:')
202
210
  commit = addCryptoToCommit(commit)
203
211
  // console.log(commit)
204
212
  gitmarks.push(commit)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.65",
3
+ "version": "0.0.68",
4
4
  "description": "gitmark",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,4 +37,4 @@
37
37
  "tiny-secp256k1": "^1.1.6",
38
38
  "ws": "^8.2.3"
39
39
  }
40
- }
40
+ }