@dotrino/identity 0.121.8 → 0.122.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/identity",
3
- "version": "0.121.8",
3
+ "version": "0.122.0",
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/src/index.d.ts CHANGED
@@ -312,6 +312,7 @@ export function assertionBody (args: { sub: string; aud: string; nonce: string;
312
312
  export function verifyAssertion (assertion: Assertion, opts: { audience: string; nonce: string; expectedProfileId?: string | null; now?: number; maxSkewMs?: number }): Promise<VerifiedAssertion>
313
313
  /** ¿Este contenido firmado (un pin, una atestación) va dirigido a mí? `aud` obligatorio; `exp` opcional. */
314
314
  export function verifySignedFor (args: { data: any; signature: string; publickey: string; chain: any[]; audience: string; expectedProfileId?: string | null; now?: number; maxSkewMs?: number }): Promise<{ ok: boolean; reason?: string; profileId?: string; signer?: string; seq?: number; aud?: string }>
315
+ export function signedFor (identity: { signData: (d: object) => Promise<{ signature: string; publickey: string; chain?: any[] }> }, opts: { aud: string; fields?: object; ttlMs?: number; now?: number }): Promise<{ body: Record<string, any>; signature: string; publickey: string; chain: any[] }>
315
316
 
316
317
  // ----- Sesiones: entrar sin enrolar (`@dotrino/identity/session`) -----
317
318
 
@@ -215,4 +215,28 @@ export async function verifySignedFor (args = {}) {
215
215
  return { ok: true, profileId: v.profileId, signer: v.signer, seq: v.seq, aud: data.aud }
216
216
  }
217
217
 
218
- export default { ASSERTION_V, ASSERTION_MAX_TTL_MS, ASSERTION_DEFAULT_TTL_MS, ASSERTION_MAX_SKEW_MS, SCOPES, SCOPE_CLAIMS, newAssertionNonce, cleanScopes, claimsAllowed, assertionBody, verifyAssertion, verifySignedFor }
218
+ /**
219
+ * LA OTRA MITAD DE `verifySignedFor`: firma una petición dirigida a un servicio (`aud`) con el
220
+ * perfil activo, lista para mandarla. Es lo que usan las páginas que hablan con un servicio de
221
+ * la cuenta sin sesiones ni cookies (el directorio de nombres, las cuentas de la bóveda
222
+ * alojada): cada petición lleva su firma, la llave del aparato y la cadena de selladores que
223
+ * prueba que ese aparato habla por la cuenta. Una vez aquí, y no copiado en cada página.
224
+ *
225
+ * const req = await signedFor(identity, { aud: 'https://accounts.dotrino.com', fields: { v: 1, op: 'mine' } })
226
+ * → { body: { aud, iat, exp, nonce, v, op }, signature, publickey, chain }
227
+ *
228
+ * Sin cadena no hay petición: el servicio no podría saber de qué cuenta es, y mandarla igual
229
+ * sería mandar algo que va a rechazar. Se para con `no-chain`.
230
+ *
231
+ * @param {{ signData: (d: object) => Promise<{ signature: string, publickey: string, chain?: any[] }> }} identity
232
+ * @param {{ aud: string, fields?: object, ttlMs?: number, now?: number }} opts
233
+ */
234
+ export async function signedFor (identity, { aud, fields = {}, ttlMs = 24 * 60 * 60 * 1000, now = Date.now() } = {}) {
235
+ if (typeof aud !== 'string' || !aud.trim()) throw Object.assign(new Error('signedFor: aud is required'), { code: 'no-audience' })
236
+ const body = { aud: aud.trim(), iat: now, exp: now + ttlMs, nonce: crypto.randomUUID(), ...fields }
237
+ const s = await identity.signData(body)
238
+ if (!Array.isArray(s?.chain) || !s.chain.length) throw Object.assign(new Error('this device cannot prove it belongs to the account'), { code: 'no-chain' })
239
+ return { body, signature: s.signature, publickey: s.publickey, chain: s.chain }
240
+ }
241
+
242
+ export default { ASSERTION_V, ASSERTION_MAX_TTL_MS, ASSERTION_DEFAULT_TTL_MS, ASSERTION_MAX_SKEW_MS, SCOPES, SCOPE_CLAIMS, newAssertionNonce, cleanScopes, claimsAllowed, assertionBody, verifyAssertion, verifySignedFor, signedFor }
@@ -1,3 +1,3 @@
1
- Copia vendorizada de @dotrino/roadmap@0.4.40 (dotrino-roadmap/src/{index,manifests}.js).
1
+ Copia vendorizada de @dotrino/roadmap@0.4.42 (dotrino-roadmap/src/{index,manifests}.js).
2
2
  NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
3
3
  El registro de versiones rotas que viaja con cada versión. Importa @dotrino/compat/ranges.
@@ -8,7 +8,7 @@
8
8
  export const MANIFESTS = Object.freeze({
9
9
  "dotrino": {
10
10
  "manifest": "dotrino",
11
- "seq": 35,
11
+ "seq": 36,
12
12
  "issued": "2026-10-18",
13
13
  "note": "Registro comun de compatibilidad del ecosistema. Se edita a mano en este repo y se consulta con @dotrino/roadmap. Rangos: ver @dotrino/compat/ranges (x.y.z, >= > <= <, «a - b», «*», o una lista que es un O).",
14
14
  "products": {
@@ -22,7 +22,7 @@ export const MANIFESTS = Object.freeze({
22
22
  "env": {
23
23
  "repo": "imdotrino/dotrino-vault",
24
24
  "npm": "@dotrino/env",
25
- "current": "0.93.0",
25
+ "current": "0.93.1",
26
26
  "protocol": 1,
27
27
  "requires": {
28
28
  "vault": ">=0.93.0"
@@ -31,7 +31,7 @@ export const MANIFESTS = Object.freeze({
31
31
  "identity": {
32
32
  "repo": "imdotrino/dotrino-identity",
33
33
  "npm": "@dotrino/identity",
34
- "current": "0.121.6",
34
+ "current": "0.121.8",
35
35
  "protocol": 1,
36
36
  "requires": {
37
37
  "proxy-client": ">=0.13.1"
@@ -131,10 +131,10 @@ export const MANIFESTS = Object.freeze({
131
131
  "remote-agent": {
132
132
  "repo": "imdotrino/dotrino-remote-agent",
133
133
  "npm": "@dotrino/remote-agent",
134
- "current": "0.22.4",
134
+ "current": "0.22.5",
135
135
  "protocol": 1,
136
136
  "requires": {
137
- "identity": ">=0.121.4",
137
+ "identity": ">=0.121.7",
138
138
  "vault": ">=0.85.0",
139
139
  "proxy-client": ">=0.36.1",
140
140
  "vaultd": ">=0.154.0"
@@ -143,11 +143,11 @@ export const MANIFESTS = Object.freeze({
143
143
  "terminal-agent": {
144
144
  "repo": "imdotrino/dotrino-terminal",
145
145
  "npm": "@dotrino/terminal-agent",
146
- "current": "0.49.0",
146
+ "current": "0.49.1",
147
147
  "protocol": 2,
148
148
  "requires": {
149
- "remote-agent": ">=0.22.4",
150
- "identity": ">=0.121.6",
149
+ "remote-agent": ">=0.22.5",
150
+ "identity": ">=0.121.7",
151
151
  "vault": ">=0.93.0",
152
152
  "proxy-client": ">=0.38.4",
153
153
  "vaultd": ">=0.142.0"
@@ -205,13 +205,13 @@ export const MANIFESTS = Object.freeze({
205
205
  "sealers": {
206
206
  "repo": "imdotrino/dotrino-sealers",
207
207
  "npm": "@dotrino/sealers",
208
- "current": "0.10.2",
208
+ "current": "0.10.4",
209
209
  "protocol": 1,
210
210
  "requires": {
211
- "remote-agent": ">=0.20.1",
212
- "identity": ">=0.117.2",
213
- "vault": ">=0.87.0",
214
- "proxy-client": ">=0.36.1"
211
+ "remote-agent": ">=0.22.4",
212
+ "identity": ">=0.121.7",
213
+ "vault": ">=0.93.1",
214
+ "proxy-client": ">=0.38.4"
215
215
  }
216
216
  },
217
217
  "roadmap": {
@@ -253,7 +253,7 @@ export const MANIFESTS = Object.freeze({
253
253
  "vault": {
254
254
  "repo": "imdotrino/dotrino-vault",
255
255
  "npm": "@dotrino/vault",
256
- "current": "0.93.0",
256
+ "current": "0.93.1",
257
257
  "protocol": 1,
258
258
  "requires": {
259
259
  "vaultd": ">=0.105.0",
@@ -269,7 +269,7 @@ export const MANIFESTS = Object.freeze({
269
269
  "vaultd": {
270
270
  "repo": "imdotrino/dotrino-vault",
271
271
  "npm": "@dotrino/vaultd",
272
- "current": "0.165.0",
272
+ "current": "0.165.1",
273
273
  "protocol": 1,
274
274
  "requires": {
275
275
  "identity": ">=0.118.0",
@@ -369,7 +369,8 @@ export const MANIFESTS = Object.freeze({
369
369
  "requires": {
370
370
  "identity": ">=0.116.0",
371
371
  "remote-agent": ">=0.19.0",
372
- "vault": ">=0.92.0"
372
+ "vault": ">=0.93.1",
373
+ "pay": ">=0.1.0"
373
374
  }
374
375
  },
375
376
  "ai": {
@@ -378,6 +379,13 @@ export const MANIFESTS = Object.freeze({
378
379
  "current": "0.1.1",
379
380
  "protocol": 1,
380
381
  "requires": {}
382
+ },
383
+ "pay": {
384
+ "repo": "imdotrino/dotrino-pay",
385
+ "npm": "@dotrino/pay",
386
+ "current": "0.1.0",
387
+ "protocol": 1,
388
+ "requires": {}
381
389
  }
382
390
  },
383
391
  "broken": [