selfstore 1.8.1 → 1.8.2
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.md +5 -0
- package/dist/advanced.d.ts +5 -5
- package/dist/advanced.js +7 -7
- package/dist/backups.d.ts +1 -1
- package/dist/backups.js +2 -2
- package/dist/{cache-lock-7D6N42ZP.js → cache-lock-RCN3JJ4Q.js} +4 -4
- package/dist/{cache-lock-7D6N42ZP.js.map → cache-lock-RCN3JJ4Q.js.map} +1 -1
- package/dist/{chunk-CT2HTWA7.js → chunk-453KRCMM.js} +4 -4
- package/dist/{chunk-CT2HTWA7.js.map → chunk-453KRCMM.js.map} +1 -1
- package/dist/{chunk-XBPJRUA3.js → chunk-5NS7YQNP.js} +18 -10
- package/dist/chunk-5NS7YQNP.js.map +1 -0
- package/dist/{chunk-ZV2S3I76.js → chunk-7N2YR3QW.js} +31 -10
- package/dist/chunk-7N2YR3QW.js.map +1 -0
- package/dist/{chunk-ZDHTKFAL.js → chunk-BNDFMU3J.js} +6 -6
- package/dist/{chunk-ZDHTKFAL.js.map → chunk-BNDFMU3J.js.map} +1 -1
- package/dist/{chunk-SFF7KKM4.js → chunk-CPN2KUD5.js} +2 -2
- package/dist/chunk-CPN2KUD5.js.map +1 -0
- package/dist/{chunk-53WWPEML.js → chunk-HDR75TQ7.js} +3 -3
- package/dist/{chunk-53WWPEML.js.map → chunk-HDR75TQ7.js.map} +1 -1
- package/dist/{chunk-CM3HSBCE.js → chunk-HK4VPO65.js} +3 -3
- package/dist/{chunk-CM3HSBCE.js.map → chunk-HK4VPO65.js.map} +1 -1
- package/dist/{chunk-OZS7BSC2.js → chunk-JMJZIZKY.js} +19 -6
- package/dist/chunk-JMJZIZKY.js.map +1 -0
- package/dist/{chunk-OIAXYI35.js → chunk-U5F4GI7C.js} +3 -3
- package/dist/{chunk-OIAXYI35.js.map → chunk-U5F4GI7C.js.map} +1 -1
- package/dist/{drive-DF08V8-L.d.ts → drive-l_4-m1eT.d.ts} +1 -1
- package/dist/{flows-dwgDgv6_.d.ts → flows-C_uookek.d.ts} +2 -2
- package/dist/flows.d.ts +3 -3
- package/dist/flows.js +8 -8
- package/dist/groups.js +4 -4
- package/dist/households.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +18 -12
- package/dist/index.js.map +1 -1
- package/dist/local-2YREU4Q2.js +7 -0
- package/dist/{local-5QN7V24I.js.map → local-2YREU4Q2.js.map} +1 -1
- package/dist/{local-ipQv_Pbv.d.ts → local-bfv4Ld7s.d.ts} +2 -2
- package/dist/{store-CbGrlMME.d.ts → store-BiQ-BuVl.d.ts} +8 -2
- package/dist/widgets.d.ts +3 -3
- package/dist/widgets.js +11 -9
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-OZS7BSC2.js.map +0 -1
- package/dist/chunk-SFF7KKM4.js.map +0 -1
- package/dist/chunk-XBPJRUA3.js.map +0 -1
- package/dist/chunk-ZV2S3I76.js.map +0 -1
- package/dist/local-5QN7V24I.js +0 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createNode, createMeta, gcTombstones, stamp, merge, unsyncableCounts, idPathFor, detectConflicts, changes } from './chunk-SKWHKM25.js';
|
|
2
|
-
import { inspect, checkPasswordPolicy, writeBox, BACKUP_MIME, readBoxWithSync, asBytes } from './chunk-
|
|
3
|
-
import { openManifest, GROUP_KEYING } from './chunk-
|
|
2
|
+
import { inspect, checkPasswordPolicy, writeBox, BACKUP_MIME, readBoxWithSync, asBytes } from './chunk-BNDFMU3J.js';
|
|
3
|
+
import { openManifest, GROUP_KEYING } from './chunk-453KRCMM.js';
|
|
4
4
|
import { seal, isEnvelope, unseal, newDeviceKey } from './chunk-QBCU7OOP.js';
|
|
5
|
-
import { mintSlot, MAX_KEY_SLOTS, mintExternalSlot, openSlot } from './chunk-
|
|
6
|
-
import { SelfstoreError, isAuthExpired, errorLabelKey, isSelfstoreError } from './chunk-
|
|
5
|
+
import { mintSlot, MAX_KEY_SLOTS, mintExternalSlot, openSlot } from './chunk-HK4VPO65.js';
|
|
6
|
+
import { SelfstoreError, isAuthExpired, errorLabelKey, isSelfstoreError } from './chunk-CPN2KUD5.js';
|
|
7
7
|
import { openDB } from 'idb';
|
|
8
8
|
|
|
9
9
|
// src/persistence/target.ts
|
|
@@ -172,6 +172,15 @@ function createLocalStore(opts) {
|
|
|
172
172
|
let queuedKind = null;
|
|
173
173
|
let prefetched = null;
|
|
174
174
|
const PREFETCH_TTL_MS = 6e4;
|
|
175
|
+
async function remoteAppOf(target) {
|
|
176
|
+
try {
|
|
177
|
+
const blob = prefetched && prefetched.target === target ? prefetched.blob : await target.load();
|
|
178
|
+
if (!blob || blob.size === 0) return null;
|
|
179
|
+
return (await inspect(blob)).app ?? null;
|
|
180
|
+
} catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
175
184
|
const peerList = [];
|
|
176
185
|
const mirrorList = [];
|
|
177
186
|
const replicaList = [];
|
|
@@ -973,6 +982,7 @@ function createLocalStore(opts) {
|
|
|
973
982
|
}
|
|
974
983
|
stateSnapshot = buildState();
|
|
975
984
|
return {
|
|
985
|
+
app,
|
|
976
986
|
get state() {
|
|
977
987
|
return stateSnapshot;
|
|
978
988
|
},
|
|
@@ -1129,6 +1139,13 @@ function createLocalStore(opts) {
|
|
|
1129
1139
|
}
|
|
1130
1140
|
if (attachOpts?.password) assertPasswordPolicy(attachOpts.password);
|
|
1131
1141
|
return serialize(async () => {
|
|
1142
|
+
const remoteApp = await remoteAppOf(target);
|
|
1143
|
+
if (remoteApp !== null && remoteApp !== app) {
|
|
1144
|
+
throw new SelfstoreError(
|
|
1145
|
+
"FOREIGN_BACKUP",
|
|
1146
|
+
`attachTarget(): the destination holds a backup written by app "${remoteApp}", not "${app}". Open it in its own application, or pick another file.`
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1132
1149
|
const g = cfg ? {
|
|
1133
1150
|
identity: cfg.identity,
|
|
1134
1151
|
admin: cfg.admin,
|
|
@@ -1186,7 +1203,8 @@ function createLocalStore(opts) {
|
|
|
1186
1203
|
},
|
|
1187
1204
|
async inspectTarget(target) {
|
|
1188
1205
|
const blob = await target.load();
|
|
1189
|
-
if (!blob || blob.size === 0)
|
|
1206
|
+
if (!blob || blob.size === 0)
|
|
1207
|
+
return { hasBackup: false, date: null, encrypted: false, app: null };
|
|
1190
1208
|
let marker;
|
|
1191
1209
|
try {
|
|
1192
1210
|
marker = target.stat ? await target.stat() : null;
|
|
@@ -1198,7 +1216,10 @@ function createLocalStore(opts) {
|
|
|
1198
1216
|
return {
|
|
1199
1217
|
hasBackup: true,
|
|
1200
1218
|
date: header.createdAt ?? null,
|
|
1201
|
-
encrypted: header.encryption !== "none"
|
|
1219
|
+
encrypted: header.encryption !== "none",
|
|
1220
|
+
// Required by the format since generation 1, but a hand-made file may
|
|
1221
|
+
// omit it: absent reads as "cannot tell", never as an accusation.
|
|
1222
|
+
app: header.app ?? null
|
|
1202
1223
|
};
|
|
1203
1224
|
},
|
|
1204
1225
|
setManualFile() {
|
|
@@ -1909,7 +1930,7 @@ function indexedDbCache(name, opts) {
|
|
|
1909
1930
|
sealKey = null;
|
|
1910
1931
|
},
|
|
1911
1932
|
async reseal(secret) {
|
|
1912
|
-
const { keyFromPassword, freshCacheKdf } = await import('./cache-lock-
|
|
1933
|
+
const { keyFromPassword, freshCacheKdf } = await import('./cache-lock-RCN3JJ4Q.js');
|
|
1913
1934
|
const previous = sealKey;
|
|
1914
1935
|
if (previous === null) {
|
|
1915
1936
|
throw new SelfstoreError(
|
|
@@ -1943,7 +1964,7 @@ function indexedDbCache(name, opts) {
|
|
|
1943
1964
|
sealKey = next;
|
|
1944
1965
|
},
|
|
1945
1966
|
async unlock(secret) {
|
|
1946
|
-
const { keyFromPassword, freshCacheKdf, opens } = await import('./cache-lock-
|
|
1967
|
+
const { keyFromPassword, freshCacheKdf, opens } = await import('./cache-lock-RCN3JJ4Q.js');
|
|
1947
1968
|
const d = await db();
|
|
1948
1969
|
let candidate;
|
|
1949
1970
|
if (typeof secret === "string") {
|
|
@@ -2050,5 +2071,5 @@ function gisDriveAuth(opts) {
|
|
|
2050
2071
|
}
|
|
2051
2072
|
|
|
2052
2073
|
export { RESERVED_STORE_MODES, createLocalStore, deriveStatus, gisDriveAuth, indexedDbCache, isLockableCache, isReservedStoreMode, memoryCache };
|
|
2053
|
-
//# sourceMappingURL=chunk-
|
|
2054
|
-
//# sourceMappingURL=chunk-
|
|
2074
|
+
//# sourceMappingURL=chunk-7N2YR3QW.js.map
|
|
2075
|
+
//# sourceMappingURL=chunk-7N2YR3QW.js.map
|