@dotrino/identity 0.136.1 → 0.136.3
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 +3 -2
- package/src/index.d.ts +60 -2
- package/src/index.js +364 -81
- package/src/node.js +29 -5
- package/types/acta.d.ts +397 -175
- package/types/assertion.d.ts +25 -18
- package/types/avatar.d.ts +14 -3
- package/types/capabilities.d.ts +110 -61
- package/types/content.d.ts +88 -45
- package/types/core.d.ts +578 -383
- package/types/keyid.d.ts +10 -3
- package/types/machine.d.ts +5 -1
- package/types/peerStore.d.ts +80 -0
- package/types/peerSync.d.ts +20 -6
- package/types/remote.d.ts +170 -42
- package/types/session.d.ts +74 -81
- package/types/sessionFlow.d.ts +108 -33
- package/types/vaultSeal.d.ts +21 -9
- package/vault/acta.js +245 -29
- package/vault/assertion.js +13 -4
- package/vault/avatar.js +12 -1
- package/vault/capabilities.js +56 -6
- package/vault/channel.js +18 -2
- package/vault/content.js +60 -6
- package/vault/core.js +419 -88
- package/vault/externalKeys.js +34 -2
- package/vault/facade.js +182 -24
- package/vault/globals.d.ts +60 -0
- package/vault/keyid.js +10 -1
- package/vault/machine.js +7 -1
- package/vault/nativeStore.js +21 -4
- package/vault/originPolicy.js +13 -2
- package/vault/peerStore.js +57 -10
- package/vault/peerSync.js +23 -4
- package/vault/remote.js +132 -32
- package/vault/session.js +24 -7
- package/vault/sessionFlow.js +43 -9
- package/vault/sync.js +59 -15
- package/vault/vault.js +78 -49
- package/vault/vaultSeal.js +18 -7
- package/vault/vendor/opaque/VERSION.txt +1 -1
- package/vault/vendor/opaque/src/index.js +90 -13
- package/vault/vendor/proxy-client/VERSION.txt +1 -1
- package/vault/vendor/proxy-client/binpack.js +38 -7
- package/vault/vendor/proxy-client/ble/manager.js +148 -36
- package/vault/vendor/proxy-client/ble/wire.js +74 -9
- package/vault/vendor/proxy-client/canonical.js +6 -2
- package/vault/vendor/proxy-client/client.js +439 -130
- package/vault/vendor/proxy-client/encpub.js +9 -1
- package/vault/vendor/proxy-client/index.js +4 -0
- package/vault/vendor/proxy-client/parts.js +22 -2
- package/vault/vendor/proxy-client/sealing.js +60 -9
- package/vault/vendor/proxy-client/signature.js +38 -1
- package/vault/vendor/proxy-client/stats-log.js +29 -9
- package/vault/vendor/proxy-client/stats.js +36 -8
- package/vault/vendor/proxy-client/webrtc.js +95 -16
- package/vault/vendor/roadmap/VERSION.txt +1 -1
- package/vault/vendor/roadmap/index.js +85 -9
- package/vault/vendor/roadmap/manifests.js +25 -24
- package/vault/vendor/vault/VERSION.txt +1 -1
- package/vault/vendor/vault/admin.js +4 -1
- package/vault/vendor/vault/core/libVersion.js +1 -1
- package/vault/vendor/vault/core/secretsStore.js +4 -1
- package/vault/vendor/vault/core/vault.js +14 -3
- package/vault/vendor/vault/passwordLogins.js +4 -2
package/types/core.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export function
|
|
3
|
-
|
|
1
|
+
/** @param {any} v @returns {string} */
|
|
2
|
+
export function canonicalStringify(v: any): string;
|
|
3
|
+
/** @param {ArrayBuffer | ArrayLike<number>} buf @returns {string} */
|
|
4
|
+
export function bufToBase64(buf: ArrayBuffer | ArrayLike<number>): string;
|
|
5
|
+
/** @param {string} b64 @returns {ArrayBuffer} */
|
|
6
|
+
export function base64ToBuf(b64: string): ArrayBuffer;
|
|
4
7
|
/**
|
|
5
8
|
* QUÉ CLASE ES CADA DATO DEL PERFIL: `public` o `private`
|
|
6
9
|
* (`dotrino-vault/docs/datos-del-perfil.md` §2).
|
|
@@ -13,10 +16,11 @@ export function base64ToBuf(b64: any): ArrayBuffer;
|
|
|
13
16
|
* Sensibles (teléfono, dirección) OCULTOS salvo que su marca diga que sí, explícitamente.
|
|
14
17
|
* El resto se comparte salvo que digas que no.
|
|
15
18
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @param {Record<string, any>} [m]
|
|
21
|
+
* @returns {Record<string, 'public' | 'private'>}
|
|
22
|
+
*/
|
|
23
|
+
export function profileFieldClasses(m?: Record<string, any>): Record<string, "public" | "private">;
|
|
20
24
|
/**
|
|
21
25
|
* `askConsent` es CÓMO SE PREGUNTA, y lo pone quien monta el núcleo (el iframe pinta su
|
|
22
26
|
* propio panel; en Node no hay a quién preguntar). Se inyecta en vez de vivir aquí porque
|
|
@@ -24,31 +28,22 @@ export function profileFieldClasses(m?: {}): {
|
|
|
24
28
|
* aplicación que pide sería la aplicación aprobándose a sí misma.
|
|
25
29
|
*
|
|
26
30
|
* Si no se inyecta, no se concede nada nuevo: sin forma de preguntar, la respuesta es no.
|
|
31
|
+
*
|
|
32
|
+
* @param {CoreDeps} deps
|
|
27
33
|
*/
|
|
28
|
-
export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: hostKeyStore, sessionKv, removeAccountOnExpulsion, keyLock, askConsent }: {
|
|
29
|
-
kv: any;
|
|
30
|
-
peers: any;
|
|
31
|
-
makeSync?: any;
|
|
32
|
-
keyStore?: any;
|
|
33
|
-
sessionKv?: any;
|
|
34
|
-
removeAccountOnExpulsion?: boolean;
|
|
35
|
-
keyLock?: any;
|
|
36
|
-
askConsent?: any;
|
|
37
|
-
}): Promise<{
|
|
34
|
+
export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: hostKeyStore, sessionKv, removeAccountOnExpulsion, keyLock, askConsent }: CoreDeps): Promise<{
|
|
38
35
|
handlers: {
|
|
39
36
|
profileLockStatus(): Promise<{
|
|
40
37
|
protected: boolean;
|
|
41
38
|
locked: boolean;
|
|
42
39
|
}>;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}): Promise<{
|
|
40
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
41
|
+
unlockProfile({ password }: HandlerParams): Promise<{
|
|
46
42
|
ok: boolean;
|
|
47
43
|
locked: boolean;
|
|
48
44
|
}>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}): Promise<{
|
|
45
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
46
|
+
setProfilePassword({ password }: HandlerParams): Promise<{
|
|
52
47
|
ok: boolean;
|
|
53
48
|
}>;
|
|
54
49
|
removeProfilePassword(): Promise<{
|
|
@@ -57,20 +52,15 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
57
52
|
makeChallenge(): Promise<{
|
|
58
53
|
nonce: `${string}-${string}-${string}-${string}-${string}`;
|
|
59
54
|
}>;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}): Promise<{
|
|
55
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
56
|
+
signChallenge({ nonce }: HandlerParams): Promise<{
|
|
63
57
|
nonce: string;
|
|
64
|
-
publickey:
|
|
65
|
-
encryptionPubkey:
|
|
66
|
-
signature:
|
|
58
|
+
publickey: string;
|
|
59
|
+
encryptionPubkey: string;
|
|
60
|
+
signature: string;
|
|
67
61
|
}>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
publickey: any;
|
|
71
|
-
signature: any;
|
|
72
|
-
encryptionPubkey: any;
|
|
73
|
-
}): Promise<{
|
|
62
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
63
|
+
verifyResponse({ nonce, publickey, signature, encryptionPubkey }: HandlerParams): Promise<{
|
|
74
64
|
ok: boolean;
|
|
75
65
|
reason?: undefined;
|
|
76
66
|
publickey?: undefined;
|
|
@@ -86,68 +76,45 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
86
76
|
ok: boolean;
|
|
87
77
|
publickey: any;
|
|
88
78
|
encryptionPubkey: any;
|
|
89
|
-
peer:
|
|
79
|
+
peer: import("./peerStore.js").PeerRecord;
|
|
90
80
|
reason?: undefined;
|
|
91
81
|
}>;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}): Promise<any>;
|
|
82
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
83
|
+
getPeer({ publickey }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
95
84
|
/**
|
|
96
85
|
* BLOQUEAR a alguien (dueño, 2026-10-05): un indicador PRIVADO, aparte de la calificación.
|
|
97
86
|
* No se firma ni se publica —no es una opinión sobre esa persona, es tu decisión de no
|
|
98
87
|
* recibirla—, viaja con el libro de contactos a tu bóveda y a tus aparatos, y lo respeta
|
|
99
88
|
* cada app que recibe mensajes (el messenger, el primero). Desbloquear deja `false` y no
|
|
100
89
|
* borra el campo: así el cambio también llega a los demás aparatos.
|
|
90
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
101
91
|
*/
|
|
102
|
-
setBlocked({ publickey, blocked }:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}): Promise<any>;
|
|
110
|
-
setRating({ publickey, rating, notes }: {
|
|
111
|
-
publickey: any;
|
|
112
|
-
rating: any;
|
|
113
|
-
notes: any;
|
|
114
|
-
}): Promise<any>;
|
|
115
|
-
mergeEndorsements({ subject, endorsements, askerPubkey }: {
|
|
116
|
-
subject: any;
|
|
117
|
-
endorsements: any;
|
|
118
|
-
askerPubkey: any;
|
|
119
|
-
}): Promise<{
|
|
92
|
+
setBlocked({ publickey, blocked }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
93
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
94
|
+
setNickname({ publickey, nickname }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
95
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
96
|
+
setRating({ publickey, rating, notes }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
97
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
98
|
+
mergeEndorsements({ subject, endorsements, askerPubkey }: HandlerParams): Promise<{
|
|
120
99
|
merged: number;
|
|
121
100
|
total: number;
|
|
122
101
|
}>;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}): Promise<{
|
|
102
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
103
|
+
getRatingsForSubject({ subject }: HandlerParams): Promise<{
|
|
126
104
|
mine: any;
|
|
127
|
-
endorsements: any;
|
|
128
|
-
}>;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
encryptionPubkey: any;
|
|
141
|
-
lastToken: any;
|
|
142
|
-
notes: any;
|
|
143
|
-
}): Promise<any>;
|
|
144
|
-
updateContact({ publickey, patch }: {
|
|
145
|
-
publickey: any;
|
|
146
|
-
patch: any;
|
|
147
|
-
}): Promise<any>;
|
|
148
|
-
removeContact({ publickey }: {
|
|
149
|
-
publickey: any;
|
|
150
|
-
}): Promise<any>;
|
|
105
|
+
endorsements: any[];
|
|
106
|
+
}>;
|
|
107
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
108
|
+
recordQuery({ askerPubkey, subject }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
109
|
+
listPeers(): Promise<import("./peerStore.js").PeerRecord[]>;
|
|
110
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
111
|
+
forgetPeer({ publickey }: HandlerParams): Promise<void>;
|
|
112
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
113
|
+
addContact({ publickey, nickname, encryptionPubkey, lastToken, notes }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
114
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
115
|
+
updateContact({ publickey, patch }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
116
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
117
|
+
removeContact({ publickey }: HandlerParams): Promise<import("./peerStore.js").PeerRecord>;
|
|
151
118
|
/**
|
|
152
119
|
* Firma. Con `sign` en el acta, firma aquí mismo (como siempre). Si este dispositivo
|
|
153
120
|
* RENUNCIÓ a firmar —o el master se lo quitó— la petición se re-enruta a quien sí
|
|
@@ -157,14 +124,13 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
157
124
|
* El `identify` del transporte es la excepción y SIEMPRE se firma en local: es lo que
|
|
158
125
|
* identifica esta conexión ante el proxy, no una firma tuya de cara a nadie, y sin él
|
|
159
126
|
* el dispositivo no podría ni hablar con la bóveda para pedirle que firme.
|
|
127
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
160
128
|
*/
|
|
161
|
-
signData({ data }: {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
profileId: any;
|
|
167
|
-
chain: any[];
|
|
129
|
+
signData({ data }: HandlerParams): Promise<{
|
|
130
|
+
signature: string;
|
|
131
|
+
publickey: string;
|
|
132
|
+
profileId: string;
|
|
133
|
+
chain: Acta.Acta[];
|
|
168
134
|
}>;
|
|
169
135
|
/**
|
|
170
136
|
* UNA PRUEBA PARA ALGUIEN EN CONCRETO, Y POR UN RATO (`vault/assertion.js`).
|
|
@@ -188,18 +154,19 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
188
154
|
* usuario y no un trámite: si no se puede ver ni retirar, conceder no significa nada.
|
|
189
155
|
*/
|
|
190
156
|
listGrants(): Promise<{
|
|
191
|
-
onBehalfOf?:
|
|
157
|
+
onBehalfOf?: string;
|
|
192
158
|
origin: string;
|
|
193
|
-
scopes:
|
|
194
|
-
at:
|
|
195
|
-
lastUsed:
|
|
159
|
+
scopes: string[];
|
|
160
|
+
at: number;
|
|
161
|
+
lastUsed: number;
|
|
196
162
|
}[]>;
|
|
197
163
|
/**
|
|
198
164
|
* Retirar lo concedido a una aplicación. La próxima vez que pida, se vuelve a preguntar.
|
|
199
165
|
* `onBehalfOf` es obligatorio para las que piden por otro (el puente): retirar el permiso
|
|
200
166
|
* de UNA no puede quitárselo a todas las que entran por el mismo sitio.
|
|
167
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
201
168
|
*/
|
|
202
|
-
revokeGrant({ origin, onBehalfOf }?:
|
|
169
|
+
revokeGrant({ origin, onBehalfOf }?: HandlerParams): Promise<{
|
|
203
170
|
ok: boolean;
|
|
204
171
|
}>;
|
|
205
172
|
/**
|
|
@@ -210,21 +177,22 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
210
177
|
* Es una AFIRMACIÓN del origen, no un hecho comprobable — y por eso se enseña siempre
|
|
211
178
|
* subordinado a él («sso.dotrino.com dice: Tal App»), nunca en su lugar. Quien
|
|
212
179
|
* responde por lo que pase sigue siendo el origen.
|
|
180
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
213
181
|
*/
|
|
214
|
-
requestAssertion({ audience, nonce, scopes, ttlMs, onBehalfOf, __origin }?:
|
|
182
|
+
requestAssertion({ audience, nonce, scopes, ttlMs, onBehalfOf, __origin }?: HandlerParams): Promise<{
|
|
215
183
|
assertion: {
|
|
216
|
-
signature:
|
|
217
|
-
publickey:
|
|
218
|
-
chain:
|
|
184
|
+
signature: string;
|
|
185
|
+
publickey: string;
|
|
186
|
+
chain: Acta.Acta[];
|
|
219
187
|
v: number;
|
|
220
188
|
op: string;
|
|
221
189
|
sub: string;
|
|
222
190
|
aud: string;
|
|
223
191
|
nonce: string;
|
|
224
|
-
iat:
|
|
225
|
-
exp:
|
|
226
|
-
scopes:
|
|
227
|
-
claims:
|
|
192
|
+
iat: number;
|
|
193
|
+
exp: number;
|
|
194
|
+
scopes: string[];
|
|
195
|
+
claims: Record<string, unknown>;
|
|
228
196
|
};
|
|
229
197
|
}>;
|
|
230
198
|
/**
|
|
@@ -233,45 +201,29 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
233
201
|
* `ttlMs`/`exp` se aceptan y se IGNORAN a propósito, para no romper a quien todavía los
|
|
234
202
|
* pasa (el daemon, `enroll.js`). Reventar ahí dejaría sin emparejar a media cadena por
|
|
235
203
|
* un parámetro que ya no significa nada.
|
|
204
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
236
205
|
*/
|
|
237
|
-
signDelegation({ sub, scope, nonce, label, supersede }: {
|
|
238
|
-
|
|
239
|
-
scope: any;
|
|
240
|
-
nonce: any;
|
|
241
|
-
label: any;
|
|
242
|
-
supersede: any;
|
|
243
|
-
}): Promise<{
|
|
244
|
-
cert: {
|
|
245
|
-
sig: any;
|
|
246
|
-
v: number;
|
|
247
|
-
iss: any;
|
|
248
|
-
sub: any;
|
|
249
|
-
scope: any;
|
|
250
|
-
iat: any;
|
|
251
|
-
seq: any;
|
|
252
|
-
nonce: any;
|
|
253
|
-
};
|
|
206
|
+
signDelegation({ sub, scope, nonce, label, supersede }: HandlerParams): Promise<{
|
|
207
|
+
cert: import("./capabilities.js").Delegation;
|
|
254
208
|
}>;
|
|
255
209
|
/**
|
|
256
210
|
* Retira TODOS los certificados vigentes de un dispositivo (por su llave `sub`).
|
|
257
211
|
* Es lo que significa «quitar el dispositivo»: revocar por `nonce` retira un papel,
|
|
258
212
|
* no al aparato, que puede tener otros.
|
|
213
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
259
214
|
*/
|
|
260
|
-
revokeDevice({ sub }: {
|
|
261
|
-
sub: any;
|
|
262
|
-
}): Promise<{
|
|
215
|
+
revokeDevice({ sub }: HandlerParams): Promise<{
|
|
263
216
|
ok: boolean;
|
|
264
|
-
seq:
|
|
217
|
+
seq: number;
|
|
265
218
|
nonces: string[];
|
|
266
219
|
rotated: {
|
|
267
|
-
gen:
|
|
268
|
-
sinLlave:
|
|
220
|
+
gen: number;
|
|
221
|
+
sinLlave: Array<string | undefined>;
|
|
269
222
|
};
|
|
270
223
|
revokedAt: number;
|
|
271
224
|
}>;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}): Promise<{
|
|
225
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
226
|
+
revokeDelegation({ nonce }: HandlerParams): Promise<{
|
|
275
227
|
ok: boolean;
|
|
276
228
|
revokedAt: any;
|
|
277
229
|
}>;
|
|
@@ -288,11 +240,31 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
288
240
|
* sin él, la lista caía siempre al identicon automático y tu foto no aparecía —aunque la
|
|
289
241
|
* hubieras subido— porque el avatar vive en el `me` de cada perfil, no en el registro.
|
|
290
242
|
*/
|
|
291
|
-
listProfiles(): Promise<
|
|
243
|
+
listProfiles(): Promise<{
|
|
244
|
+
login?: {
|
|
245
|
+
user: any;
|
|
246
|
+
address: any;
|
|
247
|
+
volatile: boolean;
|
|
248
|
+
};
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
pubkey: string;
|
|
252
|
+
avatar: any;
|
|
253
|
+
current: boolean;
|
|
254
|
+
pendingJoin: boolean;
|
|
255
|
+
vault: boolean;
|
|
256
|
+
approve: boolean;
|
|
257
|
+
vaults: {
|
|
258
|
+
comm: string | null;
|
|
259
|
+
master: string;
|
|
260
|
+
id: string;
|
|
261
|
+
label: string;
|
|
262
|
+
}[];
|
|
263
|
+
}[]>;
|
|
292
264
|
currentProfile(): Promise<{
|
|
293
|
-
id:
|
|
265
|
+
id: string;
|
|
294
266
|
name: any;
|
|
295
|
-
pubkey:
|
|
267
|
+
pubkey: string;
|
|
296
268
|
}>;
|
|
297
269
|
/**
|
|
298
270
|
* Crea una cuenta más en este dispositivo, con su propia llave.
|
|
@@ -300,21 +272,22 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
300
272
|
* `forVault: true` la marca como **nacida para adoptar** la cuenta de una bóveda
|
|
301
273
|
* (camino B): es el único permiso que acepta `joinProfile`, y se consume al unirse.
|
|
302
274
|
* Sin la marca, la cuenta es de este dispositivo y nadie se la puede llevar.
|
|
275
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
303
276
|
*/
|
|
304
|
-
createProfile({ name, forVault }?: {
|
|
305
|
-
forVault?: boolean;
|
|
306
|
-
}): Promise<{
|
|
277
|
+
createProfile({ name, forVault }?: HandlerParams): Promise<{
|
|
307
278
|
id: string;
|
|
308
|
-
name:
|
|
309
|
-
pubkey:
|
|
279
|
+
name: any;
|
|
280
|
+
pubkey: string;
|
|
310
281
|
pendingJoin: boolean;
|
|
311
282
|
}>;
|
|
312
|
-
|
|
283
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
284
|
+
switchProfile({ id }?: HandlerParams): Promise<{
|
|
313
285
|
id: any;
|
|
314
286
|
}>;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
287
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
288
|
+
renameProfile({ id, name }?: HandlerParams): Promise<{
|
|
289
|
+
id: string;
|
|
290
|
+
name: string;
|
|
318
291
|
}>;
|
|
319
292
|
/**
|
|
320
293
|
* BORRAR UNA CUENTA, también la activa y también la única (dueño, 2026-10-05): borrar tu
|
|
@@ -322,11 +295,12 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
322
295
|
* La alerta es de la INTERFAZ, que pregunta antes. Si era la activa, `current` dice cuál
|
|
323
296
|
* queda, y la app tiene que RECARGAR; si no queda ninguna, el arranque estrena una nueva
|
|
324
297
|
* y vacía (ver `purgeProfile`).
|
|
298
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
325
299
|
*/
|
|
326
|
-
deleteProfile({ id }?:
|
|
300
|
+
deleteProfile({ id }?: HandlerParams): Promise<{
|
|
327
301
|
wasCurrent: boolean;
|
|
328
302
|
ok: boolean;
|
|
329
|
-
current:
|
|
303
|
+
current: string;
|
|
330
304
|
}>;
|
|
331
305
|
/**
|
|
332
306
|
* ENTRAR en un aparato de tu cuenta desde un navegador que no te conoce, con
|
|
@@ -340,12 +314,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
340
314
|
*
|
|
341
315
|
* La contraseña NO viaja: lo que viaja son los mensajes de OPAQUE, que no la llevan ni
|
|
342
316
|
* dejan adivinarla (`@dotrino/vault/login-client`).
|
|
317
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
343
318
|
*/
|
|
344
|
-
loginWithPassword({ address, password, remember, label, proxyUrl }?: {
|
|
345
|
-
remember?: boolean;
|
|
346
|
-
label?: string;
|
|
347
|
-
proxyUrl?: any;
|
|
348
|
-
}): Promise<{
|
|
319
|
+
loginWithPassword({ address, password, remember, label, proxyUrl }?: HandlerParams): Promise<{
|
|
349
320
|
id: string;
|
|
350
321
|
name: any;
|
|
351
322
|
address: any;
|
|
@@ -356,18 +327,17 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
356
327
|
/**
|
|
357
328
|
* SALIR del inicio de sesión con contraseña: se le dice a la bóveda que suelte la plaza
|
|
358
329
|
* y la cuenta desaparece de este navegador. Sin `id`, el activo.
|
|
330
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
359
331
|
*/
|
|
360
|
-
logoutLogin({ id }?: {
|
|
361
|
-
id?: any;
|
|
362
|
-
}): Promise<{
|
|
332
|
+
logoutLogin({ id }?: HandlerParams): Promise<{
|
|
363
333
|
ok: boolean;
|
|
364
334
|
told: any;
|
|
365
|
-
current:
|
|
335
|
+
current: string;
|
|
366
336
|
}>;
|
|
367
337
|
profileActa(): Promise<{
|
|
368
|
-
acta:
|
|
369
|
-
isMaster:
|
|
370
|
-
myCaps:
|
|
338
|
+
acta: Acta.Acta;
|
|
339
|
+
isMaster: boolean;
|
|
340
|
+
myCaps: string[];
|
|
371
341
|
}>;
|
|
372
342
|
/**
|
|
373
343
|
* LA CADENA DE SELLADORES, para mandarla junto con una firma.
|
|
@@ -385,7 +355,7 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
385
355
|
* por la llave del perfil: la raíz la ancla esa llave, no el número 1 (`verifySealerChain`).
|
|
386
356
|
* Pasa en las cuentas anteriores a v5, cuyo génesis se podó sin la marca de eslabón.
|
|
387
357
|
*/
|
|
388
|
-
sealerChain(): Promise<
|
|
358
|
+
sealerChain(): Promise<Acta.Acta[]>;
|
|
389
359
|
/**
|
|
390
360
|
* Quien sella sobres de secretos (la bóveda) registra aquí cómo estrenar su LLAVE DE
|
|
391
361
|
* SELLADO: una función que crea el par, se guarda la privada y devuelve la pública. Se
|
|
@@ -393,8 +363,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
393
363
|
*
|
|
394
364
|
* Es opt-in a propósito: una identidad de navegador no sella nada, y un acta sin llave
|
|
395
365
|
* de sellado es perfectamente válida.
|
|
366
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
396
367
|
*/
|
|
397
|
-
setSealKeyProvider({ provider }?:
|
|
368
|
+
setSealKeyProvider({ provider }?: HandlerParams): {
|
|
398
369
|
ok: boolean;
|
|
399
370
|
set: boolean;
|
|
400
371
|
};
|
|
@@ -405,13 +376,14 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
405
376
|
*/
|
|
406
377
|
rotateSealKey(): Promise<{
|
|
407
378
|
ok: boolean;
|
|
408
|
-
seq:
|
|
409
|
-
sealPub:
|
|
379
|
+
seq: number;
|
|
380
|
+
sealPub: string;
|
|
410
381
|
}>;
|
|
411
|
-
/**
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
382
|
+
/**
|
|
383
|
+
* La llave con la que se firmaron los sobres de un acta dada. Para VERIFICARLOS.
|
|
384
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
385
|
+
*/
|
|
386
|
+
sealKeyAt({ seq, vault }?: HandlerParams): string;
|
|
415
387
|
profileMembers(): Promise<{
|
|
416
388
|
members: any[];
|
|
417
389
|
profileId: any;
|
|
@@ -419,11 +391,29 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
419
391
|
sealers: any[];
|
|
420
392
|
updatedAt?: undefined;
|
|
421
393
|
} | {
|
|
422
|
-
members:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
394
|
+
members: {
|
|
395
|
+
pub: string;
|
|
396
|
+
id: string;
|
|
397
|
+
label: string;
|
|
398
|
+
cn: string;
|
|
399
|
+
isService: boolean;
|
|
400
|
+
caps: string[];
|
|
401
|
+
addedAt: number;
|
|
402
|
+
machine: {
|
|
403
|
+
kind: string;
|
|
404
|
+
os: string;
|
|
405
|
+
name: string;
|
|
406
|
+
};
|
|
407
|
+
vault: string;
|
|
408
|
+
isMe: boolean;
|
|
409
|
+
isMaster: boolean;
|
|
410
|
+
encPub: string;
|
|
411
|
+
canSeal: boolean;
|
|
412
|
+
}[];
|
|
413
|
+
profileId: string;
|
|
414
|
+
seq: number;
|
|
415
|
+
sealers: string[];
|
|
416
|
+
updatedAt: number;
|
|
427
417
|
}>;
|
|
428
418
|
myMembership(): Promise<{
|
|
429
419
|
inProfile: boolean;
|
|
@@ -434,13 +424,13 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
434
424
|
id?: undefined;
|
|
435
425
|
} | {
|
|
436
426
|
inProfile: boolean;
|
|
437
|
-
profileId:
|
|
438
|
-
seq:
|
|
439
|
-
isMaster:
|
|
440
|
-
caps:
|
|
427
|
+
profileId: string;
|
|
428
|
+
seq: number;
|
|
429
|
+
isMaster: boolean;
|
|
430
|
+
caps: string[];
|
|
441
431
|
id: string;
|
|
442
432
|
}>;
|
|
443
|
-
isMaster(): Promise<
|
|
433
|
+
isMaster(): Promise<boolean>;
|
|
444
434
|
/**
|
|
445
435
|
* Registra la llave de CIFRADO de un miembro ya admitido (solo el master).
|
|
446
436
|
*
|
|
@@ -448,56 +438,52 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
448
438
|
* estrena pubkey, y su cajón de variables va indexado por la vieja, así que
|
|
449
439
|
* arrancaría sin configuración y sin decirlo. Esto le pone la llave sin moverle
|
|
450
440
|
* nada más.
|
|
441
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
451
442
|
*/
|
|
452
|
-
setMemberEncPub({ pub, encPub }?:
|
|
443
|
+
setMemberEncPub({ pub, encPub }?: HandlerParams): Promise<{
|
|
453
444
|
ok: boolean;
|
|
454
|
-
seq:
|
|
445
|
+
seq: number;
|
|
455
446
|
}>;
|
|
456
447
|
/**
|
|
457
448
|
* Admite un miembro (solo el master). El cert lo emite quien llama, antes o después.
|
|
458
449
|
* `continuity`: si esa identidad ya existía por su cuenta, su puente firmado (F3).
|
|
450
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
459
451
|
*/
|
|
460
|
-
admitMember({ pub, encPub, label, cn, caps, cert, continuity, machine, vault }?: {
|
|
461
|
-
encPub?: any;
|
|
462
|
-
label?: string;
|
|
463
|
-
cn?: any;
|
|
464
|
-
caps?: any;
|
|
465
|
-
cert?: any;
|
|
466
|
-
continuity?: any;
|
|
467
|
-
machine?: any;
|
|
468
|
-
vault?: any;
|
|
469
|
-
}): Promise<{
|
|
452
|
+
admitMember({ pub, encPub, label, cn, caps, cert, continuity, machine, vault }?: HandlerParams): Promise<{
|
|
470
453
|
ok: boolean;
|
|
471
|
-
seq:
|
|
454
|
+
seq: number;
|
|
472
455
|
wrapped: boolean;
|
|
473
456
|
}>;
|
|
474
457
|
/**
|
|
475
458
|
* DE QUÉ BÓVEDA ES una llave de comunicación (`vault`: su maestra). La pone la propia
|
|
476
459
|
* bóveda a la llave que entró antes de existir el campo; sin él, con dos bóvedas en la
|
|
477
460
|
* cuenta no hay forma de escribirle a una sola.
|
|
461
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
478
462
|
*/
|
|
479
|
-
setMemberVault({ pub, vault }?:
|
|
463
|
+
setMemberVault({ pub, vault }?: HandlerParams): Promise<{
|
|
480
464
|
ok: boolean;
|
|
481
|
-
seq:
|
|
465
|
+
seq: number;
|
|
482
466
|
}>;
|
|
483
|
-
|
|
467
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
468
|
+
setCaps({ pub, caps }?: HandlerParams): Promise<{
|
|
484
469
|
ok: boolean;
|
|
485
|
-
seq:
|
|
470
|
+
seq: number;
|
|
486
471
|
}>;
|
|
487
472
|
/**
|
|
488
473
|
* LOS PERMISOS DE VARIOS APARATOS EN UNA SOLA ACTA (dueño, 2026-09-26). Editar tres
|
|
489
474
|
* aparatos eran tres actas y tres avisos; ahora el borrador entero se sella de golpe.
|
|
490
475
|
* `changes`: `[{ pub, caps }]`, cada `caps` la lista COMPLETA de ese aparato.
|
|
491
|
-
* @param {{ changes?: Array<{ pub: string, caps
|
|
476
|
+
* @param {{ changes?: Array<{ pub: string, caps?: string[], cn?: string | null }> }} [args] lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
492
477
|
*/
|
|
493
478
|
setCapsMany({ changes }?: {
|
|
494
479
|
changes?: Array<{
|
|
495
480
|
pub: string;
|
|
496
|
-
caps
|
|
481
|
+
caps?: string[];
|
|
482
|
+
cn?: string | null;
|
|
497
483
|
}>;
|
|
498
484
|
}): Promise<{
|
|
499
485
|
ok: boolean;
|
|
500
|
-
seq:
|
|
486
|
+
seq: number;
|
|
501
487
|
wrapped: number;
|
|
502
488
|
}>;
|
|
503
489
|
/**
|
|
@@ -505,20 +491,22 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
505
491
|
* TAMBIÉN en la delegación: son dos registros distintos —el acta dice quién es del
|
|
506
492
|
* perfil, las delegaciones qué certs se emitieron— y las listas de dispositivos leen
|
|
507
493
|
* la segunda, así que tocar solo una deja el nombre viejo a la vista.
|
|
494
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
508
495
|
*/
|
|
509
|
-
setLabel({ pub, label }?:
|
|
496
|
+
setLabel({ pub, label }?: HandlerParams): Promise<{
|
|
510
497
|
ok: boolean;
|
|
511
|
-
seq:
|
|
498
|
+
seq: number;
|
|
512
499
|
label: string;
|
|
513
500
|
delegations: number;
|
|
514
501
|
}>;
|
|
515
|
-
|
|
502
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
503
|
+
removeMember({ pub }?: HandlerParams): Promise<{
|
|
516
504
|
ok: boolean;
|
|
517
|
-
seq:
|
|
505
|
+
seq: number;
|
|
518
506
|
nonces: string[];
|
|
519
507
|
rotated: {
|
|
520
|
-
gen:
|
|
521
|
-
sinLlave:
|
|
508
|
+
gen: number;
|
|
509
|
+
sinLlave: Array<string | undefined>;
|
|
522
510
|
};
|
|
523
511
|
revokedAt: number;
|
|
524
512
|
}>;
|
|
@@ -533,54 +521,47 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
533
521
|
* poder sellar uno mismo, en el mismo acto— ya no se puede: nadie se quita el sello a
|
|
534
522
|
* sí mismo (dejaría un acta que él firma sin poder firmarla). Si quieres salir, se lo
|
|
535
523
|
* pides al otro cuando ya pueda sellar.
|
|
524
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
536
525
|
*/
|
|
537
|
-
handoverMaster({ to, member }?: {
|
|
538
|
-
member?: any;
|
|
539
|
-
}): Promise<{
|
|
526
|
+
handoverMaster({ to, member }?: HandlerParams): Promise<{
|
|
540
527
|
ok: boolean;
|
|
541
|
-
seq:
|
|
542
|
-
sealers:
|
|
528
|
+
seq: number;
|
|
529
|
+
sealers: string[];
|
|
543
530
|
}>;
|
|
544
531
|
/**
|
|
545
532
|
* RENUNCIA (§2.2): este dispositivo se quita capacidades a sí mismo. No pasa por el
|
|
546
533
|
* master —por eso funciona con la bóveda apagada, que es justo cuando hace falta (te
|
|
547
534
|
* robaron el aparato)— y solo puede QUITAR, así que cualquiera puede honrarla.
|
|
535
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
548
536
|
*/
|
|
549
|
-
renounceCaps({ caps }?:
|
|
537
|
+
renounceCaps({ caps }?: HandlerParams): Promise<{
|
|
550
538
|
ok: boolean;
|
|
551
|
-
record:
|
|
552
|
-
|
|
553
|
-
op: string;
|
|
554
|
-
member: any;
|
|
555
|
-
caps: any[];
|
|
556
|
-
ts: number;
|
|
557
|
-
};
|
|
558
|
-
caps: any;
|
|
539
|
+
record: Acta.RenounceRecord;
|
|
540
|
+
caps: string[];
|
|
559
541
|
}>;
|
|
560
|
-
/**
|
|
561
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Absorbe en el acta una renuncia ajena ya verificada (solo el master).
|
|
544
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
545
|
+
*/
|
|
546
|
+
absorbRenounce({ record }?: HandlerParams): Promise<{
|
|
562
547
|
ok: boolean;
|
|
563
|
-
seq:
|
|
548
|
+
seq: number;
|
|
564
549
|
}>;
|
|
565
550
|
/**
|
|
566
551
|
* La clave de contenido de este perfil, ya abierta con la llave de cifrado de este
|
|
567
552
|
* dispositivo. `null` si todavía no te la han envuelto (o si te expulsaron).
|
|
568
553
|
*/
|
|
569
554
|
contentKey(): Promise<{
|
|
570
|
-
gen:
|
|
555
|
+
gen: number;
|
|
571
556
|
cek: string;
|
|
572
557
|
}>;
|
|
573
558
|
/**
|
|
574
559
|
* Cifra algo con la clave de contenido del perfil. Devuelve el sobre MARCADO
|
|
575
560
|
* `{ t: 'dotrino-cek', gen, iv, ct }` (la marca deja a la bóveda reconocerlo y volver a
|
|
576
561
|
* cerrarlo al rotar). La llave privada de cifrado NUNCA sale de aquí.
|
|
562
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
577
563
|
*/
|
|
578
|
-
sealContent({ plaintext }?:
|
|
579
|
-
gen: any;
|
|
580
|
-
iv: string;
|
|
581
|
-
ct: string;
|
|
582
|
-
t: string;
|
|
583
|
-
}>;
|
|
564
|
+
sealContent({ plaintext }?: HandlerParams): Promise<Content.CekEnvelope>;
|
|
584
565
|
/**
|
|
585
566
|
* Abre un sobre SELLADO A ESTE APARATO: primero la envoltura de la llave —con la
|
|
586
567
|
* privada de cifrado de este dispositivo, que nunca sale de aquí— y con ella el sobre.
|
|
@@ -592,8 +573,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
592
573
|
*
|
|
593
574
|
* Distinto de `openContent`, que usa el llavero del PERFIL (el contenido del usuario);
|
|
594
575
|
* aquí la envoltura viene suelta, del llavero de un cajón de secretos.
|
|
576
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
595
577
|
*/
|
|
596
|
-
openSealedValue({ wrap, envelope }?:
|
|
578
|
+
openSealedValue({ wrap, envelope }?: HandlerParams): Promise<string>;
|
|
597
579
|
/**
|
|
598
580
|
* RE-ENVUELVE para otro miembro una llave que este aparato ya puede abrir.
|
|
599
581
|
*
|
|
@@ -607,23 +589,26 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
607
589
|
* es a alguien que el ACTA —firmada por la maestra— ya reconoce como miembro. La
|
|
608
590
|
* autorización es el acta; esto solo es el sobre.
|
|
609
591
|
*
|
|
610
|
-
* @param {{ wrap
|
|
611
|
-
* pública de cifrado del miembro al que hay que envolvérsela.
|
|
592
|
+
* @param {{ wrap?: any, encPub?: string }} [o] `wrap`: mi envoltura · `encPub`: la
|
|
593
|
+
* pública de cifrado del miembro al que hay que envolvérsela. Llega sin comprobar.
|
|
612
594
|
* @returns {Promise<any>} la envoltura nueva, para que la bóveda la guarde.
|
|
613
595
|
*/
|
|
614
596
|
rewrapFor({ wrap, encPub }?: {
|
|
615
|
-
wrap
|
|
616
|
-
encPub
|
|
597
|
+
wrap?: any;
|
|
598
|
+
encPub?: string;
|
|
617
599
|
}): Promise<any>;
|
|
618
|
-
/**
|
|
619
|
-
|
|
600
|
+
/**
|
|
601
|
+
* Abre un sobre de contenido con el llavero del perfil (todas las generaciones).
|
|
602
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
603
|
+
*/
|
|
604
|
+
openContent({ envelope }?: HandlerParams): Promise<string>;
|
|
620
605
|
/**
|
|
621
606
|
* Rota la clave de contenido: generación nueva envuelta solo a los miembros de ahora.
|
|
622
607
|
* Corta el acceso al contenido FUTURO de quien ya no está; lo que ya leyó, ya lo leyó.
|
|
623
608
|
*/
|
|
624
609
|
rotateContentKey(): Promise<{
|
|
625
|
-
gen:
|
|
626
|
-
sinLlave:
|
|
610
|
+
gen: number;
|
|
611
|
+
sinLlave: string[];
|
|
627
612
|
ok: boolean;
|
|
628
613
|
}>;
|
|
629
614
|
/**
|
|
@@ -644,11 +629,10 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
644
629
|
* conexión de la bóveda con un 1009 y la dejaba muda para TODO el ecosistema, sin un
|
|
645
630
|
* solo log de su lado (2026-08-24: el bot social dejó de publicar y eco se quedó sin un
|
|
646
631
|
* eco que mostrar).
|
|
632
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
647
633
|
*/
|
|
648
|
-
actaHistory({ sinceSeq }?: {
|
|
649
|
-
|
|
650
|
-
}): Promise<{
|
|
651
|
-
chain: any[];
|
|
634
|
+
actaHistory({ sinceSeq }?: HandlerParams): Promise<{
|
|
635
|
+
chain: Acta.Acta[];
|
|
652
636
|
window: number;
|
|
653
637
|
}>;
|
|
654
638
|
/**
|
|
@@ -668,65 +652,71 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
668
652
|
* todos mis dispositivos (perfil, versión y llaves de cifrado). Sin etiquetas, sin
|
|
669
653
|
* permisos, sin certificados: lo demás no es asunto de nadie.
|
|
670
654
|
*/
|
|
671
|
-
profileCard(): Promise<
|
|
655
|
+
profileCard(): Promise<Acta.ProfileCard>;
|
|
672
656
|
/**
|
|
673
657
|
* Guarda la tarjeta de OTRA persona en su ficha de contacto. La primera vez se acepta
|
|
674
658
|
* (es el mismo criterio con el que agregaste el contacto); después solo si no retrocede
|
|
675
659
|
* y la firmó el mismo master. Si el master cambió, se avisa en vez de aceptarlo callando.
|
|
660
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
676
661
|
*/
|
|
677
|
-
adoptPeerCard({ card }?:
|
|
662
|
+
adoptPeerCard({ card }?: HandlerParams): Promise<{
|
|
678
663
|
adopted: boolean;
|
|
679
664
|
reason: string;
|
|
680
665
|
devices: any;
|
|
681
666
|
}>;
|
|
682
|
-
/**
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
seq: any;
|
|
688
|
-
} | {
|
|
689
|
-
adopted: boolean;
|
|
690
|
-
reason: any;
|
|
691
|
-
seq: any;
|
|
692
|
-
expelled?: undefined;
|
|
693
|
-
}>;
|
|
694
|
-
/** Adopta una cadena completa (para ponerse al día tras estar apagado). */
|
|
695
|
-
adoptActaChain({ chain }?: {}): Promise<{
|
|
667
|
+
/**
|
|
668
|
+
* Adopta un acta que llega de otro miembro (gana el seq mayor; a igual seq, el traspaso).
|
|
669
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
670
|
+
*/
|
|
671
|
+
adoptActa({ acta }?: HandlerParams): Promise<{
|
|
696
672
|
adopted: boolean;
|
|
697
673
|
expelled: boolean;
|
|
698
|
-
reason:
|
|
699
|
-
seq:
|
|
674
|
+
reason: string;
|
|
675
|
+
seq: number;
|
|
700
676
|
} | {
|
|
701
677
|
adopted: boolean;
|
|
702
|
-
reason:
|
|
703
|
-
seq:
|
|
704
|
-
expelled?: undefined;
|
|
678
|
+
reason: string;
|
|
679
|
+
seq: number;
|
|
705
680
|
}>;
|
|
706
|
-
/**
|
|
707
|
-
|
|
681
|
+
/**
|
|
682
|
+
* Adopta una cadena completa (para ponerse al día tras estar apagado).
|
|
683
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
684
|
+
*/
|
|
685
|
+
adoptActaChain({ chain }?: HandlerParams): Promise<any>;
|
|
686
|
+
/**
|
|
687
|
+
* Se pone al día por la cadena de selladoras (`adoptSealerChainNow`).
|
|
688
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
689
|
+
*/
|
|
690
|
+
adoptActaBySealerChain({ sealerChain }?: HandlerParams): Promise<{
|
|
708
691
|
adopted: boolean;
|
|
709
692
|
expelled: boolean;
|
|
710
|
-
reason:
|
|
711
|
-
seq:
|
|
693
|
+
reason: string;
|
|
694
|
+
seq: number;
|
|
712
695
|
} | {
|
|
713
696
|
adopted: boolean;
|
|
714
|
-
reason:
|
|
715
|
-
seq:
|
|
697
|
+
reason: string;
|
|
698
|
+
seq: number;
|
|
716
699
|
expelled?: undefined;
|
|
717
700
|
}>;
|
|
718
|
-
/**
|
|
719
|
-
|
|
701
|
+
/**
|
|
702
|
+
* Completa el historial con las actas que falten detrás de la vigente (`fillHistoryNow`).
|
|
703
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
704
|
+
*/
|
|
705
|
+
fillActaHistory({ actas }?: HandlerParams): Promise<{
|
|
720
706
|
added: number;
|
|
721
707
|
}>;
|
|
722
|
-
/**
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
708
|
+
/**
|
|
709
|
+
* Las últimas actas que guardo, con la vigente: lo que otra bóveda necesita para rellenar.
|
|
710
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
711
|
+
*/
|
|
712
|
+
recentActas({ count }?: HandlerParams): Promise<{
|
|
713
|
+
actas: Acta.Acta[];
|
|
727
714
|
}>;
|
|
728
|
-
/**
|
|
729
|
-
|
|
715
|
+
/**
|
|
716
|
+
* Une este dispositivo al perfil de otra bóveda (solo si aquí no hay nada que perder).
|
|
717
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
718
|
+
*/
|
|
719
|
+
joinProfile({ acta }?: HandlerParams): Promise<{
|
|
730
720
|
joined: boolean;
|
|
731
721
|
reason: string;
|
|
732
722
|
profileId?: undefined;
|
|
@@ -734,16 +724,16 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
734
724
|
members?: undefined;
|
|
735
725
|
} | {
|
|
736
726
|
joined: boolean;
|
|
737
|
-
reason:
|
|
727
|
+
reason: string;
|
|
738
728
|
profileId: any;
|
|
739
|
-
seq:
|
|
729
|
+
seq: number;
|
|
740
730
|
members?: undefined;
|
|
741
731
|
} | {
|
|
742
732
|
joined: boolean;
|
|
743
733
|
reason: string;
|
|
744
|
-
profileId:
|
|
745
|
-
seq:
|
|
746
|
-
members:
|
|
734
|
+
profileId: string;
|
|
735
|
+
seq: number;
|
|
736
|
+
members: number;
|
|
747
737
|
} | {
|
|
748
738
|
joined: boolean;
|
|
749
739
|
profileId: any;
|
|
@@ -772,18 +762,12 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
772
762
|
* `profileId`); lo que cambia es quién sella. Solo puede hacerlo el
|
|
773
763
|
* master: si esta cuenta ya la manda otra bóveda, no hay nada que
|
|
774
764
|
* regalar y falla en voz alta.
|
|
765
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
775
766
|
*/
|
|
776
|
-
vaultPair({ qr, label, join, machine, account, requireCaps }: {
|
|
777
|
-
qr: any;
|
|
778
|
-
label?: string;
|
|
779
|
-
join?: string;
|
|
780
|
-
machine?: any;
|
|
781
|
-
account?: any;
|
|
782
|
-
requireCaps?: any;
|
|
783
|
-
}): Promise<{
|
|
767
|
+
vaultPair({ qr, label, join, machine, account, requireCaps }: HandlerParams): Promise<{
|
|
784
768
|
ok: boolean;
|
|
785
769
|
adopted: boolean;
|
|
786
|
-
profileId:
|
|
770
|
+
profileId: string;
|
|
787
771
|
seq: any;
|
|
788
772
|
master: string;
|
|
789
773
|
deviceId: string;
|
|
@@ -801,16 +785,16 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
801
785
|
members?: undefined;
|
|
802
786
|
} | {
|
|
803
787
|
joined: boolean;
|
|
804
|
-
reason:
|
|
788
|
+
reason: string;
|
|
805
789
|
profileId: any;
|
|
806
|
-
seq:
|
|
790
|
+
seq: number;
|
|
807
791
|
members?: undefined;
|
|
808
792
|
} | {
|
|
809
793
|
joined: boolean;
|
|
810
794
|
reason: string;
|
|
811
|
-
profileId:
|
|
812
|
-
seq:
|
|
813
|
-
members:
|
|
795
|
+
profileId: string;
|
|
796
|
+
seq: number;
|
|
797
|
+
members: number;
|
|
814
798
|
} | {
|
|
815
799
|
joined: boolean;
|
|
816
800
|
profileId: any;
|
|
@@ -832,14 +816,12 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
832
816
|
* Requisito (§2 del doc): solo puede hacerlo el master. Si esta cuenta ya la manda otra
|
|
833
817
|
* bóveda, este aparato no puede regalar lo que no tiene; el traspaso se hace desde la
|
|
834
818
|
* que manda hoy.
|
|
819
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
835
820
|
*/
|
|
836
|
-
vaultAdopt({ qr, label, machine }?: {
|
|
837
|
-
label?: string;
|
|
838
|
-
machine?: any;
|
|
839
|
-
}): Promise<{
|
|
821
|
+
vaultAdopt({ qr, label, machine }?: HandlerParams): Promise<{
|
|
840
822
|
ok: boolean;
|
|
841
823
|
adopted: boolean;
|
|
842
|
-
profileId:
|
|
824
|
+
profileId: string;
|
|
843
825
|
seq: any;
|
|
844
826
|
master: string;
|
|
845
827
|
deviceId: string;
|
|
@@ -856,9 +838,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
856
838
|
}>;
|
|
857
839
|
/**
|
|
858
840
|
* La página dice dónde corre (`machine.js`); se manda con los pedidos a la bóveda.
|
|
859
|
-
* @param {
|
|
841
|
+
* @param {HandlerParams} [args] lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
860
842
|
*/
|
|
861
|
-
setMachine({ machine }?:
|
|
843
|
+
setMachine({ machine }?: HandlerParams): Promise<{
|
|
862
844
|
ok: boolean;
|
|
863
845
|
}>;
|
|
864
846
|
vaultStatus(): Promise<{
|
|
@@ -871,19 +853,18 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
871
853
|
pairedAt?: undefined;
|
|
872
854
|
} | {
|
|
873
855
|
paired: boolean;
|
|
874
|
-
deviceId:
|
|
875
|
-
master:
|
|
876
|
-
proxy:
|
|
856
|
+
deviceId: string;
|
|
857
|
+
master: string;
|
|
858
|
+
proxy: string;
|
|
877
859
|
scope: any;
|
|
878
860
|
seq: any;
|
|
879
|
-
pairedAt:
|
|
861
|
+
pairedAt: number;
|
|
880
862
|
}>;
|
|
881
863
|
vaultUnpair(): Promise<{
|
|
882
864
|
ok: boolean;
|
|
883
865
|
}>;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}): Promise<{
|
|
866
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
867
|
+
vaultSign({ payload }: HandlerParams): Promise<{
|
|
887
868
|
signature: string;
|
|
888
869
|
publickey: string;
|
|
889
870
|
}>;
|
|
@@ -897,12 +878,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
897
878
|
* envuelto la clave. Ahora falla con `no-content-key`, que se arregla entrando al
|
|
898
879
|
* perfil desde un aparato que ya la tenga — y se ve, en vez de viajar a la vista.
|
|
899
880
|
* Por lo mismo, una respuesta sin cifrar tampoco se acepta.
|
|
881
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
900
882
|
*/
|
|
901
|
-
vaultStore({ method, args, wake }:
|
|
902
|
-
method: any;
|
|
903
|
-
args: any;
|
|
904
|
-
wake?: boolean;
|
|
905
|
-
}): Promise<any>;
|
|
883
|
+
vaultStore({ method, args, wake }: HandlerParams): Promise<any>;
|
|
906
884
|
/**
|
|
907
885
|
* CONSOLA REMOTA: administrar el perfil desde este dispositivo (ver
|
|
908
886
|
* `dotrino-vault/docs/consola-remota.md`). Requiere que el cert de este aparato
|
|
@@ -912,10 +890,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
912
890
|
* `op`: `pending` · `pair` · `approve` · `reject` · `revoke` · `audit`. Cambiar
|
|
913
891
|
* permisos y traspasar el mando NO están, y no es un olvido: eso sigue siendo del
|
|
914
892
|
* master, en su máquina.
|
|
893
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
915
894
|
*/
|
|
916
|
-
vaultAdmin({ op, to, ...rest }?:
|
|
917
|
-
to?: any;
|
|
918
|
-
}): Promise<any>;
|
|
895
|
+
vaultAdmin({ op, to, ...rest }?: HandlerParams): Promise<any>;
|
|
919
896
|
/**
|
|
920
897
|
* PEDIDOS DE APROBACIÓN: lo que le toca al teléfono cuando un cajón de la bóveda exige
|
|
921
898
|
* el visto bueno por uso. `op`: `approvals` (listar) · `approve` · `deny` (con `id`).
|
|
@@ -923,10 +900,9 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
923
900
|
*
|
|
924
901
|
* `profile` apunta a OTRA cuenta de este mismo dispositivo (ver `vaultApprovalsAll`):
|
|
925
902
|
* sin él es la activa, como siempre.
|
|
903
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
926
904
|
*/
|
|
927
|
-
vaultApprovals({ op, id, profile, notify }?:
|
|
928
|
-
profile?: any;
|
|
929
|
-
}): Promise<any>;
|
|
905
|
+
vaultApprovals({ op, id, profile, notify }?: HandlerParams): Promise<any>;
|
|
930
906
|
/**
|
|
931
907
|
* LOS PEDIDOS DE TODAS TUS CUENTAS, SIN CAMBIARTE DE CUENTA.
|
|
932
908
|
*
|
|
@@ -946,25 +922,26 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
946
922
|
* (eso escribe, y escribir en otra cuenta desde la pantalla de otra es pedir un lío).
|
|
947
923
|
* Mirar es de solo lectura; si el papel de una cuenta está desfasado, se dice y punto.
|
|
948
924
|
*
|
|
949
|
-
* @
|
|
925
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
926
|
+
* @returns {Promise<Array<{ profile: string, name: string, current: boolean, items: any[], error?: string }>>} una entrada por cuenta que
|
|
950
927
|
* aprueba — con sus pedidos, o con el motivo por el que no se pudo preguntar.
|
|
951
928
|
*/
|
|
952
|
-
vaultApprovalsAll({ notify }?:
|
|
953
|
-
profile:
|
|
954
|
-
name:
|
|
955
|
-
|
|
956
|
-
|
|
929
|
+
vaultApprovalsAll({ notify }?: HandlerParams): Promise<Array<{
|
|
930
|
+
profile: string;
|
|
931
|
+
name: string;
|
|
932
|
+
current: boolean;
|
|
933
|
+
items: any[];
|
|
934
|
+
error?: string;
|
|
957
935
|
}>>;
|
|
958
936
|
/**
|
|
959
937
|
* PUSH DE LA APP NATIVA: registra el token (FCM/APNs) de este aparato en el proxio,
|
|
960
938
|
* bajo la llave del dispositivo, para que la bóveda pueda «timbrarlo» cuando haya
|
|
961
939
|
* un pedido. La app nativa le pasa el token a la página; la página lo trae aquí.
|
|
940
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
962
941
|
*/
|
|
963
|
-
registerPush({ kind, token }?: {
|
|
964
|
-
kind?: string;
|
|
965
|
-
}): Promise<{
|
|
942
|
+
registerPush({ kind, token }?: HandlerParams): Promise<{
|
|
966
943
|
ok: boolean;
|
|
967
|
-
kind:
|
|
944
|
+
kind: any;
|
|
968
945
|
}>;
|
|
969
946
|
/** ¿Puede ESTE dispositivo aprobar pedidos? Mismo criterio que `canAdminVault`. */
|
|
970
947
|
canApproveVault(): Promise<any>;
|
|
@@ -979,11 +956,10 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
979
956
|
* administra. Sin él contesta la que emitió mi papel. Antes la lista iba siempre a esa,
|
|
980
957
|
* aunque la consola administrara la otra: la cabecera era de la Nube y los aparatos, sus
|
|
981
958
|
* papeles y sus versiones eran del PC (2026-10-27: «parece que mezcla cosas»).
|
|
959
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
982
960
|
*/
|
|
983
|
-
listVaultDevices({ to }?: {
|
|
984
|
-
|
|
985
|
-
}): Promise<{
|
|
986
|
-
acta: any;
|
|
961
|
+
listVaultDevices({ to }?: HandlerParams): Promise<{
|
|
962
|
+
acta: Acta.Acta;
|
|
987
963
|
devices: any;
|
|
988
964
|
siblingCerts: any;
|
|
989
965
|
revoked: any;
|
|
@@ -998,19 +974,19 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
998
974
|
*/
|
|
999
975
|
getVaultCert(): Promise<{
|
|
1000
976
|
cert: any;
|
|
1001
|
-
master:
|
|
1002
|
-
acta:
|
|
977
|
+
master: string;
|
|
978
|
+
acta: Acta.Acta;
|
|
1003
979
|
}>;
|
|
1004
|
-
listContacts(): Promise<
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
me: any;
|
|
980
|
+
listContacts(): Promise<import("./peerStore.js").PeerRecord[]>;
|
|
981
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
982
|
+
setMyNickname({ nickname }: HandlerParams): Promise<{
|
|
983
|
+
me: Record<string, any>;
|
|
1009
984
|
}>;
|
|
1010
|
-
|
|
1011
|
-
|
|
985
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
986
|
+
updateMe({ patch }?: HandlerParams): Promise<{
|
|
987
|
+
me: Record<string, any>;
|
|
1012
988
|
}>;
|
|
1013
|
-
getMe(): Promise<any
|
|
989
|
+
getMe(): Promise<Record<string, any>>;
|
|
1014
990
|
/**
|
|
1015
991
|
* CÓMO FUE EL ÚLTIMO EMPUJÓN del perfil a la bóveda. Existe para que la interfaz pueda
|
|
1016
992
|
* decir «esto no se guardó» en vez de enseñar tan tranquila un perfil que solo vive en
|
|
@@ -1018,15 +994,12 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1018
994
|
* `{ ok, at, error }`.
|
|
1019
995
|
*/
|
|
1020
996
|
profilePushState(): Promise<{
|
|
1021
|
-
ok:
|
|
997
|
+
ok: boolean | null;
|
|
1022
998
|
at: number;
|
|
1023
|
-
error:
|
|
1024
|
-
}>;
|
|
1025
|
-
publicMe(): Promise<{
|
|
1026
|
-
publickey: any;
|
|
1027
|
-
encryptionPubkey: any;
|
|
999
|
+
error: string | null;
|
|
1028
1000
|
}>;
|
|
1029
|
-
|
|
1001
|
+
publicMe(): Promise<Record<string, any>>;
|
|
1002
|
+
getEncryptionPubkey(): Promise<string>;
|
|
1030
1003
|
/**
|
|
1031
1004
|
* Cifra para uno o varios destinatarios. Dos cosas que cambian respecto de antes:
|
|
1032
1005
|
*
|
|
@@ -1035,25 +1008,23 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1035
1008
|
* puede abrirla también un dispositivo que no estaba conectado cuando se envió.
|
|
1036
1009
|
* 2. **Se cifra a TODOS los dispositivos de esa persona**, si conocemos su tarjeta de
|
|
1037
1010
|
* perfil (§tarjeta). Le escribes a la persona, no al aparato desde el que te habló.
|
|
1011
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
1038
1012
|
*/
|
|
1039
|
-
encrypt({ recipients, plaintext }: {
|
|
1040
|
-
recipients: any;
|
|
1041
|
-
plaintext: any;
|
|
1042
|
-
}): Promise<{
|
|
1013
|
+
encrypt({ recipients, plaintext }: HandlerParams): Promise<{
|
|
1043
1014
|
v: number;
|
|
1044
1015
|
iv: string;
|
|
1045
1016
|
ct: string;
|
|
1046
|
-
wrap: {
|
|
1017
|
+
wrap: Record<string, {
|
|
1018
|
+
iv: string;
|
|
1019
|
+
ct: string;
|
|
1020
|
+
}>;
|
|
1047
1021
|
}>;
|
|
1048
1022
|
/**
|
|
1049
1023
|
* Descifra. Busca MI envoltura por el id de mi llave de cifrado (v2); `myToken` ya no
|
|
1050
1024
|
* hace falta y se acepta solo por compatibilidad de llamada.
|
|
1025
|
+
* @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía
|
|
1051
1026
|
*/
|
|
1052
|
-
decrypt({ senderEncryptionPubkey, myToken, envelope }: {
|
|
1053
|
-
senderEncryptionPubkey: any;
|
|
1054
|
-
myToken: any;
|
|
1055
|
-
envelope: any;
|
|
1056
|
-
}): Promise<{
|
|
1027
|
+
decrypt({ senderEncryptionPubkey, myToken, envelope }: HandlerParams): Promise<{
|
|
1057
1028
|
plaintext: string;
|
|
1058
1029
|
}>;
|
|
1059
1030
|
exportIdentity(): Promise<{
|
|
@@ -1062,32 +1033,24 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1062
1033
|
publicJwk: any;
|
|
1063
1034
|
encPrivateJwk: any;
|
|
1064
1035
|
encPublicJwk: any;
|
|
1065
|
-
me: any
|
|
1066
|
-
peers:
|
|
1036
|
+
me: Record<string, any>;
|
|
1037
|
+
peers: import("./peerStore.js").PeerBook;
|
|
1067
1038
|
exportedAt: string;
|
|
1068
1039
|
}>;
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}): Promise<any>;
|
|
1040
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
1041
|
+
syncConnect({ clientId }: HandlerParams): Promise<any>;
|
|
1072
1042
|
syncDisconnect(): Promise<any>;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}): Promise<any>;
|
|
1043
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
1044
|
+
syncUnlock({ passphrase }: HandlerParams): Promise<any>;
|
|
1076
1045
|
syncLock(): Promise<any>;
|
|
1077
1046
|
syncStatus(): Promise<any>;
|
|
1078
1047
|
syncNow(): Promise<any>;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
publicJwk: any;
|
|
1082
|
-
encPrivateJwk: any;
|
|
1083
|
-
encPublicJwk: any;
|
|
1084
|
-
me: any;
|
|
1085
|
-
peers: any;
|
|
1086
|
-
}): Promise<{
|
|
1048
|
+
/** @param {HandlerParams} params lo que llega por `postMessage` o la API: sin comprobar todavía */
|
|
1049
|
+
importIdentity({ privateJwk, publicJwk, encPrivateJwk, encPublicJwk, me: meIn, peers: peersIn }: HandlerParams): Promise<{
|
|
1087
1050
|
me: any;
|
|
1088
1051
|
}>;
|
|
1089
1052
|
};
|
|
1090
|
-
readonly me: any
|
|
1053
|
+
readonly me: Record<string, any>;
|
|
1091
1054
|
/** ¿Está la maestra bajo llave? Cerrada, esta identidad NO puede firmar nada. */
|
|
1092
1055
|
readonly masterLocked: boolean;
|
|
1093
1056
|
/** Echa el candado a la maestra que ya existía (al abrir el perfil). Idempotente. */
|
|
@@ -1110,16 +1073,16 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1110
1073
|
/** Quita del acta, en una sola, los aparatos cuyo papel ya no tiene vuelta atrás. */
|
|
1111
1074
|
pruneExpiredDevices: (now?: number) => Promise<{
|
|
1112
1075
|
removed: {
|
|
1113
|
-
pub:
|
|
1076
|
+
pub: string;
|
|
1114
1077
|
label: any;
|
|
1115
1078
|
}[];
|
|
1116
|
-
seq:
|
|
1079
|
+
seq: number;
|
|
1117
1080
|
}>;
|
|
1118
1081
|
/** Al abrir: nombra mi llave de cifrado y envuelve la clave de contenido a quien le falte. */
|
|
1119
1082
|
completeKeyring: () => Promise<{
|
|
1120
1083
|
named: boolean;
|
|
1121
|
-
wrapped:
|
|
1122
|
-
seq:
|
|
1084
|
+
wrapped: string[];
|
|
1085
|
+
seq: number;
|
|
1123
1086
|
}>;
|
|
1124
1087
|
/** Recarga el par tras abrir el candado, sin reabrir la identidad entera. */
|
|
1125
1088
|
reloadMasterKey(): Promise<{
|
|
@@ -1132,7 +1095,10 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1132
1095
|
* segunda mitad —instalar lo que salió de ahí—, y vive en el objeto del núcleo (no en
|
|
1133
1096
|
* `handlers`) porque ninguna aplicación tiene por qué poder instalar una identidad.
|
|
1134
1097
|
*/
|
|
1135
|
-
adoptLogin: (entrada:
|
|
1098
|
+
adoptLogin: (entrada: any, { remember, proxy }?: {
|
|
1099
|
+
remember?: boolean;
|
|
1100
|
+
proxy?: string | null;
|
|
1101
|
+
}) => Promise<{
|
|
1136
1102
|
id: string;
|
|
1137
1103
|
name: any;
|
|
1138
1104
|
address: any;
|
|
@@ -1146,10 +1112,89 @@ export function createIdentityCore({ kv: hostKv, peers, makeSync, keyStore: host
|
|
|
1146
1112
|
* pararse (ver `adminLink`). En el núcleo y no en `handlers`: ninguna
|
|
1147
1113
|
* aplicación tiene por qué poder decir dónde está la bóveda de esta cuenta.
|
|
1148
1114
|
*/
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1115
|
+
/** @param {{ cert: any, proxy: string, open: (onReply: (reply: any) => void) => { send (payload: any): void, close (): void } } | null} [self] */
|
|
1116
|
+
setSelfVault(self?: {
|
|
1117
|
+
cert: any;
|
|
1118
|
+
proxy: string;
|
|
1119
|
+
open: (onReply: (reply: any) => void) => {
|
|
1120
|
+
send(payload: any): void;
|
|
1121
|
+
close(): void;
|
|
1122
|
+
};
|
|
1123
|
+
} | null): void;
|
|
1124
|
+
/** @param {(status: any) => void} fn */
|
|
1125
|
+
onSyncStatus(fn: (status: any) => void): void;
|
|
1126
|
+
/** @param {(payload: any) => void} fn */
|
|
1127
|
+
onVaultEvent(fn: (payload: any) => void): () => boolean;
|
|
1152
1128
|
}>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Almacén clave → texto, síncrono (localStorage, o lo que lo imite en Node y en la app).
|
|
1131
|
+
* @typedef {{ getItem (k: string): string | null, setItem (k: string, v: string): void, removeItem (k: string): void }} Kv
|
|
1132
|
+
*/
|
|
1133
|
+
/**
|
|
1134
|
+
* Una llave que firma o deriva: una CryptoKey, o un asa de una llave que vive fuera (el chip).
|
|
1135
|
+
* @typedef {import('./capabilities.js').SigningKey | { external: true, kid?: string, sign: (bytes: Uint8Array) => Promise<string>, deriveBits?: (peerPubJwkStr: string) => Promise<ArrayBuffer>, paired?: (account: any) => Promise<any> }} PrivateKeyLike
|
|
1136
|
+
*/
|
|
1137
|
+
/**
|
|
1138
|
+
* Lo que se guarda de un par en el almacén de llaves.
|
|
1139
|
+
* @typedef {{ privateKey: PrivateKeyLike, publicJwk: JsonWebKey }} StoredPair
|
|
1140
|
+
*/
|
|
1141
|
+
/**
|
|
1142
|
+
* Dónde viven las llaves privadas: IndexedDB en el navegador (CryptoKey no extraíble), o el
|
|
1143
|
+
* chip del teléfono (`externalKeys.js`), que además sabe crearlas e importarlas.
|
|
1144
|
+
* @typedef {object} KeyStore
|
|
1145
|
+
* @property {(name: string) => Promise<any>} get
|
|
1146
|
+
* @property {(name: string, rec: any) => Promise<void>} set
|
|
1147
|
+
* @property {(name: string) => Promise<void>} remove
|
|
1148
|
+
* @property {(kind: 'sign' | 'enc', name: string) => Promise<StoredPair>} [create]
|
|
1149
|
+
* @property {(pair: { sign: { name: string, privateJwk: JsonWebKey, publickey: string }, enc: { name: string, privateJwk: JsonWebKey | null, publickey: string | null } }) => Promise<void>} [importPair]
|
|
1150
|
+
*/
|
|
1151
|
+
/**
|
|
1152
|
+
* El libro de contactos que usa el núcleo: la interfaz de `vault/peerStore.js`.
|
|
1153
|
+
* @typedef {{ initPeerStorage (): Promise<import('./peerStore.js').PeerBook>,
|
|
1154
|
+
* loadPeers (): import('./peerStore.js').PeerBook, savePeers (p: import('./peerStore.js').PeerBook): void,
|
|
1155
|
+
* setPeersDirect (p: import('./peerStore.js').PeerBook): void,
|
|
1156
|
+
* upsertPeer (publickey: string, patch: Record<string, any>): import('./peerStore.js').PeerRecord,
|
|
1157
|
+
* onDirty (fn: (() => void) | null): void,
|
|
1158
|
+
* setProfile? (pid: string | null, opts?: { volatile?: boolean }): void | Promise<void>,
|
|
1159
|
+
* adoptLegacy? (pid: string): void | Promise<void> }} CorePeers
|
|
1160
|
+
*/
|
|
1161
|
+
/**
|
|
1162
|
+
* El candado de la maestra: sella y abre con la llave que sale de la contraseña del perfil.
|
|
1163
|
+
* Cerrado, `open` devuelve `null`.
|
|
1164
|
+
* @typedef {{ seal? (plaintext: string): Promise<any>, open? (sealed: any): Promise<string | null> }} KeyLock
|
|
1165
|
+
*/
|
|
1166
|
+
/**
|
|
1167
|
+
* Lo que el núcleo necesita de quien lo monta (el iframe, Node o la app).
|
|
1168
|
+
* @typedef {object} CoreDeps
|
|
1169
|
+
* @property {Kv} kv almacén síncrono estilo localStorage (keypairs, me, nonces)
|
|
1170
|
+
* @property {CorePeers} peers el libro de contactos
|
|
1171
|
+
* @property {((cfg: { fileName: string, kind: string, exportLocal: () => Promise<any>, applyMerged: (merged: any) => Promise<void>, mergeFn: (local: any, remote: any) => Promise<{ merged: any, changed: boolean }> }) => any) | null} [makeSync]
|
|
1172
|
+
* fábrica del respaldo en Drive (`createSync`); sin ella, los `sync*` lanzan
|
|
1173
|
+
* @property {KeyStore | null} [keyStore] dónde viven las llaves privadas; sin él, JWK en `kv`
|
|
1174
|
+
* @property {Kv | null} [sessionKv] lo de esta pestaña (`sessionStorage`)
|
|
1175
|
+
* @property {boolean} [removeAccountOnExpulsion]
|
|
1176
|
+
* @property {KeyLock | null} [keyLock]
|
|
1177
|
+
* @property {((q: { origin: string, scopes: string[], already: string[], onBehalfOf: string | null }) => Promise<boolean> | boolean) | null} [askConsent]
|
|
1178
|
+
*/
|
|
1179
|
+
/**
|
|
1180
|
+
* Un perfil de la lista de este aparato.
|
|
1181
|
+
* @typedef {{ id: string, name?: string, pubkey?: string | null, pendingJoin?: boolean } & Record<string, any>} ProfileEntry
|
|
1182
|
+
*/
|
|
1183
|
+
/**
|
|
1184
|
+
* Un par cargado: la privada (CryptoKey o el asa del chip; `null` con el candado echado) y la pública.
|
|
1185
|
+
* @typedef {{ privateKey: any, publicKey: CryptoKey, publicJwk: JsonWebKey, locked?: boolean }} LoadedPair
|
|
1186
|
+
*/
|
|
1187
|
+
/**
|
|
1188
|
+
* El emparejamiento guardado con la bóveda: su papel, a quién y por dónde.
|
|
1189
|
+
* @typedef {{ cert: any, master: string, proxy: string, deviceId?: string, pairedAt?: number, account?: string } & Record<string, any>} VaultLink
|
|
1190
|
+
*/
|
|
1191
|
+
/** @typedef {import('./remote.js').DeviceKey} DeviceKey */
|
|
1192
|
+
/** @typedef {import('./acta.js').Acta} Acta */
|
|
1193
|
+
/**
|
|
1194
|
+
* Los parámetros de un manejador: llegan por `postMessage` (de cualquier aplicación) o por la
|
|
1195
|
+
* API de Node, sin comprobar. Cada manejador valida lo que usa.
|
|
1196
|
+
* @typedef {Record<string, any>} HandlerParams
|
|
1197
|
+
*/
|
|
1153
1198
|
export const KEY_STORAGE: "dotrino.identity.keypair";
|
|
1154
1199
|
export const ENC_KEY_STORAGE: "dotrino.identity.enc-keypair";
|
|
1155
1200
|
export const ME_STORAGE: "dotrino.identity.me";
|
|
@@ -1166,3 +1211,153 @@ export const GRANTS_STORAGE: "dotrino.identity.grants";
|
|
|
1166
1211
|
export const LOGIN_STORAGE: "dotrino.identity.login";
|
|
1167
1212
|
export const PROFILES_STORAGE: "dotrino.identity.profiles";
|
|
1168
1213
|
export const CURRENT_STORAGE: "dotrino.identity.current";
|
|
1214
|
+
/**
|
|
1215
|
+
* Almacén clave → texto, síncrono (localStorage, o lo que lo imite en Node y en la app).
|
|
1216
|
+
*/
|
|
1217
|
+
export type Kv = {
|
|
1218
|
+
getItem(k: string): string | null;
|
|
1219
|
+
setItem(k: string, v: string): void;
|
|
1220
|
+
removeItem(k: string): void;
|
|
1221
|
+
};
|
|
1222
|
+
/**
|
|
1223
|
+
* Una llave que firma o deriva: una CryptoKey, o un asa de una llave que vive fuera (el chip).
|
|
1224
|
+
*/
|
|
1225
|
+
export type PrivateKeyLike = import("./capabilities.js").SigningKey | {
|
|
1226
|
+
external: true;
|
|
1227
|
+
kid?: string;
|
|
1228
|
+
sign: (bytes: Uint8Array) => Promise<string>;
|
|
1229
|
+
deriveBits?: (peerPubJwkStr: string) => Promise<ArrayBuffer>;
|
|
1230
|
+
paired?: (account: any) => Promise<any>;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Lo que se guarda de un par en el almacén de llaves.
|
|
1234
|
+
*/
|
|
1235
|
+
export type StoredPair = {
|
|
1236
|
+
privateKey: PrivateKeyLike;
|
|
1237
|
+
publicJwk: JsonWebKey;
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* Dónde viven las llaves privadas: IndexedDB en el navegador (CryptoKey no extraíble), o el
|
|
1241
|
+
* chip del teléfono (`externalKeys.js`), que además sabe crearlas e importarlas.
|
|
1242
|
+
*/
|
|
1243
|
+
export type KeyStore = {
|
|
1244
|
+
get: (name: string) => Promise<any>;
|
|
1245
|
+
set: (name: string, rec: any) => Promise<void>;
|
|
1246
|
+
remove: (name: string) => Promise<void>;
|
|
1247
|
+
create?: (kind: "sign" | "enc", name: string) => Promise<StoredPair>;
|
|
1248
|
+
importPair?: (pair: {
|
|
1249
|
+
sign: {
|
|
1250
|
+
name: string;
|
|
1251
|
+
privateJwk: JsonWebKey;
|
|
1252
|
+
publickey: string;
|
|
1253
|
+
};
|
|
1254
|
+
enc: {
|
|
1255
|
+
name: string;
|
|
1256
|
+
privateJwk: JsonWebKey | null;
|
|
1257
|
+
publickey: string | null;
|
|
1258
|
+
};
|
|
1259
|
+
}) => Promise<void>;
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* El libro de contactos que usa el núcleo: la interfaz de `vault/peerStore.js`.
|
|
1263
|
+
*/
|
|
1264
|
+
export type CorePeers = {
|
|
1265
|
+
initPeerStorage(): Promise<import("./peerStore.js").PeerBook>;
|
|
1266
|
+
loadPeers(): import("./peerStore.js").PeerBook;
|
|
1267
|
+
savePeers(p: import("./peerStore.js").PeerBook): void;
|
|
1268
|
+
setPeersDirect(p: import("./peerStore.js").PeerBook): void;
|
|
1269
|
+
upsertPeer(publickey: string, patch: Record<string, any>): import("./peerStore.js").PeerRecord;
|
|
1270
|
+
onDirty(fn: (() => void) | null): void;
|
|
1271
|
+
setProfile?(pid: string | null, opts?: {
|
|
1272
|
+
volatile?: boolean;
|
|
1273
|
+
}): void | Promise<void>;
|
|
1274
|
+
adoptLegacy?(pid: string): void | Promise<void>;
|
|
1275
|
+
};
|
|
1276
|
+
/**
|
|
1277
|
+
* El candado de la maestra: sella y abre con la llave que sale de la contraseña del perfil.
|
|
1278
|
+
* Cerrado, `open` devuelve `null`.
|
|
1279
|
+
*/
|
|
1280
|
+
export type KeyLock = {
|
|
1281
|
+
seal?(plaintext: string): Promise<any>;
|
|
1282
|
+
open?(sealed: any): Promise<string | null>;
|
|
1283
|
+
};
|
|
1284
|
+
/**
|
|
1285
|
+
* Lo que el núcleo necesita de quien lo monta (el iframe, Node o la app).
|
|
1286
|
+
*/
|
|
1287
|
+
export type CoreDeps = {
|
|
1288
|
+
/**
|
|
1289
|
+
* almacén síncrono estilo localStorage (keypairs, me, nonces)
|
|
1290
|
+
*/
|
|
1291
|
+
kv: Kv;
|
|
1292
|
+
/**
|
|
1293
|
+
* el libro de contactos
|
|
1294
|
+
*/
|
|
1295
|
+
peers: CorePeers;
|
|
1296
|
+
/**
|
|
1297
|
+
* fábrica del respaldo en Drive (`createSync`); sin ella, los `sync*` lanzan
|
|
1298
|
+
*/
|
|
1299
|
+
makeSync?: ((cfg: {
|
|
1300
|
+
fileName: string;
|
|
1301
|
+
kind: string;
|
|
1302
|
+
exportLocal: () => Promise<any>;
|
|
1303
|
+
applyMerged: (merged: any) => Promise<void>;
|
|
1304
|
+
mergeFn: (local: any, remote: any) => Promise<{
|
|
1305
|
+
merged: any;
|
|
1306
|
+
changed: boolean;
|
|
1307
|
+
}>;
|
|
1308
|
+
}) => any) | null;
|
|
1309
|
+
/**
|
|
1310
|
+
* dónde viven las llaves privadas; sin él, JWK en `kv`
|
|
1311
|
+
*/
|
|
1312
|
+
keyStore?: KeyStore | null;
|
|
1313
|
+
/**
|
|
1314
|
+
* lo de esta pestaña (`sessionStorage`)
|
|
1315
|
+
*/
|
|
1316
|
+
sessionKv?: Kv | null;
|
|
1317
|
+
removeAccountOnExpulsion?: boolean;
|
|
1318
|
+
keyLock?: KeyLock | null;
|
|
1319
|
+
askConsent?: ((q: {
|
|
1320
|
+
origin: string;
|
|
1321
|
+
scopes: string[];
|
|
1322
|
+
already: string[];
|
|
1323
|
+
onBehalfOf: string | null;
|
|
1324
|
+
}) => Promise<boolean> | boolean) | null;
|
|
1325
|
+
};
|
|
1326
|
+
/**
|
|
1327
|
+
* Un perfil de la lista de este aparato.
|
|
1328
|
+
*/
|
|
1329
|
+
export type ProfileEntry = {
|
|
1330
|
+
id: string;
|
|
1331
|
+
name?: string;
|
|
1332
|
+
pubkey?: string | null;
|
|
1333
|
+
pendingJoin?: boolean;
|
|
1334
|
+
} & Record<string, any>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Un par cargado: la privada (CryptoKey o el asa del chip; `null` con el candado echado) y la pública.
|
|
1337
|
+
*/
|
|
1338
|
+
export type LoadedPair = {
|
|
1339
|
+
privateKey: any;
|
|
1340
|
+
publicKey: CryptoKey;
|
|
1341
|
+
publicJwk: JsonWebKey;
|
|
1342
|
+
locked?: boolean;
|
|
1343
|
+
};
|
|
1344
|
+
/**
|
|
1345
|
+
* El emparejamiento guardado con la bóveda: su papel, a quién y por dónde.
|
|
1346
|
+
*/
|
|
1347
|
+
export type VaultLink = {
|
|
1348
|
+
cert: any;
|
|
1349
|
+
master: string;
|
|
1350
|
+
proxy: string;
|
|
1351
|
+
deviceId?: string;
|
|
1352
|
+
pairedAt?: number;
|
|
1353
|
+
account?: string;
|
|
1354
|
+
} & Record<string, any>;
|
|
1355
|
+
export type DeviceKey = import("./remote.js").DeviceKey;
|
|
1356
|
+
export type Acta = import("./acta.js").Acta;
|
|
1357
|
+
/**
|
|
1358
|
+
* Los parámetros de un manejador: llegan por `postMessage` (de cualquier aplicación) o por la
|
|
1359
|
+
* API de Node, sin comprobar. Cada manejador valida lo que usa.
|
|
1360
|
+
*/
|
|
1361
|
+
export type HandlerParams = Record<string, any>;
|
|
1362
|
+
import * as Acta from './acta.js';
|
|
1363
|
+
import * as Content from './content.js';
|