mindoodb 0.0.97 → 0.0.99
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/README-server.md +15 -0
- package/README.md +1 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +7 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +17 -9
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.js +1 -0
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +18 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +41 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
- package/dist/browser/index.mjs +76 -0
- package/dist/core/BaseMindooDB.d.ts +2 -0
- package/dist/core/BaseMindooDB.d.ts.map +1 -1
- package/dist/core/BaseMindooDB.js +73 -53
- package/dist/core/BaseMindooDB.js.map +1 -1
- package/dist/core/BaseMindooTenant.d.ts +44 -1
- package/dist/core/BaseMindooTenant.d.ts.map +1 -1
- package/dist/core/BaseMindooTenant.js +176 -42
- package/dist/core/BaseMindooTenant.js.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts +11 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.js +137 -92
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
- package/dist/core/MindooDBServerAdmin.d.ts +1 -1
- package/dist/core/MindooDBServerAdmin.d.ts.map +1 -1
- package/dist/core/appendonlystores/migration/StoreMigration.d.ts +41 -1
- package/dist/core/appendonlystores/migration/StoreMigration.d.ts.map +1 -1
- package/dist/core/appendonlystores/migration/StoreMigration.js +126 -0
- package/dist/core/appendonlystores/migration/StoreMigration.js.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js +29 -0
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/syncStores.d.ts +6 -0
- package/dist/core/appendonlystores/syncStores.d.ts.map +1 -1
- package/dist/core/appendonlystores/syncStores.js +21 -0
- package/dist/core/appendonlystores/syncStores.js.map +1 -1
- package/dist/core/appendonlystores/types.d.ts +8 -0
- package/dist/core/appendonlystores/types.d.ts.map +1 -1
- package/dist/core/appendonlystores/types.js.map +1 -1
- package/dist/core/builtinDbInvariants.d.ts +26 -1
- package/dist/core/builtinDbInvariants.d.ts.map +1 -1
- package/dist/core/builtinDbInvariants.js +52 -2
- package/dist/core/builtinDbInvariants.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/joinrequests/crypto.d.ts +110 -0
- package/dist/core/joinrequests/crypto.d.ts.map +1 -0
- package/dist/core/joinrequests/crypto.js +340 -0
- package/dist/core/joinrequests/crypto.js.map +1 -0
- package/dist/core/joinrequests/index.d.ts +4 -0
- package/dist/core/joinrequests/index.d.ts.map +1 -0
- package/dist/core/joinrequests/index.js +29 -0
- package/dist/core/joinrequests/index.js.map +1 -0
- package/dist/core/joinrequests/invitations.d.ts +257 -0
- package/dist/core/joinrequests/invitations.d.ts.map +1 -0
- package/dist/core/joinrequests/invitations.js +703 -0
- package/dist/core/joinrequests/invitations.js.map +1 -0
- package/dist/core/joinrequests/types.d.ts +208 -0
- package/dist/core/joinrequests/types.d.ts.map +1 -0
- package/dist/core/joinrequests/types.js +43 -0
- package/dist/core/joinrequests/types.js.map +1 -0
- package/dist/core/recovery/PaperRescueDevice.d.ts +101 -0
- package/dist/core/recovery/PaperRescueDevice.d.ts.map +1 -0
- package/dist/core/recovery/PaperRescueDevice.js +205 -0
- package/dist/core/recovery/PaperRescueDevice.js.map +1 -0
- package/dist/core/recovery/RecoveryContactsDocument.d.ts +86 -0
- package/dist/core/recovery/RecoveryContactsDocument.d.ts.map +1 -0
- package/dist/core/recovery/RecoveryContactsDocument.js +91 -0
- package/dist/core/recovery/RecoveryContactsDocument.js.map +1 -0
- package/dist/core/recovery/RecoveryContactsManager.d.ts +176 -0
- package/dist/core/recovery/RecoveryContactsManager.d.ts.map +1 -0
- package/dist/core/recovery/RecoveryContactsManager.js +455 -0
- package/dist/core/recovery/RecoveryContactsManager.js.map +1 -0
- package/dist/core/recovery/index.d.ts +9 -0
- package/dist/core/recovery/index.d.ts.map +1 -0
- package/dist/core/recovery/index.js +48 -0
- package/dist/core/recovery/index.js.map +1 -0
- package/dist/core/recovery/recoverWithContacts.d.ts +56 -0
- package/dist/core/recovery/recoverWithContacts.d.ts.map +1 -0
- package/dist/core/recovery/recoverWithContacts.js +142 -0
- package/dist/core/recovery/recoverWithContacts.js.map +1 -0
- package/dist/core/recovery/recoveryPackage.d.ts +80 -0
- package/dist/core/recovery/recoveryPackage.d.ts.map +1 -0
- package/dist/core/recovery/recoveryPackage.js +182 -0
- package/dist/core/recovery/recoveryPackage.js.map +1 -0
- package/dist/core/recovery/rescueApproval.d.ts +39 -0
- package/dist/core/recovery/rescueApproval.d.ts.map +1 -0
- package/dist/core/recovery/rescueApproval.js +52 -0
- package/dist/core/recovery/rescueApproval.js.map +1 -0
- package/dist/core/recovery/rescueDevice.d.ts +51 -0
- package/dist/core/recovery/rescueDevice.d.ts.map +1 -0
- package/dist/core/recovery/rescueDevice.js +201 -0
- package/dist/core/recovery/rescueDevice.js.map +1 -0
- package/dist/core/recovery/shamir.d.ts +30 -0
- package/dist/core/recovery/shamir.d.ts.map +1 -0
- package/dist/core/recovery/shamir.js +133 -0
- package/dist/core/recovery/shamir.js.map +1 -0
- package/dist/core/types.d.ts +73 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/userkeys/UserKeyManager.d.ts +45 -0
- package/dist/core/userkeys/UserKeyManager.d.ts.map +1 -1
- package/dist/core/userkeys/UserKeyManager.js +121 -8
- package/dist/core/userkeys/UserKeyManager.js.map +1 -1
- package/dist/core/userkeys/generationSignature.d.ts +6 -0
- package/dist/core/userkeys/generationSignature.d.ts.map +1 -1
- package/dist/core/userkeys/generationSignature.js +1 -0
- package/dist/core/userkeys/generationSignature.js.map +1 -1
- package/dist/core/userkeys/resolveUserKeyDocument.d.ts.map +1 -1
- package/dist/core/userkeys/resolveUserKeyDocument.js +6 -6
- package/dist/core/userkeys/resolveUserKeyDocument.js.map +1 -1
- package/dist/core/userkeys/validateUserKeyDocument.d.ts +11 -1
- package/dist/core/userkeys/validateUserKeyDocument.d.ts.map +1 -1
- package/dist/core/userkeys/validateUserKeyDocument.js +18 -5
- package/dist/core/userkeys/validateUserKeyDocument.js.map +1 -1
- package/dist/node/appendonlystores/sqlite/FsBlobContentStore.d.ts +23 -0
- package/dist/node/appendonlystores/sqlite/FsBlobContentStore.d.ts.map +1 -0
- package/dist/node/appendonlystores/sqlite/FsBlobContentStore.js +119 -0
- package/dist/node/appendonlystores/sqlite/FsBlobContentStore.js.map +1 -0
- package/dist/node/appendonlystores/sqlite/NodeSqliteStore.d.ts +43 -0
- package/dist/node/appendonlystores/sqlite/NodeSqliteStore.d.ts.map +1 -0
- package/dist/node/appendonlystores/sqlite/NodeSqliteStore.js +121 -0
- package/dist/node/appendonlystores/sqlite/NodeSqliteStore.js.map +1 -0
- package/dist/node/appendonlystores/sqlite/ServerSqliteStore.d.ts +43 -0
- package/dist/node/appendonlystores/sqlite/ServerSqliteStore.d.ts.map +1 -0
- package/dist/node/appendonlystores/sqlite/ServerSqliteStore.js +279 -0
- package/dist/node/appendonlystores/sqlite/ServerSqliteStore.js.map +1 -0
- package/dist/node/server/MindooDBServer.d.ts +2 -0
- package/dist/node/server/MindooDBServer.d.ts.map +1 -1
- package/dist/node/server/MindooDBServer.js +46 -0
- package/dist/node/server/MindooDBServer.js.map +1 -1
- package/dist/node/server/StoreFactory.d.ts +5 -2
- package/dist/node/server/StoreFactory.d.ts.map +1 -1
- package/dist/node/server/StoreFactory.js +21 -4
- package/dist/node/server/StoreFactory.js.map +1 -1
- package/dist/node/server/TenantManager.d.ts +6 -0
- package/dist/node/server/TenantManager.d.ts.map +1 -1
- package/dist/node/server/TenantManager.js +17 -0
- package/dist/node/server/TenantManager.js.map +1 -1
- package/dist/node/server/server.js +2 -0
- package/dist/node/server/server.js.map +1 -1
- package/dist/server/JoinRequestService.d.ts +108 -0
- package/dist/server/JoinRequestService.d.ts.map +1 -0
- package/dist/server/JoinRequestService.js +454 -0
- package/dist/server/JoinRequestService.js.map +1 -0
- package/dist/server/TenantManager.d.ts +57 -1
- package/dist/server/TenantManager.d.ts.map +1 -1
- package/dist/server/TenantManager.js +273 -34
- package/dist/server/TenantManager.js.map +1 -1
- package/dist/server/http/MindooDBServerCore.d.ts +18 -0
- package/dist/server/http/MindooDBServerCore.d.ts.map +1 -1
- package/dist/server/http/MindooDBServerCore.js +230 -137
- package/dist/server/http/MindooDBServerCore.js.map +1 -1
- package/dist/server/serverConfig.d.ts.map +1 -1
- package/dist/server/serverConfig.js +17 -0
- package/dist/server/serverConfig.js.map +1 -1
- package/dist/server/types.d.ts +16 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js +6 -0
- package/dist/server/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecoveryContactsManager = exports.RecoveryContactsError = void 0;
|
|
4
|
+
exports.admitRescueDevice = admitRescueDevice;
|
|
5
|
+
exports.rescueAttestationHolds = rescueAttestationHolds;
|
|
6
|
+
exports.rescueRefIsGenuine = rescueRefIsGenuine;
|
|
7
|
+
exports.rescueDeviceStatus = rescueDeviceStatus;
|
|
8
|
+
exports.approveOwnRescueDevices = approveOwnRescueDevices;
|
|
9
|
+
const RSAEncryption_1 = require("../crypto/RSAEncryption");
|
|
10
|
+
const types_1 = require("../types");
|
|
11
|
+
const fingerprint_1 = require("../userkeys/fingerprint");
|
|
12
|
+
const types_2 = require("../userkeys/types");
|
|
13
|
+
const RecoveryContactsDocument_1 = require("./RecoveryContactsDocument");
|
|
14
|
+
const rescueDevice_1 = require("./rescueDevice");
|
|
15
|
+
const rescueApproval_1 = require("./rescueApproval");
|
|
16
|
+
const shamir_1 = require("./shamir");
|
|
17
|
+
class RecoveryContactsError extends Error {
|
|
18
|
+
constructor(code, message,
|
|
19
|
+
/** Usernames the error is about (`contact-without-key`, `contact-is-self`). */
|
|
20
|
+
usernames = []) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.usernames = usernames;
|
|
24
|
+
this.name = "RecoveryContactsError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.RecoveryContactsError = RecoveryContactsError;
|
|
28
|
+
/**
|
|
29
|
+
* Admit a rescue device: certify it with the self-grant key, or — without
|
|
30
|
+
* self-grant — attest it with the User-Key for the administrator to grant
|
|
31
|
+
* (docs/userkeys.md §12.9).
|
|
32
|
+
*/
|
|
33
|
+
async function admitRescueDevice(input) {
|
|
34
|
+
const keys = { signingPublicKey: input.rescue.signingPublicKey, encryptionPublicKey: input.rescue.encryptionPublicKey };
|
|
35
|
+
if (await input.userKeys.canIssueDeviceCertificates()) {
|
|
36
|
+
const { docId } = await input.userKeys.issueDeviceCertificate(keys, input.label);
|
|
37
|
+
return {
|
|
38
|
+
ref: { ...keys, signingKeyFingerprint: input.rescue.signingKeyFingerprint, approval: "certificate", certificateDocId: docId },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (input.allowAdminApproval === false) {
|
|
42
|
+
throw new RecoveryContactsError("self-grant-required", "A rescue device needs device self-grant: the administrator must allow this person to add own devices.");
|
|
43
|
+
}
|
|
44
|
+
const attestation = await input.userKeys.signWithOwnUserKey((0, rescueApproval_1.rescueAttestationMessage)({ usernameHash: input.usernameHash, ...keys }));
|
|
45
|
+
if (!attestation) {
|
|
46
|
+
throw new RecoveryContactsError("no-user-key", "This device cannot open the person's User-Key.");
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
ref: { ...keys, signingKeyFingerprint: input.rescue.signingKeyFingerprint, approval: "admin", attestation },
|
|
50
|
+
joinRequestUri: (0, rescueApproval_1.rescueDeviceJoinRequestUri)({ ...keys, label: input.label }),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Whether an admin-approved rescue device was set up by a holder of the person's User-Key. */
|
|
54
|
+
async function rescueAttestationHolds(userKeys, usernameHash, ref) {
|
|
55
|
+
if (ref.approval !== "admin" || !ref.attestation)
|
|
56
|
+
return false;
|
|
57
|
+
return userKeys.verifyOwnUserKeySignature(ref.attestation.epoch, ref.attestation.signature, (0, rescueApproval_1.rescueAttestationMessage)({
|
|
58
|
+
usernameHash,
|
|
59
|
+
signingPublicKey: ref.signingPublicKey,
|
|
60
|
+
encryptionPublicKey: ref.encryptionPublicKey,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether the rescue device a `rcv_`/`rpp_` document names is genuine: an
|
|
65
|
+
* admin-approved one must carry an attestation by the person's User-Key, a
|
|
66
|
+
* certified one must be certified now. A device on the person's grant can
|
|
67
|
+
* write documents under their name, so the document alone proves nothing.
|
|
68
|
+
*/
|
|
69
|
+
async function rescueRefIsGenuine(input) {
|
|
70
|
+
const { ref } = input;
|
|
71
|
+
if (ref.approval === "admin") {
|
|
72
|
+
if (!ref.attestation)
|
|
73
|
+
return false;
|
|
74
|
+
return input.userKeys.verifyUserKeySignatureOf(input.username, ref.attestation.epoch, ref.attestation.signature, (0, rescueApproval_1.rescueAttestationMessage)({
|
|
75
|
+
usernameHash: input.usernameHash,
|
|
76
|
+
signingPublicKey: ref.signingPublicKey,
|
|
77
|
+
encryptionPublicKey: ref.encryptionPublicKey,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
const directory = (await input.tenant.openDirectory());
|
|
81
|
+
const resolved = await directory.resolveSignerToGrant(ref.signingPublicKey, Number.MAX_SAFE_INTEGER);
|
|
82
|
+
return resolved?.via === "certificate" && resolved.grant.usernameHash === input.usernameHash;
|
|
83
|
+
}
|
|
84
|
+
/** Where a rescue device of this person stands. */
|
|
85
|
+
async function rescueDeviceStatus(tenant, userKeys, ref) {
|
|
86
|
+
const directory = (await tenant.openDirectory());
|
|
87
|
+
const resolved = await directory.resolveSignerToGrant(ref.signingPublicKey, Number.MAX_SAFE_INTEGER);
|
|
88
|
+
if (!resolved)
|
|
89
|
+
return ref.approval === "admin" ? "waiting-for-admin" : "withdrawn";
|
|
90
|
+
if (resolved.via === "certificate")
|
|
91
|
+
return "active";
|
|
92
|
+
const fingerprint = await (0, fingerprint_1.fingerprintPublicKeyPem)(ref.encryptionPublicKey, tenant.getCryptoAdapter().getSubtle());
|
|
93
|
+
const row = (await userKeys.listUserKeyDevices()).find((r) => r.fingerprint === fingerprint);
|
|
94
|
+
return row?.status === "approved" ? "active" : "waiting-for-key";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Wrap the User-Key to this person's own admin-approved rescue devices that
|
|
98
|
+
* reached the grant (no dialog: their attestation proves this person set them
|
|
99
|
+
* up). Returns how many were approved.
|
|
100
|
+
*/
|
|
101
|
+
async function approveOwnRescueDevices(userKeys, usernameHash, refs) {
|
|
102
|
+
const admin = refs.filter((ref) => ref.approval === "admin");
|
|
103
|
+
if (admin.length === 0)
|
|
104
|
+
return 0;
|
|
105
|
+
const pending = await userKeys.listPendingUserKeyDevices();
|
|
106
|
+
let approved = 0;
|
|
107
|
+
for (const ref of admin) {
|
|
108
|
+
const match = pending.find((device) => (0, fingerprint_1.normalizePublicKeyPem)(device.encryptionPublicKey) === (0, fingerprint_1.normalizePublicKeyPem)(ref.encryptionPublicKey));
|
|
109
|
+
if (!match)
|
|
110
|
+
continue;
|
|
111
|
+
if (!(await rescueAttestationHolds(userKeys, usernameHash, ref)))
|
|
112
|
+
continue;
|
|
113
|
+
await userKeys.approveUserKeyDevice(match.fingerprint);
|
|
114
|
+
approved += 1;
|
|
115
|
+
}
|
|
116
|
+
return approved;
|
|
117
|
+
}
|
|
118
|
+
class RecoveryContactsManager {
|
|
119
|
+
constructor(tenant, userKeys) {
|
|
120
|
+
this.tenant = tenant;
|
|
121
|
+
this.userKeys = userKeys;
|
|
122
|
+
}
|
|
123
|
+
async userDirectory() {
|
|
124
|
+
return this.tenant.openDB(types_1.USER_DIRECTORY_DB_ID);
|
|
125
|
+
}
|
|
126
|
+
async directory() {
|
|
127
|
+
return (await this.tenant.openDirectory());
|
|
128
|
+
}
|
|
129
|
+
/** Every `rcv_` document that verifies, newest first. */
|
|
130
|
+
async verifiedSetups() {
|
|
131
|
+
const db = await this.userDirectory();
|
|
132
|
+
const directory = await this.directory();
|
|
133
|
+
const out = [];
|
|
134
|
+
for (const id of await db.getAllDocumentIds()) {
|
|
135
|
+
if (!id.startsWith(RecoveryContactsDocument_1.RECOVERY_CONTACTS_DOC_ID_PREFIX))
|
|
136
|
+
continue;
|
|
137
|
+
try {
|
|
138
|
+
const doc = await db.getDocument(id);
|
|
139
|
+
const setup = await (0, RecoveryContactsDocument_1.verifyRecoveryContactsDoc)({ db, doc, directory });
|
|
140
|
+
if (setup &&
|
|
141
|
+
(await rescueRefIsGenuine({
|
|
142
|
+
tenant: this.tenant,
|
|
143
|
+
userKeys: this.userKeys,
|
|
144
|
+
username: setup.payload.username,
|
|
145
|
+
usernameHash: setup.payload.username_hash,
|
|
146
|
+
ref: setup.payload.rescueDevice,
|
|
147
|
+
}))) {
|
|
148
|
+
out.push(setup);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
// unreadable (no `default` yet) or damaged: not a setup
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return out.sort((a, b) => b.payload.createdAt - a.payload.createdAt || (a.docId < b.docId ? 1 : -1));
|
|
156
|
+
}
|
|
157
|
+
async ownUsernameHash() {
|
|
158
|
+
const resolved = await this.userKeys.resolveOwnUserKeyDocument();
|
|
159
|
+
return resolved?.payload.username_hash ?? null;
|
|
160
|
+
}
|
|
161
|
+
/** This person's current setups, newest first (normally one). */
|
|
162
|
+
async ownSetups() {
|
|
163
|
+
const hash = await this.ownUsernameHash();
|
|
164
|
+
if (!hash)
|
|
165
|
+
return [];
|
|
166
|
+
return (await this.verifiedSetups()).filter((s) => s.payload.username_hash === hash);
|
|
167
|
+
}
|
|
168
|
+
/** This person's current recovery contacts, or `null` when none are set up. */
|
|
169
|
+
async getSetup() {
|
|
170
|
+
return (await this.ownSetups())[0] ?? null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Name recovery contacts: make a new rescue device, certify it, split its
|
|
174
|
+
* secret among the contacts (any two recover) and publish the `rcv_`
|
|
175
|
+
* document. Replaces an earlier setup and withdraws its rescue device.
|
|
176
|
+
* Needs the person's device self-grant (the rescue device is certified with
|
|
177
|
+
* it) and a published User-Key for every contact.
|
|
178
|
+
*/
|
|
179
|
+
async setup(contactUsernames, options) {
|
|
180
|
+
const me = await this.tenant.getCurrentUserId();
|
|
181
|
+
const directory = await this.directory();
|
|
182
|
+
const ownResolved = await this.userKeys.resolveOwnUserKeyDocument();
|
|
183
|
+
if (!ownResolved) {
|
|
184
|
+
throw new RecoveryContactsError("no-user-key", "This person has no published User-Key yet.");
|
|
185
|
+
}
|
|
186
|
+
const ownHash = ownResolved.payload.username_hash;
|
|
187
|
+
if (!(await this.tenant.hasDecryptionKey(types_1.DEFAULT_TENANT_KEY_ID))) {
|
|
188
|
+
throw new RecoveryContactsError("no-default-key", "This device does not hold the tenant key yet.");
|
|
189
|
+
}
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
const contacts = [];
|
|
192
|
+
for (const raw of contactUsernames) {
|
|
193
|
+
const username = raw.trim();
|
|
194
|
+
if (!username)
|
|
195
|
+
continue;
|
|
196
|
+
const key = username.toLowerCase();
|
|
197
|
+
if (seen.has(key))
|
|
198
|
+
continue;
|
|
199
|
+
seen.add(key);
|
|
200
|
+
contacts.push(username);
|
|
201
|
+
}
|
|
202
|
+
const selfNamed = [];
|
|
203
|
+
for (const username of contacts) {
|
|
204
|
+
const hashes = await directory.getUsernameHashCandidates(username);
|
|
205
|
+
if (hashes.includes(ownHash))
|
|
206
|
+
selfNamed.push(username);
|
|
207
|
+
}
|
|
208
|
+
if (selfNamed.length > 0) {
|
|
209
|
+
throw new RecoveryContactsError("contact-is-self", "You cannot be your own recovery contact.", selfNamed);
|
|
210
|
+
}
|
|
211
|
+
if (contacts.length < RecoveryContactsDocument_1.RECOVERY_CONTACTS_MIN) {
|
|
212
|
+
throw new RecoveryContactsError("too-few-contacts", `Name at least ${RecoveryContactsDocument_1.RECOVERY_CONTACTS_MIN} recovery contacts.`);
|
|
213
|
+
}
|
|
214
|
+
if (options?.allowAdminApproval === false && !(await this.userKeys.canIssueDeviceCertificates())) {
|
|
215
|
+
throw new RecoveryContactsError("self-grant-required", "Recovery contacts need device self-grant: the administrator must allow this person to add own devices.");
|
|
216
|
+
}
|
|
217
|
+
const recipients = [];
|
|
218
|
+
const missing = [];
|
|
219
|
+
for (const username of contacts) {
|
|
220
|
+
const published = await this.userKeys.publishedUserKeyFor(username);
|
|
221
|
+
if (!published || published.pending) {
|
|
222
|
+
missing.push(username);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
recipients.push({ username, publicKey: published.publicKey, fingerprint: published.fingerprint });
|
|
226
|
+
}
|
|
227
|
+
if (missing.length > 0) {
|
|
228
|
+
throw new RecoveryContactsError("contact-without-key", `These people cannot be recovery contacts yet (no published User-Key): ${missing.join(", ")}`, missing);
|
|
229
|
+
}
|
|
230
|
+
const previous = await this.ownSetups();
|
|
231
|
+
const crypto = this.tenant.getCryptoAdapter();
|
|
232
|
+
const rescue = await (0, rescueDevice_1.generateRescueDevice)(crypto);
|
|
233
|
+
const label = options?.rescueDeviceLabel?.trim() || "Rescue device";
|
|
234
|
+
const admitted = await admitRescueDevice({
|
|
235
|
+
userKeys: this.userKeys,
|
|
236
|
+
rescue,
|
|
237
|
+
label,
|
|
238
|
+
usernameHash: ownHash,
|
|
239
|
+
...(options?.allowAdminApproval !== undefined ? { allowAdminApproval: options.allowAdminApproval } : {}),
|
|
240
|
+
});
|
|
241
|
+
const shares = (0, shamir_1.splitSecret)(crypto, rescue.secret, recipients.length, RecoveryContactsDocument_1.RECOVERY_CONTACTS_THRESHOLD);
|
|
242
|
+
rescue.secret.fill(0);
|
|
243
|
+
const rsa = new RSAEncryption_1.RSAEncryption(crypto);
|
|
244
|
+
const payload = {
|
|
245
|
+
form: types_2.USERKEY_FORM,
|
|
246
|
+
type: RecoveryContactsDocument_1.RECOVERY_CONTACTS_TYPE,
|
|
247
|
+
schemaVersion: RecoveryContactsDocument_1.RECOVERY_CONTACTS_SCHEMA_VERSION,
|
|
248
|
+
username: me.username,
|
|
249
|
+
username_hash: ownHash,
|
|
250
|
+
threshold: RecoveryContactsDocument_1.RECOVERY_CONTACTS_THRESHOLD,
|
|
251
|
+
createdAt: Date.now(),
|
|
252
|
+
rescueDevice: admitted.ref,
|
|
253
|
+
rescueBlob: rescue.blob,
|
|
254
|
+
contacts: [],
|
|
255
|
+
};
|
|
256
|
+
for (let i = 0; i < recipients.length; i++) {
|
|
257
|
+
const recipient = recipients[i];
|
|
258
|
+
payload.contacts.push({
|
|
259
|
+
username: recipient.username,
|
|
260
|
+
userKeyFingerprint: recipient.fingerprint,
|
|
261
|
+
sealedShare: (0, fingerprint_1.bytesToBase64)(await rsa.encrypt(shares[i], recipient.publicKey)),
|
|
262
|
+
});
|
|
263
|
+
shares[i].fill(0);
|
|
264
|
+
}
|
|
265
|
+
rescue.signingPkcs8.fill(0);
|
|
266
|
+
rescue.encryptionPkcs8.fill(0);
|
|
267
|
+
const db = await this.userDirectory();
|
|
268
|
+
const doc = await db.createDocument({
|
|
269
|
+
decryptionKeyId: types_1.DEFAULT_TENANT_KEY_ID,
|
|
270
|
+
idPrefix: RecoveryContactsDocument_1.RECOVERY_CONTACTS_DOC_ID_PREFIX.replace(/_$/, ""),
|
|
271
|
+
initialValues: payload,
|
|
272
|
+
});
|
|
273
|
+
// Only now retire what came before: a failure above leaves it working.
|
|
274
|
+
for (const old of previous) {
|
|
275
|
+
await this.retire(db, old);
|
|
276
|
+
}
|
|
277
|
+
await this.withdrawExtra(options?.withdrawRescueDevices, previous);
|
|
278
|
+
return {
|
|
279
|
+
docId: doc.getId(),
|
|
280
|
+
payload: JSON.parse(JSON.stringify(payload)),
|
|
281
|
+
...(admitted.joinRequestUri ? { joinRequestUri: admitted.joinRequestUri } : {}),
|
|
282
|
+
rescueDevicesToRemove: await this.adminRescueDevicesOnGrant(previous.map((p) => p.payload.rescueDevice)),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/** Fingerprints of admin-approved rescue devices among `refs` that are still on the grant. */
|
|
286
|
+
async adminRescueDevicesOnGrant(refs) {
|
|
287
|
+
const out = [];
|
|
288
|
+
for (const ref of refs) {
|
|
289
|
+
if (ref.approval !== "admin")
|
|
290
|
+
continue;
|
|
291
|
+
const status = await rescueDeviceStatus(this.tenant, this.userKeys, ref);
|
|
292
|
+
if (status === "active" || status === "waiting-for-key")
|
|
293
|
+
out.push(ref.signingKeyFingerprint);
|
|
294
|
+
}
|
|
295
|
+
return out;
|
|
296
|
+
}
|
|
297
|
+
/** Where this person's current rescue device stands (`null` without a setup). */
|
|
298
|
+
async status() {
|
|
299
|
+
const setup = await this.getSetup();
|
|
300
|
+
return setup ? rescueDeviceStatus(this.tenant, this.userKeys, setup.payload.rescueDevice) : null;
|
|
301
|
+
}
|
|
302
|
+
/** The rescue devices of all own setups (for {@link approveOwnRescueDevices}). */
|
|
303
|
+
async ownRescueDevices() {
|
|
304
|
+
const usernameHash = await this.ownUsernameHash();
|
|
305
|
+
return { usernameHash, refs: (await this.ownSetups()).map((s) => s.payload.rescueDevice) };
|
|
306
|
+
}
|
|
307
|
+
/** Delete a setup and withdraw its rescue device. */
|
|
308
|
+
async retire(db, setup) {
|
|
309
|
+
try {
|
|
310
|
+
await this.userKeys.revokeOwnDeviceCertificate(setup.payload.rescueDevice.signingKeyFingerprint);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
// already withdrawn
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
await db.deleteDocument(setup.docId);
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
// already deleted
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/** Withdraw rescue devices by fingerprint that no retired setup covered. */
|
|
323
|
+
async withdrawExtra(fingerprints, retired) {
|
|
324
|
+
const covered = new Set(retired.map((s) => s.payload.rescueDevice.signingKeyFingerprint));
|
|
325
|
+
for (const fingerprint of fingerprints ?? []) {
|
|
326
|
+
if (covered.has(fingerprint))
|
|
327
|
+
continue;
|
|
328
|
+
try {
|
|
329
|
+
await this.userKeys.revokeOwnDeviceCertificate(fingerprint);
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
// not in this replica, or already withdrawn
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Remove recovery contacts: delete every own setup and withdraw its rescue
|
|
338
|
+
* device (and `withdrawRescueDevices`). Returns how many setups were removed.
|
|
339
|
+
*/
|
|
340
|
+
async remove(options) {
|
|
341
|
+
const db = await this.userDirectory();
|
|
342
|
+
const setups = await this.ownSetups();
|
|
343
|
+
for (const setup of setups)
|
|
344
|
+
await this.retire(db, setup);
|
|
345
|
+
await this.withdrawExtra(options?.withdrawRescueDevices, setups);
|
|
346
|
+
return setups.length;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* People who named this person as a recovery contact, one entry per person
|
|
350
|
+
* (their newest setup), newest first.
|
|
351
|
+
*/
|
|
352
|
+
async listRequests() {
|
|
353
|
+
const ownHash = await this.ownUsernameHash();
|
|
354
|
+
if (!ownHash)
|
|
355
|
+
return [];
|
|
356
|
+
const fingerprints = new Set((await this.userKeys.ownUserKeyGenerations()).map((g) => g.fingerprint));
|
|
357
|
+
if (fingerprints.size === 0)
|
|
358
|
+
return [];
|
|
359
|
+
const byPerson = new Map();
|
|
360
|
+
for (const setup of await this.verifiedSetups()) {
|
|
361
|
+
if (setup.payload.username_hash === ownHash)
|
|
362
|
+
continue;
|
|
363
|
+
if (byPerson.has(setup.payload.username_hash))
|
|
364
|
+
continue; // newest first
|
|
365
|
+
byPerson.set(setup.payload.username_hash, setup);
|
|
366
|
+
}
|
|
367
|
+
const out = [];
|
|
368
|
+
for (const setup of byPerson.values()) {
|
|
369
|
+
if (!setup.payload.contacts.some((c) => fingerprints.has(c.userKeyFingerprint)))
|
|
370
|
+
continue;
|
|
371
|
+
out.push({
|
|
372
|
+
docId: setup.docId,
|
|
373
|
+
username: setup.payload.username,
|
|
374
|
+
createdAt: setup.payload.createdAt,
|
|
375
|
+
threshold: setup.payload.threshold,
|
|
376
|
+
contacts: setup.payload.contacts.map((c) => c.username),
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
return out;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Help a person recover: open this contact's share of their newest setup
|
|
383
|
+
* and build the package (plaintext — encrypt it with
|
|
384
|
+
* {@link encryptRecoveryHelperPackage} before handing it over).
|
|
385
|
+
* `person` is the person's username or the setup document id.
|
|
386
|
+
*/
|
|
387
|
+
async createHelperPackage(person, options) {
|
|
388
|
+
const ownHash = await this.ownUsernameHash();
|
|
389
|
+
const setups = (await this.verifiedSetups()).filter((s) => s.payload.username_hash !== ownHash);
|
|
390
|
+
let setup = setups.find((s) => s.docId === person);
|
|
391
|
+
if (!setup) {
|
|
392
|
+
const directory = await this.directory();
|
|
393
|
+
const hashes = new Set(await directory.getUsernameHashCandidates(person));
|
|
394
|
+
setup = setups.find((s) => hashes.has(s.payload.username_hash));
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
// A setup id must still be the person's newest one.
|
|
398
|
+
const hash = setup.payload.username_hash;
|
|
399
|
+
setup = setups.find((s) => s.payload.username_hash === hash);
|
|
400
|
+
}
|
|
401
|
+
if (!setup) {
|
|
402
|
+
throw new RecoveryContactsError("no-setup", "This person has no recovery contacts set up.");
|
|
403
|
+
}
|
|
404
|
+
const generations = await this.userKeys.ownUserKeyGenerations();
|
|
405
|
+
const rsa = new RSAEncryption_1.RSAEncryption(this.tenant.getCryptoAdapter());
|
|
406
|
+
let share = null;
|
|
407
|
+
for (const entry of setup.payload.contacts) {
|
|
408
|
+
const matching = generations.filter((g) => g.fingerprint === entry.userKeyFingerprint);
|
|
409
|
+
for (const generation of matching) {
|
|
410
|
+
try {
|
|
411
|
+
share = await rsa.decrypt((0, fingerprint_1.base64ToBytes)(entry.sealedShare), generation.privateKey);
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
catch {
|
|
415
|
+
// not this generation
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (share)
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
if (!share) {
|
|
422
|
+
throw new RecoveryContactsError("not-a-contact", "You are not a recovery contact of this person.");
|
|
423
|
+
}
|
|
424
|
+
const me = await this.tenant.getCurrentUserId();
|
|
425
|
+
const serverUrl = options?.serverUrl?.trim().replace(/\/$/, "");
|
|
426
|
+
return {
|
|
427
|
+
v: 1,
|
|
428
|
+
kind: "mindoodb-recovery-share",
|
|
429
|
+
tenantId: this.tenant.getId(),
|
|
430
|
+
...(serverUrl ? { serverUrl } : {}),
|
|
431
|
+
username: setup.payload.username,
|
|
432
|
+
setupDocId: setup.docId,
|
|
433
|
+
threshold: setup.payload.threshold,
|
|
434
|
+
rescueSigningKeyFingerprint: setup.payload.rescueDevice.signingKeyFingerprint,
|
|
435
|
+
...(setup.payload.rescueDevice.approval === "admin" ? { rescueApproval: "admin" } : {}),
|
|
436
|
+
rescueBlob: setup.payload.rescueBlob,
|
|
437
|
+
share: (0, fingerprint_1.bytesToBase64)(share),
|
|
438
|
+
helper: me.username,
|
|
439
|
+
createdAt: Date.now(),
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Signing keys of the rescue devices of every verified setup in the local
|
|
444
|
+
* replica (deleted setups are not included). A certificate issued by one of
|
|
445
|
+
* them means a recovery took place (docs/userkeys.md §12.5).
|
|
446
|
+
*/
|
|
447
|
+
async rescueDeviceSigningKeys() {
|
|
448
|
+
return (await this.verifiedSetups()).map((s) => ({
|
|
449
|
+
username: s.payload.username,
|
|
450
|
+
signingPublicKey: s.payload.rescueDevice.signingPublicKey,
|
|
451
|
+
}));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
exports.RecoveryContactsManager = RecoveryContactsManager;
|
|
455
|
+
//# sourceMappingURL=RecoveryContactsManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoveryContactsManager.js","sourceRoot":"","sources":["../../../src/core/recovery/RecoveryContactsManager.ts"],"names":[],"mappings":";;;AA+GA,8CA8BC;AAGD,wDAeC;AAQD,gDAwBC;AAGD,gDAYC;AAOD,0DAmBC;AA/ND,2DAAwD;AACxD,oCAAsF;AAEtF,yDAAuH;AACvH,6CAAiD;AACjD,yEASoC;AAEpC,iDAAsD;AACtD,qDAI0B;AAC1B,qCAAuC;AAYvC,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YACW,IAA+B,EACxC,OAAe;IACf,+EAA+E;IACtE,YAAsB,EAAE;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QALN,SAAI,GAAJ,IAAI,CAA2B;QAG/B,cAAS,GAAT,SAAS,CA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C,UAAU;YACpC,KAAK,EAAE,IAAA,2BAAa,EAAC,KAAK,CAAC;YAC3B,MAAM,EAAE,EAAE,CAAC,QAAQ;YACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,uBAAuB;QAC3B,OAAO,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/C,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ;YAC5B,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB;SAC1D,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAlWD,0DAkWC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { splitSecret, combineShares } from "./shamir";
|
|
2
|
+
export { generateRescueDevice, openRescueDevice, rescueDeviceUserId, type RescueDevicePublicKeys, type OpenedRescueDevice, type GeneratedRescueDevice, } from "./rescueDevice";
|
|
3
|
+
export { RECOVERY_CONTACTS_DOC_ID_PREFIX, RECOVERY_CONTACTS_TYPE, RECOVERY_CONTACTS_SCHEMA_VERSION, RECOVERY_CONTACTS_THRESHOLD, RECOVERY_CONTACTS_MIN, isRecoveryContactsDocId, asRecoveryContactsPayload, verifyRecoveryContactsDoc, personalDocBelongsTo, type RecoveryContactEntry, type RecoveryContactsPayload, type RecoveryContactsSetup, } from "./RecoveryContactsDocument";
|
|
4
|
+
export { RECOVERY_PACKAGE_PREFIX, RecoveryPackageError, generateRecoveryPackagePassword, normalizeRecoveryPackagePassword, encryptRecoveryHelperPackage, decryptRecoveryHelperPackage, extractRecoveryPackageText, combineRecoveryHelperPackages, type RecoveryHelperPackage, type CombinedRecoveryPackages, } from "./recoveryPackage";
|
|
5
|
+
export { RecoveryContactsError, rescueAttestationHolds, type RecoveryContactsErrorCode, type RescueDeviceStatus, type SetupRecoveryContactsResult, type RecoveryContactRequest, type SetupRecoveryContactsOptions, } from "./RecoveryContactsManager";
|
|
6
|
+
export { RecoveryError, certifyDeviceWithRescueDevice, approveDeviceWithRescueDevice, type CertifyDeviceWithRescueDeviceInput, type CertifyDeviceWithRescueDeviceResult, } from "./recoverWithContacts";
|
|
7
|
+
export { PAPER_RESCUE_DOC_ID_PREFIX, PAPER_RESCUE_TYPE, PAPER_RESCUE_SCHEMA_VERSION, openPaperRescueSecret, verifyPaperRescueDoc, type PaperRescuePayload, type PaperRescueRecord, type PaperRescueSecret, type CreatePaperRescueResult, } from "./PaperRescueDevice";
|
|
8
|
+
export { rescueAttestationMessage, rescueDeviceJoinRequestUri, isRescueDeviceRef, rescueApprovalOf, type RescueDeviceRef, type RescueDeviceApproval, type RescueDeviceAttestation, } from "./rescueApproval";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/recovery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,6BAA6B,EAC7B,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rescueApprovalOf = exports.isRescueDeviceRef = exports.rescueDeviceJoinRequestUri = exports.rescueAttestationMessage = exports.verifyPaperRescueDoc = exports.openPaperRescueSecret = exports.PAPER_RESCUE_SCHEMA_VERSION = exports.PAPER_RESCUE_TYPE = exports.PAPER_RESCUE_DOC_ID_PREFIX = exports.approveDeviceWithRescueDevice = exports.certifyDeviceWithRescueDevice = exports.RecoveryError = exports.rescueAttestationHolds = exports.RecoveryContactsError = exports.combineRecoveryHelperPackages = exports.extractRecoveryPackageText = exports.decryptRecoveryHelperPackage = exports.encryptRecoveryHelperPackage = exports.normalizeRecoveryPackagePassword = exports.generateRecoveryPackagePassword = exports.RecoveryPackageError = exports.RECOVERY_PACKAGE_PREFIX = exports.personalDocBelongsTo = exports.verifyRecoveryContactsDoc = exports.asRecoveryContactsPayload = exports.isRecoveryContactsDocId = exports.RECOVERY_CONTACTS_MIN = exports.RECOVERY_CONTACTS_THRESHOLD = exports.RECOVERY_CONTACTS_SCHEMA_VERSION = exports.RECOVERY_CONTACTS_TYPE = exports.RECOVERY_CONTACTS_DOC_ID_PREFIX = exports.rescueDeviceUserId = exports.openRescueDevice = exports.generateRescueDevice = exports.combineShares = exports.splitSecret = void 0;
|
|
4
|
+
var shamir_1 = require("./shamir");
|
|
5
|
+
Object.defineProperty(exports, "splitSecret", { enumerable: true, get: function () { return shamir_1.splitSecret; } });
|
|
6
|
+
Object.defineProperty(exports, "combineShares", { enumerable: true, get: function () { return shamir_1.combineShares; } });
|
|
7
|
+
var rescueDevice_1 = require("./rescueDevice");
|
|
8
|
+
Object.defineProperty(exports, "generateRescueDevice", { enumerable: true, get: function () { return rescueDevice_1.generateRescueDevice; } });
|
|
9
|
+
Object.defineProperty(exports, "openRescueDevice", { enumerable: true, get: function () { return rescueDevice_1.openRescueDevice; } });
|
|
10
|
+
Object.defineProperty(exports, "rescueDeviceUserId", { enumerable: true, get: function () { return rescueDevice_1.rescueDeviceUserId; } });
|
|
11
|
+
var RecoveryContactsDocument_1 = require("./RecoveryContactsDocument");
|
|
12
|
+
Object.defineProperty(exports, "RECOVERY_CONTACTS_DOC_ID_PREFIX", { enumerable: true, get: function () { return RecoveryContactsDocument_1.RECOVERY_CONTACTS_DOC_ID_PREFIX; } });
|
|
13
|
+
Object.defineProperty(exports, "RECOVERY_CONTACTS_TYPE", { enumerable: true, get: function () { return RecoveryContactsDocument_1.RECOVERY_CONTACTS_TYPE; } });
|
|
14
|
+
Object.defineProperty(exports, "RECOVERY_CONTACTS_SCHEMA_VERSION", { enumerable: true, get: function () { return RecoveryContactsDocument_1.RECOVERY_CONTACTS_SCHEMA_VERSION; } });
|
|
15
|
+
Object.defineProperty(exports, "RECOVERY_CONTACTS_THRESHOLD", { enumerable: true, get: function () { return RecoveryContactsDocument_1.RECOVERY_CONTACTS_THRESHOLD; } });
|
|
16
|
+
Object.defineProperty(exports, "RECOVERY_CONTACTS_MIN", { enumerable: true, get: function () { return RecoveryContactsDocument_1.RECOVERY_CONTACTS_MIN; } });
|
|
17
|
+
Object.defineProperty(exports, "isRecoveryContactsDocId", { enumerable: true, get: function () { return RecoveryContactsDocument_1.isRecoveryContactsDocId; } });
|
|
18
|
+
Object.defineProperty(exports, "asRecoveryContactsPayload", { enumerable: true, get: function () { return RecoveryContactsDocument_1.asRecoveryContactsPayload; } });
|
|
19
|
+
Object.defineProperty(exports, "verifyRecoveryContactsDoc", { enumerable: true, get: function () { return RecoveryContactsDocument_1.verifyRecoveryContactsDoc; } });
|
|
20
|
+
Object.defineProperty(exports, "personalDocBelongsTo", { enumerable: true, get: function () { return RecoveryContactsDocument_1.personalDocBelongsTo; } });
|
|
21
|
+
var recoveryPackage_1 = require("./recoveryPackage");
|
|
22
|
+
Object.defineProperty(exports, "RECOVERY_PACKAGE_PREFIX", { enumerable: true, get: function () { return recoveryPackage_1.RECOVERY_PACKAGE_PREFIX; } });
|
|
23
|
+
Object.defineProperty(exports, "RecoveryPackageError", { enumerable: true, get: function () { return recoveryPackage_1.RecoveryPackageError; } });
|
|
24
|
+
Object.defineProperty(exports, "generateRecoveryPackagePassword", { enumerable: true, get: function () { return recoveryPackage_1.generateRecoveryPackagePassword; } });
|
|
25
|
+
Object.defineProperty(exports, "normalizeRecoveryPackagePassword", { enumerable: true, get: function () { return recoveryPackage_1.normalizeRecoveryPackagePassword; } });
|
|
26
|
+
Object.defineProperty(exports, "encryptRecoveryHelperPackage", { enumerable: true, get: function () { return recoveryPackage_1.encryptRecoveryHelperPackage; } });
|
|
27
|
+
Object.defineProperty(exports, "decryptRecoveryHelperPackage", { enumerable: true, get: function () { return recoveryPackage_1.decryptRecoveryHelperPackage; } });
|
|
28
|
+
Object.defineProperty(exports, "extractRecoveryPackageText", { enumerable: true, get: function () { return recoveryPackage_1.extractRecoveryPackageText; } });
|
|
29
|
+
Object.defineProperty(exports, "combineRecoveryHelperPackages", { enumerable: true, get: function () { return recoveryPackage_1.combineRecoveryHelperPackages; } });
|
|
30
|
+
var RecoveryContactsManager_1 = require("./RecoveryContactsManager");
|
|
31
|
+
Object.defineProperty(exports, "RecoveryContactsError", { enumerable: true, get: function () { return RecoveryContactsManager_1.RecoveryContactsError; } });
|
|
32
|
+
Object.defineProperty(exports, "rescueAttestationHolds", { enumerable: true, get: function () { return RecoveryContactsManager_1.rescueAttestationHolds; } });
|
|
33
|
+
var recoverWithContacts_1 = require("./recoverWithContacts");
|
|
34
|
+
Object.defineProperty(exports, "RecoveryError", { enumerable: true, get: function () { return recoverWithContacts_1.RecoveryError; } });
|
|
35
|
+
Object.defineProperty(exports, "certifyDeviceWithRescueDevice", { enumerable: true, get: function () { return recoverWithContacts_1.certifyDeviceWithRescueDevice; } });
|
|
36
|
+
Object.defineProperty(exports, "approveDeviceWithRescueDevice", { enumerable: true, get: function () { return recoverWithContacts_1.approveDeviceWithRescueDevice; } });
|
|
37
|
+
var PaperRescueDevice_1 = require("./PaperRescueDevice");
|
|
38
|
+
Object.defineProperty(exports, "PAPER_RESCUE_DOC_ID_PREFIX", { enumerable: true, get: function () { return PaperRescueDevice_1.PAPER_RESCUE_DOC_ID_PREFIX; } });
|
|
39
|
+
Object.defineProperty(exports, "PAPER_RESCUE_TYPE", { enumerable: true, get: function () { return PaperRescueDevice_1.PAPER_RESCUE_TYPE; } });
|
|
40
|
+
Object.defineProperty(exports, "PAPER_RESCUE_SCHEMA_VERSION", { enumerable: true, get: function () { return PaperRescueDevice_1.PAPER_RESCUE_SCHEMA_VERSION; } });
|
|
41
|
+
Object.defineProperty(exports, "openPaperRescueSecret", { enumerable: true, get: function () { return PaperRescueDevice_1.openPaperRescueSecret; } });
|
|
42
|
+
Object.defineProperty(exports, "verifyPaperRescueDoc", { enumerable: true, get: function () { return PaperRescueDevice_1.verifyPaperRescueDoc; } });
|
|
43
|
+
var rescueApproval_1 = require("./rescueApproval");
|
|
44
|
+
Object.defineProperty(exports, "rescueAttestationMessage", { enumerable: true, get: function () { return rescueApproval_1.rescueAttestationMessage; } });
|
|
45
|
+
Object.defineProperty(exports, "rescueDeviceJoinRequestUri", { enumerable: true, get: function () { return rescueApproval_1.rescueDeviceJoinRequestUri; } });
|
|
46
|
+
Object.defineProperty(exports, "isRescueDeviceRef", { enumerable: true, get: function () { return rescueApproval_1.isRescueDeviceRef; } });
|
|
47
|
+
Object.defineProperty(exports, "rescueApprovalOf", { enumerable: true, get: function () { return rescueApproval_1.rescueApprovalOf; } });
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/recovery/index.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAA7C,qGAAA,WAAW,OAAA;AAAE,uGAAA,aAAa,OAAA;AACnC,+CAOwB;AANtB,oHAAA,oBAAoB,OAAA;AACpB,gHAAA,gBAAgB,OAAA;AAChB,kHAAA,kBAAkB,OAAA;AAKpB,uEAaoC;AAZlC,2IAAA,+BAA+B,OAAA;AAC/B,kIAAA,sBAAsB,OAAA;AACtB,4IAAA,gCAAgC,OAAA;AAChC,uIAAA,2BAA2B,OAAA;AAC3B,iIAAA,qBAAqB,OAAA;AACrB,mIAAA,uBAAuB,OAAA;AACvB,qIAAA,yBAAyB,OAAA;AACzB,qIAAA,yBAAyB,OAAA;AACzB,gIAAA,oBAAoB,OAAA;AAKtB,qDAW2B;AAVzB,0HAAA,uBAAuB,OAAA;AACvB,uHAAA,oBAAoB,OAAA;AACpB,kIAAA,+BAA+B,OAAA;AAC/B,mIAAA,gCAAgC,OAAA;AAChC,+HAAA,4BAA4B,OAAA;AAC5B,+HAAA,4BAA4B,OAAA;AAC5B,6HAAA,0BAA0B,OAAA;AAC1B,gIAAA,6BAA6B,OAAA;AAI/B,qEAQmC;AAPjC,gIAAA,qBAAqB,OAAA;AACrB,iIAAA,sBAAsB,OAAA;AAOxB,6DAM+B;AAL7B,oHAAA,aAAa,OAAA;AACb,oIAAA,6BAA6B,OAAA;AAC7B,oIAAA,6BAA6B,OAAA;AAI/B,yDAU6B;AAT3B,+HAAA,0BAA0B,OAAA;AAC1B,sHAAA,iBAAiB,OAAA;AACjB,gIAAA,2BAA2B,OAAA;AAC3B,0HAAA,qBAAqB,OAAA;AACrB,yHAAA,oBAAoB,OAAA;AAMtB,mDAQ0B;AAPxB,0HAAA,wBAAwB,OAAA;AACxB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,kHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CryptoAdapter } from "../crypto/CryptoAdapter";
|
|
2
|
+
import { type ContentAddressedStoreFactory } from "../types";
|
|
3
|
+
import type { CombinedRecoveryPackages } from "./recoveryPackage";
|
|
4
|
+
export declare class RecoveryError extends Error {
|
|
5
|
+
readonly code: "no-server" | "tenant-not-found" | "not-certified" | "sync-failed" | "device-not-on-grant";
|
|
6
|
+
constructor(code: "no-server" | "tenant-not-found" | "not-certified" | "sync-failed" | "device-not-on-grant", message: string);
|
|
7
|
+
}
|
|
8
|
+
export interface CertifyDeviceWithRescueDeviceInput {
|
|
9
|
+
cryptoAdapter: CryptoAdapter;
|
|
10
|
+
/** From the combined packages. */
|
|
11
|
+
recovery: CombinedRecoveryPackages;
|
|
12
|
+
/** Overrides `recovery.serverUrl` (the packages may not carry one). */
|
|
13
|
+
serverUrl?: string;
|
|
14
|
+
/** Public keys of the new device. */
|
|
15
|
+
device: {
|
|
16
|
+
signingPublicKey: string;
|
|
17
|
+
encryptionPublicKey: string;
|
|
18
|
+
};
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Storage for the throwaway rescue session. Default: in memory. */
|
|
21
|
+
storeFactory?: ContentAddressedStoreFactory;
|
|
22
|
+
}
|
|
23
|
+
export interface CertifyDeviceWithRescueDeviceResult {
|
|
24
|
+
tenantId: string;
|
|
25
|
+
serverUrl: string;
|
|
26
|
+
username: string;
|
|
27
|
+
certificateDocId: string;
|
|
28
|
+
/** The rescue device that issued it, to withdraw once the new device is set up. */
|
|
29
|
+
rescueSigningKeyFingerprint: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Certify a new device of the person with the rescue device that the
|
|
33
|
+
* combined helper packages opened.
|
|
34
|
+
*/
|
|
35
|
+
export declare function certifyDeviceWithRescueDevice(input: CertifyDeviceWithRescueDeviceInput): Promise<CertifyDeviceWithRescueDeviceResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Recovery with an admin-approved rescue device (docs/userkeys.md §12.9): the
|
|
38
|
+
* new device has joined with a normal join request and the administrator put
|
|
39
|
+
* it on the person's grant. The rescue device, which holds the User-Key, now
|
|
40
|
+
* wraps it to the new device. Fails with `device-not-on-grant` while the
|
|
41
|
+
* administrator has not approved the new device yet — call again later.
|
|
42
|
+
*/
|
|
43
|
+
export declare function approveDeviceWithRescueDevice(input: {
|
|
44
|
+
cryptoAdapter: CryptoAdapter;
|
|
45
|
+
recovery: CombinedRecoveryPackages;
|
|
46
|
+
serverUrl?: string;
|
|
47
|
+
/** Encryption public key of the new device. */
|
|
48
|
+
deviceEncryptionPublicKey: string;
|
|
49
|
+
storeFactory?: ContentAddressedStoreFactory;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
tenantId: string;
|
|
52
|
+
serverUrl: string;
|
|
53
|
+
username: string;
|
|
54
|
+
rescueSigningKeyFingerprint: string;
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=recoverWithContacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoverWithContacts.d.ts","sourceRoot":"","sources":["../../../src/core/recovery/recoverWithContacts.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CA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