@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vault/core.js +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/identity",
3
- "version": "0.114.0",
3
+ "version": "0.114.1",
4
4
  "description": "Identidad y rating de usuarios compartidos entre apps de Dotrino (vault iframe + postMessage)",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
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
- if (Array.isArray(v)) return '[' + v.map(canonicalStringify).join(',') + ']'
68
- const ks = Object.keys(v).sort()
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