@verax-ai/proxy 0.4.4 → 0.4.5
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/dist/ledger-manifest.js +6 -2
- package/dist/reconcile.js +3 -1
- package/dist/verify-ledger.js +7 -2
- package/package.json +1 -1
package/dist/ledger-manifest.js
CHANGED
|
@@ -201,13 +201,17 @@ export function parseIndexText(text) {
|
|
|
201
201
|
// The index is appended without fsync, so a crash can leave its last
|
|
202
202
|
// line half written. Such a line is skipped; the ref count below then
|
|
203
203
|
// falls short of the ledger's and the index is rebuilt from the pieces.
|
|
204
|
-
let
|
|
204
|
+
let parsed;
|
|
205
205
|
try {
|
|
206
|
-
|
|
206
|
+
parsed = JSON.parse(line);
|
|
207
207
|
}
|
|
208
208
|
catch {
|
|
209
209
|
continue;
|
|
210
210
|
}
|
|
211
|
+
// JSON that is not an object (null, an array, a number, a string) is not a row.
|
|
212
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
213
|
+
continue;
|
|
214
|
+
const raw = parsed;
|
|
211
215
|
if (typeof raw.ref !== "string" || typeof raw.piece !== "string")
|
|
212
216
|
continue;
|
|
213
217
|
rows.push({
|
package/dist/reconcile.js
CHANGED
|
@@ -41,7 +41,9 @@ function asChannelRow(raw, line) {
|
|
|
41
41
|
row.datePrecision = o.datePrecision;
|
|
42
42
|
return row;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
// A raw ref (REF_RE in proxy.ts), or the scoped form `<tenantKey>:<raw>` the proxy writes
|
|
45
|
+
// when the principal carries an issuer, tenant or org; tenantKey is a SHA-256 hex digest.
|
|
46
|
+
const VERAX_REF = /verax:((?:[0-9a-f]{64}:)?[A-Za-z0-9][A-Za-z0-9._-]{0,63})/;
|
|
45
47
|
const CARD_MINUTE_TOLERANCE_MS = 120_000;
|
|
46
48
|
function parseCardDate(raw, format, tzOffsetMinutes) {
|
|
47
49
|
const t = raw.trim();
|
package/dist/verify-ledger.js
CHANGED
|
@@ -496,13 +496,18 @@ function indexLineProblems(text) {
|
|
|
496
496
|
let parsedOk = 0;
|
|
497
497
|
for (let i = 0; i < filled.length; i += 1) {
|
|
498
498
|
const last = i === filled.length - 1;
|
|
499
|
+
let parsed;
|
|
499
500
|
try {
|
|
500
|
-
JSON.parse(filled[i].line);
|
|
501
|
-
parsedOk += 1;
|
|
501
|
+
parsed = JSON.parse(filled[i].line);
|
|
502
502
|
}
|
|
503
503
|
catch {
|
|
504
504
|
if (!last || parsedOk === 0)
|
|
505
505
|
problems.push(`index line ${filled[i].n} is not JSON`);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
parsedOk += 1;
|
|
509
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
510
|
+
problems.push(`index line ${filled[i].n} is not a JSON object`);
|
|
506
511
|
}
|
|
507
512
|
}
|
|
508
513
|
return problems;
|