@stream44.studio/t44-blockchaincommons.com 0.1.0-rc.6 → 0.1.0-rc.7
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/oi +2 -2
- package/caps/XidDocumentLedger.test.ts +8 -2
- package/examples/01-XID-DocumentLedger/main.test.ts +7 -2
- package/examples/02-XID-Rotate-InceptionKey/main.test.ts +29 -8
- package/package.json +4 -1
- package/caps/__snapshots__/XidDocumentLedger.test.ts.snap +0 -11
- package/caps/__snapshots__/XidLedger.test.ts.snap +0 -11
- package/examples/01-XID-DocumentLedger/__snapshots__/main.test.ts.snap +0 -10
- package/examples/02-XID-Rotate-InceptionKey/__snapshots__/main.test.ts.snap +0 -53
package/bin/oi
CHANGED
|
@@ -58,7 +58,7 @@ const program = new Command()
|
|
|
58
58
|
program
|
|
59
59
|
.command('init')
|
|
60
60
|
.description('Initialize a Gordian Open Integrity repository in the current directory')
|
|
61
|
-
.argument('
|
|
61
|
+
.argument('[system]', `Integrity system to initialize (${SUPPORTED_SYSTEMS.join(', ')})`, 'GordianOpenIntegrity')
|
|
62
62
|
.requiredOption('--inception-key <path>', 'Path to the SSH private key for inception signing')
|
|
63
63
|
.option('--author-name <name>', 'Author name for git commits', 'Author')
|
|
64
64
|
.option('--author-email <email>', 'Author email for git commits', 'author@example.com')
|
|
@@ -99,7 +99,7 @@ program
|
|
|
99
99
|
program
|
|
100
100
|
.command('validate')
|
|
101
101
|
.description('Validate a Gordian Open Integrity repository in the current directory')
|
|
102
|
-
.argument('
|
|
102
|
+
.argument('[system]', `Integrity system to validate (${SUPPORTED_SYSTEMS.join(', ')})`, 'GordianOpenIntegrity')
|
|
103
103
|
.option('--mark <mark>', 'Published provenance mark to verify against')
|
|
104
104
|
.action(async (system, opts) => {
|
|
105
105
|
validateSystem(system)
|
|
@@ -410,9 +410,15 @@ describe('XID Ledger', function () {
|
|
|
410
410
|
expect(summary).toContain('#3')
|
|
411
411
|
})
|
|
412
412
|
|
|
413
|
-
it('should
|
|
413
|
+
it('should have correct summary structure', async function () {
|
|
414
414
|
const summary = await revisionLedger.formatSummary({ ledger })
|
|
415
|
-
|
|
415
|
+
const lines = summary.split('\n')
|
|
416
|
+
expect(lines[0]).toContain('4 revisions')
|
|
417
|
+
expect(lines[1]).toMatch(/^XID: XID\([0-9a-f]{8}\)$/)
|
|
418
|
+
expect(lines[3]).toMatch(/#0 .+ "genesis"/)
|
|
419
|
+
expect(lines[4]).toMatch(/#1 .+ "add-bob"/)
|
|
420
|
+
expect(lines[5]).toMatch(/#2 .+ "remove-inception"/)
|
|
421
|
+
expect(lines[6]).toMatch(/#3 .+ "add-carol"/)
|
|
416
422
|
})
|
|
417
423
|
})
|
|
418
424
|
|
|
@@ -173,9 +173,14 @@ describe('XID Ledger', function () {
|
|
|
173
173
|
|
|
174
174
|
describe('5. Summary', function () {
|
|
175
175
|
|
|
176
|
-
it('should
|
|
176
|
+
it('should have correct ledger summary', async function () {
|
|
177
177
|
const summary = await revisionLedger.formatSummary({ ledger })
|
|
178
|
-
|
|
178
|
+
const lines = summary.split('\n')
|
|
179
|
+
expect(lines[0]).toContain('3 revisions')
|
|
180
|
+
expect(lines[1]).toMatch(/^XID: XID\([0-9a-f]{8}\)$/)
|
|
181
|
+
expect(lines[3]).toMatch(/#0 .+ "genesis"/)
|
|
182
|
+
expect(lines[4]).toMatch(/#1 .+ "add-second-key"/)
|
|
183
|
+
expect(lines[5]).toMatch(/#2 .+ "add-third-key"/)
|
|
179
184
|
})
|
|
180
185
|
})
|
|
181
186
|
|
|
@@ -89,14 +89,20 @@ describe('XID Rotate Inception Key', function () {
|
|
|
89
89
|
expect(keys.length).toBe(1)
|
|
90
90
|
})
|
|
91
91
|
|
|
92
|
-
it('should
|
|
92
|
+
it('should have correct inception document format', async function () {
|
|
93
93
|
const genesis = await revisionLedger.getGenesis({ ledger })
|
|
94
94
|
const text = await revisionLedger.formatRevision({
|
|
95
95
|
revision: genesis,
|
|
96
96
|
privateKeyOptions: XIDPrivateKeyOptions.Include,
|
|
97
97
|
generatorOptions: XIDGeneratorOptions.Include,
|
|
98
98
|
})
|
|
99
|
-
expect(text).
|
|
99
|
+
expect(text).toMatch(/^XID\([0-9a-f]{8}\)/)
|
|
100
|
+
expect(text).toContain("'provenance'")
|
|
101
|
+
expect(text).toContain("'key'")
|
|
102
|
+
expect(text).toContain("'privateKey'")
|
|
103
|
+
expect(text).toContain("'allow': 'All'")
|
|
104
|
+
expect(text).toContain("'salt'")
|
|
105
|
+
expect(text).toContain("'provenanceGenerator'")
|
|
100
106
|
})
|
|
101
107
|
})
|
|
102
108
|
|
|
@@ -128,14 +134,19 @@ describe('XID Rotate Inception Key', function () {
|
|
|
128
134
|
expect(keys.length).toBe(2)
|
|
129
135
|
})
|
|
130
136
|
|
|
131
|
-
it('should
|
|
137
|
+
it('should have correct two-key document format', async function () {
|
|
132
138
|
const rev = await revisionLedger.getRevisionByLabel({ ledger, label: 'add-bob-key' })
|
|
133
139
|
const text = await revisionLedger.formatRevision({
|
|
134
140
|
revision: rev,
|
|
135
141
|
privateKeyOptions: XIDPrivateKeyOptions.Include,
|
|
136
142
|
generatorOptions: XIDGeneratorOptions.Include,
|
|
137
143
|
})
|
|
138
|
-
expect(text).
|
|
144
|
+
expect(text).toMatch(/^XID\([0-9a-f]{8}\)/)
|
|
145
|
+
expect(text).toContain("'provenance'")
|
|
146
|
+
const keyMatches = text.match(/'key'/g) || []
|
|
147
|
+
expect(keyMatches.length).toBe(2)
|
|
148
|
+
expect(text).toContain("'privateKey'")
|
|
149
|
+
expect(text).toContain("'allow': 'All'")
|
|
139
150
|
})
|
|
140
151
|
})
|
|
141
152
|
|
|
@@ -168,14 +179,19 @@ describe('XID Rotate Inception Key', function () {
|
|
|
168
179
|
expect(keys.length).toBe(1)
|
|
169
180
|
})
|
|
170
181
|
|
|
171
|
-
it('should
|
|
182
|
+
it('should have correct post-rotation document format', async function () {
|
|
172
183
|
const rev = await revisionLedger.getLatest({ ledger })
|
|
173
184
|
const text = await revisionLedger.formatRevision({
|
|
174
185
|
revision: rev,
|
|
175
186
|
privateKeyOptions: XIDPrivateKeyOptions.Include,
|
|
176
187
|
generatorOptions: XIDGeneratorOptions.Include,
|
|
177
188
|
})
|
|
178
|
-
expect(text).
|
|
189
|
+
expect(text).toMatch(/^XID\([0-9a-f]{8}\)/)
|
|
190
|
+
expect(text).toContain("'provenance'")
|
|
191
|
+
const keyMatches = text.match(/'key'/g) || []
|
|
192
|
+
expect(keyMatches.length).toBe(1)
|
|
193
|
+
expect(text).not.toContain("'privateKey'")
|
|
194
|
+
expect(text).toContain("'allow': 'All'")
|
|
179
195
|
})
|
|
180
196
|
})
|
|
181
197
|
|
|
@@ -223,9 +239,14 @@ describe('XID Rotate Inception Key', function () {
|
|
|
223
239
|
expect(provenance.mark.seq()).toBe(2)
|
|
224
240
|
})
|
|
225
241
|
|
|
226
|
-
it('should
|
|
242
|
+
it('should have correct ledger summary', async function () {
|
|
227
243
|
const summary = await revisionLedger.formatSummary({ ledger })
|
|
228
|
-
|
|
244
|
+
const lines = summary.split('\n')
|
|
245
|
+
expect(lines[0]).toContain('3 revisions')
|
|
246
|
+
expect(lines[1]).toMatch(/^XID: XID\([0-9a-f]{8}\)$/)
|
|
247
|
+
expect(lines[3]).toMatch(/#0 .+ "genesis"/)
|
|
248
|
+
expect(lines[4]).toMatch(/#1 .+ "add-bob-key"/)
|
|
249
|
+
expect(lines[5]).toMatch(/#2 .+ "remove-inception-key"/)
|
|
229
250
|
})
|
|
230
251
|
})
|
|
231
252
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream44.studio/t44-blockchaincommons.com",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "BSD-2-Clause-Patent",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"oi": "./bin/oi"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "bun test"
|
|
12
|
+
},
|
|
10
13
|
"exports": {
|
|
11
14
|
"./caps/xid": "./caps/xid.ts",
|
|
12
15
|
"./caps/open-integrity-sh": "./caps/open-integrity-sh.ts",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`XID Ledger 8. Formatting should match the summary snapshot 1`] = `
|
|
4
|
-
"XID Ledger (4 revisions)
|
|
5
|
-
XID: XID(f95374c5)
|
|
6
|
-
|
|
7
|
-
#0 [e68fd97e] 2025-01-01T00:00:00Z "genesis"
|
|
8
|
-
#1 [e650a82a] 2025-01-02T00:00:00Z "add-bob"
|
|
9
|
-
#2 [0e0eb11a] 2025-01-03T00:00:00Z "remove-inception"
|
|
10
|
-
#3 [08b020f5] 2025-01-04T00:00:00Z "add-carol""
|
|
11
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`XID Ledger 8. Formatting should match the summary snapshot 1`] = `
|
|
4
|
-
"XID Ledger (4 revisions)
|
|
5
|
-
XID: XID(316400b5)
|
|
6
|
-
|
|
7
|
-
#0 [e68fd97e] 2025-01-01T00:00:00Z "genesis"
|
|
8
|
-
#1 [e650a82a] 2025-01-02T00:00:00Z "add-bob"
|
|
9
|
-
#2 [0e0eb11a] 2025-01-03T00:00:00Z "remove-inception"
|
|
10
|
-
#3 [08b020f5] 2025-01-04T00:00:00Z "add-carol""
|
|
11
|
-
`;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`XID Ledger 5. Summary should match the ledger summary snapshot 1`] = `
|
|
4
|
-
"XID Ledger (3 revisions)
|
|
5
|
-
XID: XID(df11fde8)
|
|
6
|
-
|
|
7
|
-
#0 [c2a54b58] 2025-01-01T00:00:00Z "genesis"
|
|
8
|
-
#1 [ea3da3a2] 2025-01-02T00:00:00Z "add-second-key"
|
|
9
|
-
#2 [7a00c8ef] 2025-01-03T00:00:00Z "add-third-key""
|
|
10
|
-
`;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`XID Rotate Inception Key 1. Inception should match the inception document snapshot 1`] = `
|
|
4
|
-
"XID(92b79181) [
|
|
5
|
-
'provenance': Bytes(115) [
|
|
6
|
-
'provenanceGenerator': Bytes(190)
|
|
7
|
-
'salt': Bytes(32)
|
|
8
|
-
]
|
|
9
|
-
'key': Bytes(78) [
|
|
10
|
-
'privateKey': Bytes(78)
|
|
11
|
-
'allow': 'All'
|
|
12
|
-
'salt': Bytes(32)
|
|
13
|
-
]
|
|
14
|
-
]"
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`XID Rotate Inception Key 2. Add Bob key should match the two-key document snapshot 1`] = `
|
|
18
|
-
"XID(92b79181) [
|
|
19
|
-
'key': Bytes(80) [
|
|
20
|
-
'allow': 'All'
|
|
21
|
-
]
|
|
22
|
-
'provenance': Bytes(115) [
|
|
23
|
-
'provenanceGenerator': Bytes(190)
|
|
24
|
-
'salt': Bytes(32)
|
|
25
|
-
]
|
|
26
|
-
'key': Bytes(78) [
|
|
27
|
-
'privateKey': Bytes(78)
|
|
28
|
-
'allow': 'All'
|
|
29
|
-
'salt': Bytes(32)
|
|
30
|
-
]
|
|
31
|
-
]"
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
exports[`XID Rotate Inception Key 3. Remove inception key should match the post-rotation document snapshot 1`] = `
|
|
35
|
-
"XID(92b79181) [
|
|
36
|
-
'key': Bytes(80) [
|
|
37
|
-
'allow': 'All'
|
|
38
|
-
]
|
|
39
|
-
'provenance': Bytes(115) [
|
|
40
|
-
'salt': Bytes(32)
|
|
41
|
-
'provenanceGenerator': Bytes(190)
|
|
42
|
-
]
|
|
43
|
-
]"
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
exports[`XID Rotate Inception Key 4. Ledger verification should match the ledger summary snapshot 1`] = `
|
|
47
|
-
"XID Ledger (3 revisions)
|
|
48
|
-
XID: XID(92b79181)
|
|
49
|
-
|
|
50
|
-
#0 [5361a340] 2025-01-01T00:00:00Z "genesis"
|
|
51
|
-
#1 [5390d204] 2025-01-02T00:00:00Z "add-bob-key"
|
|
52
|
-
#2 [8d37902e] 2025-01-03T00:00:00Z "remove-inception-key""
|
|
53
|
-
`;
|