@dotrino/identity 0.114.0 → 0.114.1
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/package.json +1 -1
- package/vault/core.js +6 -2
package/package.json
CHANGED
package/vault/core.js
CHANGED
|
@@ -64,8 +64,12 @@ const PILAR_VAULT = '@dotrino/vault'
|
|
|
64
64
|
|
|
65
65
|
export function canonicalStringify (v) {
|
|
66
66
|
if (v === null || typeof v !== 'object') return JSON.stringify(v)
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
// Un array con `undefined` va como `null`, igual que en JSON.stringify.
|
|
68
|
+
if (Array.isArray(v)) return '[' + v.map((x) => x === undefined ? 'null' : canonicalStringify(x)).join(',') + ']'
|
|
69
|
+
// Una clave con `undefined` NO existe, igual que en JSON.stringify: antes salía como
|
|
70
|
+
// `"k":undefined` (ni siquiera es JSON) y lo firmado en memoria no cuadraba con lo mismo
|
|
71
|
+
// leído del disco o de la red (el directorio de nombres, 2026-10-15).
|
|
72
|
+
const ks = Object.keys(v).filter((k) => v[k] !== undefined).sort()
|
|
69
73
|
return '{' + ks.map(k => JSON.stringify(k) + ':' + canonicalStringify(v[k])).join(',') + '}'
|
|
70
74
|
}
|
|
71
75
|
|