@jwilleke/ngdpbase-types 5.37.0 → 5.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/packages/ngdpbase-types/index.d.ts +2 -1
- package/lib/src/ice/ledger.d.ts +2 -0
- package/lib/src/ice/runImport.d.ts +6 -0
- package/lib/src/ice/shims/csv.d.ts +59 -0
- package/lib/src/ice/shims/dotpath.d.ts +7 -0
- package/lib/src/ice/shims/geojson.d.ts +19 -0
- package/lib/src/ice/shims/index.d.ts +16 -0
- package/lib/src/ice/shims/record.d.ts +68 -0
- package/lib/src/ice/shims/restjson.d.ts +14 -0
- package/lib/src/ice/shims/rss-atom.d.ts +22 -0
- package/lib/src/ice/shims/xml-index.d.ts +32 -0
- package/lib/src/ice/shims/xml.d.ts +30 -0
- package/lib/src/ice/types.d.ts +109 -7
- package/lib/src/managers/AddonsManager.d.ts +50 -6
- package/lib/src/managers/BackupManager.d.ts +20 -2
- package/lib/src/managers/BackupManager.js +39 -6
- package/lib/src/managers/ConsentManager.d.ts +19 -3
- package/lib/src/managers/ImportManager.d.ts +36 -1
- package/lib/src/managers/PageManager.d.ts +53 -3
- package/lib/src/managers/ShareManager.d.ts +27 -0
- package/lib/src/managers/ValidationManager.d.ts +27 -16
- package/lib/src/security/permissions.generated.d.ts +2 -0
- package/lib/src/types/Consent.d.ts +43 -1
- package/lib/src/types/Consent.js +34 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +8 -0
- package/lib/src/utils/auditEventNames.generated.js +8 -0
- package/lib/src/utils/privateStoreCrypto.d.ts +10 -2
- package/lib/src/utils/privateStoreUnlock.d.ts +2 -0
- package/lib/src/utils/shareLockbox.d.ts +1 -1
- package/lib/src/utils/sharedFoldersKey.d.ts +17 -0
- package/lib/src/utils/sharedFoldersKey.js +33 -0
- package/package.json +2 -1
|
@@ -52,6 +52,8 @@ export declare function unlockPrivateStoresWithMnemonic(args: {
|
|
|
52
52
|
}): Promise<boolean>;
|
|
53
53
|
/** Whether `username` has keys at all, i.e. a store that can be encrypted. */
|
|
54
54
|
export declare function hasUserKeys(pagesDirectory: string, username: string): Promise<boolean>;
|
|
55
|
+
/** Which set of recovery words `username` has (#1928, `recoveryWordsId`), or null when they have no keys. */
|
|
56
|
+
export declare function recoveryWordsIdOf(pagesDirectory: string, username: string): Promise<string | null>;
|
|
55
57
|
/**
|
|
56
58
|
* The public half of `username`'s key pair (#1762 slice 5), or null when they
|
|
57
59
|
* have no keys or no pair yet. Public: anyone may seal to it.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* recipient's browser opens each lockbox with the private key from the link.
|
|
12
12
|
*
|
|
13
13
|
* The algorithm is WebCrypto's own, so the server (Node's `crypto.webcrypto`)
|
|
14
|
-
* and the browser (`window.crypto.subtle`, public/
|
|
14
|
+
* and the browser (`window.crypto.subtle`, public/share/_assets/share-viewer.js) run the
|
|
15
15
|
* same steps: ECDH on P-256 between a fresh ephemeral key and the link's key,
|
|
16
16
|
* HKDF-SHA-256 over the shared secret, AES-256-GCM over the content.
|
|
17
17
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The environment variable holding the shared-folders key. Never a config key: config is readable from the admin screens. */
|
|
2
|
+
export declare const SHARED_FOLDERS_KEY_ENV = "NGDPBASE_SHARED_FOLDERS_KEY";
|
|
3
|
+
/** The shared-folders key as set now, trimmed; '' when there is none. Never logged. */
|
|
4
|
+
export declare function currentSharedFoldersKey(): string;
|
|
5
|
+
/**
|
|
6
|
+
* A short fingerprint of the shared-folders key: the first 16 hex digits of an
|
|
7
|
+
* HMAC of a fixed label under the key, as for the backup key. Shown on Admin →
|
|
8
|
+
* Backup and recorded with the wrapped folder keys, so a different key says so
|
|
9
|
+
* plainly; it never reveals the key.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sharedFoldersKeyFingerprint(key: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* The 32-byte key the folder keys are wrapped under, derived from the `.env`
|
|
14
|
+
* value (HKDF-SHA256, one HMAC round: cheap, never a stall). Derived, not
|
|
15
|
+
* decoded, so a value an operator set themselves in any form still works.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sharedFoldersWrapKey(key: string): Buffer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared-folders key (#2124, epic #1775 decision 1): the organization's
|
|
3
|
+
* server-held key, `NGDPBASE_SHARED_FOLDERS_KEY`, in the instance `.env`
|
|
4
|
+
* beside the backup, database and credentials keys. Generated on first start
|
|
5
|
+
* (`bootstrap-env.ts`), read at startup by SharedFolderManager, which wraps
|
|
6
|
+
* every shared folder's own key under it. One declaration here, with no
|
|
7
|
+
* dependencies, so the boot can name it without loading the manager, and
|
|
8
|
+
* BackupManager can fingerprint it for the "saved off the server" check.
|
|
9
|
+
*/
|
|
10
|
+
import { createHmac, hkdfSync } from 'node:crypto';
|
|
11
|
+
/** The environment variable holding the shared-folders key. Never a config key: config is readable from the admin screens. */
|
|
12
|
+
export const SHARED_FOLDERS_KEY_ENV = 'NGDPBASE_SHARED_FOLDERS_KEY';
|
|
13
|
+
/** The shared-folders key as set now, trimmed; '' when there is none. Never logged. */
|
|
14
|
+
export function currentSharedFoldersKey() {
|
|
15
|
+
return (process.env[SHARED_FOLDERS_KEY_ENV] ?? '').trim();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A short fingerprint of the shared-folders key: the first 16 hex digits of an
|
|
19
|
+
* HMAC of a fixed label under the key, as for the backup key. Shown on Admin →
|
|
20
|
+
* Backup and recorded with the wrapped folder keys, so a different key says so
|
|
21
|
+
* plainly; it never reveals the key.
|
|
22
|
+
*/
|
|
23
|
+
export function sharedFoldersKeyFingerprint(key) {
|
|
24
|
+
return createHmac('sha256', key).update('ngdpbase shared folders key fingerprint v1').digest('hex').slice(0, 16);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The 32-byte key the folder keys are wrapped under, derived from the `.env`
|
|
28
|
+
* value (HKDF-SHA256, one HMAC round: cheap, never a stall). Derived, not
|
|
29
|
+
* decoded, so a value an operator set themselves in any form still works.
|
|
30
|
+
*/
|
|
31
|
+
export function sharedFoldersWrapKey(key) {
|
|
32
|
+
return Buffer.from(hkdfSync('sha256', key, Buffer.alloc(0), 'ngdpbase shared folders wrap key v1', 32));
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jwilleke/ngdpbase-types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.39.0",
|
|
4
4
|
"description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jim Willeke",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dotenv": "^18.0.9",
|
|
45
45
|
"express": "^5.3.0",
|
|
46
46
|
"express-session": "^1.19.0",
|
|
47
|
+
"fast-xml-parser": "^5.11.2",
|
|
47
48
|
"fs-extra": "^11.4.1",
|
|
48
49
|
"ipaddr.js": "^2.5.0",
|
|
49
50
|
"jose": "^6.2.13",
|