selfstore 1.8.32 → 1.8.34
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/dist/advanced.d.ts +9 -9
- package/dist/advanced.js +5 -5
- package/dist/backups.d.ts +4 -4
- package/dist/backups.js +3 -3
- package/dist/{cache-BEv-Har2.d.ts → cache-D8Z4u5Jz.d.ts} +0 -2
- package/dist/{chunk-GSZSZGSD.js → chunk-A2RRJLIF.js} +3 -3
- package/dist/{chunk-GSZSZGSD.js.map → chunk-A2RRJLIF.js.map} +1 -1
- package/dist/chunk-DJ6YPMBK.js +10 -0
- package/dist/chunk-DJ6YPMBK.js.map +1 -0
- package/dist/{chunk-7U5XMKVP.js → chunk-E4S77JSN.js} +34 -6
- package/dist/chunk-E4S77JSN.js.map +1 -0
- package/dist/{chunk-TB3CKC6Z.js → chunk-HQSK7HK3.js} +38 -16
- package/dist/chunk-HQSK7HK3.js.map +1 -0
- package/dist/{chunk-25U6AKIX.js → chunk-IUVOVVEA.js} +26 -15
- package/dist/chunk-IUVOVVEA.js.map +1 -0
- package/dist/{chunk-5DAPYC2K.js → chunk-MDEEAQSU.js} +3 -3
- package/dist/{chunk-5DAPYC2K.js.map → chunk-MDEEAQSU.js.map} +1 -1
- package/dist/{chunk-JDDWWQEB.js → chunk-TNYL6FNW.js} +6 -6
- package/dist/{chunk-JDDWWQEB.js.map → chunk-TNYL6FNW.js.map} +1 -1
- package/dist/{chunk-HRYIQSTH.js → chunk-VRWAV3GI.js} +5 -5
- package/dist/{chunk-HRYIQSTH.js.map → chunk-VRWAV3GI.js.map} +1 -1
- package/dist/{chunk-Q3NO477P.js → chunk-XAONTUEC.js} +3 -3
- package/dist/{chunk-Q3NO477P.js.map → chunk-XAONTUEC.js.map} +1 -1
- package/dist/{connect-CDazV36v.d.ts → connect-B9f58dFZ.d.ts} +4 -4
- package/dist/{drive-CwlKlowN.d.ts → drive-D5YLXmp_.d.ts} +2 -2
- package/dist/flows.d.ts +4 -4
- package/dist/flows.js +4 -4
- package/dist/groups.d.ts +2 -2
- package/dist/index.d.ts +9 -9
- package/dist/index.js +45 -43
- package/dist/index.js.map +1 -1
- package/dist/{local-DytMg5GC.d.ts → local-CmS0xFkK.d.ts} +2 -2
- package/dist/{local-S3WUZSDX.js → local-D72LJOKX.js} +4 -4
- package/dist/{local-S3WUZSDX.js.map → local-D72LJOKX.js.map} +1 -1
- package/dist/{manager-CnlIs-hY.d.ts → manager-DCV_7B6M.d.ts} +2 -2
- package/dist/{manager-drive-T3RXUWAY.js → manager-drive-TEYNJVUU.js} +5 -5
- package/dist/{manager-drive-T3RXUWAY.js.map → manager-drive-TEYNJVUU.js.map} +1 -1
- package/dist/proof.d.ts +10 -6
- package/dist/proof.js +22 -3
- package/dist/proof.js.map +1 -1
- package/dist/{s3-ORDHS7G3.js → s3-KZPMSI4J.js} +3 -3
- package/dist/s3-KZPMSI4J.js.map +1 -0
- package/dist/{s3-Bexn9kzT.d.ts → s3-mHLrEywJ.d.ts} +2 -2
- package/dist/{simple-cLzoTGhN.d.ts → simple-Bnh2j78j.d.ts} +6 -6
- package/dist/{store-DSPbCCtM.d.ts → store-DSvZwwr1.d.ts} +11 -3
- package/dist/sync.js +1 -1
- package/dist/{webdav-PXKELPA4.js → webdav-5YKO47EE.js} +3 -3
- package/dist/{webdav-PXKELPA4.js.map → webdav-5YKO47EE.js.map} +1 -1
- package/dist/widgets.d.ts +5 -5
- package/dist/widgets.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-25U6AKIX.js.map +0 -1
- package/dist/chunk-7U5XMKVP.js.map +0 -1
- package/dist/chunk-SJ3PKQPR.js +0 -10
- package/dist/chunk-SJ3PKQPR.js.map +0 -1
- package/dist/chunk-TB3CKC6Z.js.map +0 -1
- package/dist/s3-ORDHS7G3.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createNode, createMeta, gcTombstones, stamp, merge, unsyncableCounts, idPathFor, detectConflicts, changes } from './chunk-
|
|
2
|
-
import { inspect, checkPasswordPolicy, writeBox, BACKUP_MIME, readBoxWithSync, asBytes } from './chunk-
|
|
1
|
+
import { createNode, createMeta, gcTombstones, stamp, merge, unsyncableCounts, idPathFor, detectConflicts, changes } from './chunk-A2RRJLIF.js';
|
|
2
|
+
import { inspect, checkPasswordPolicy, writeBox, BACKUP_MIME, readBoxWithSync, asBytes } from './chunk-E4S77JSN.js';
|
|
3
3
|
import { seal, isEnvelope, unseal, newDeviceKey } from './chunk-QBCU7OOP.js';
|
|
4
4
|
import { openManifest, GROUP_KEYING } from './chunk-F4ZZEJ5H.js';
|
|
5
5
|
import { mintSlot, MAX_KEY_SLOTS, mintExternalSlot, openSlot } from './chunk-H2T4S3KM.js';
|
|
@@ -253,8 +253,12 @@ function createLocalStore(opts) {
|
|
|
253
253
|
subs.forEach((f) => f());
|
|
254
254
|
};
|
|
255
255
|
const locked = () => durableKind() && encrypted && !pass && !envelope && !group;
|
|
256
|
-
const ownGroupRead = () => group ? { identity: group.identity, authors: [group.identity.sigPub] } : void 0;
|
|
257
|
-
const peerGroupRead = () => group ? {
|
|
256
|
+
const ownGroupRead = () => group ? { identity: group.identity, authors: [group.identity.sigPub], group: group.manifest.group } : void 0;
|
|
257
|
+
const peerGroupRead = () => group ? {
|
|
258
|
+
identity: group.identity,
|
|
259
|
+
authors: group.manifest.members.map((m) => m.sig),
|
|
260
|
+
group: group.manifest.group
|
|
261
|
+
} : void 0;
|
|
258
262
|
const groupSeqKey = (id) => `groupSeq:${id}`;
|
|
259
263
|
async function persistGroupSeq(id, seq) {
|
|
260
264
|
await kv.set(groupSeqKey(id), seq);
|
|
@@ -349,7 +353,8 @@ function createLocalStore(opts) {
|
|
|
349
353
|
recipients: [
|
|
350
354
|
.../* @__PURE__ */ new Set([...group.manifest.members.map((m) => m.enc), group.identity.encPub])
|
|
351
355
|
],
|
|
352
|
-
sign: { pub: group.identity.sigPub, priv: group.identity.sigPriv }
|
|
356
|
+
sign: { pub: group.identity.sigPub, priv: group.identity.sigPriv },
|
|
357
|
+
id: group.manifest.group
|
|
353
358
|
} : void 0;
|
|
354
359
|
const bytes = await writeBox(
|
|
355
360
|
{ collections: snap.collections, files: snap.files },
|
|
@@ -1894,6 +1899,24 @@ function memoryCache() {
|
|
|
1894
1899
|
var COLLECTIONS_KEY = "__collections";
|
|
1895
1900
|
var DEVICE_KEY = "__deviceKey";
|
|
1896
1901
|
var CACHE_KDF = "__cacheKdf";
|
|
1902
|
+
async function sealFile(k, meta, bytes) {
|
|
1903
|
+
const sealedMeta = await seal(k, new TextEncoder().encode(JSON.stringify(meta)));
|
|
1904
|
+
return { meta: sealedMeta, ...await seal(k, bytes) };
|
|
1905
|
+
}
|
|
1906
|
+
async function openFileMeta(k, v) {
|
|
1907
|
+
if (!("meta" in v)) return { name: v.name, mime: v.mime };
|
|
1908
|
+
if (!isEnvelope(v.meta)) {
|
|
1909
|
+
throw new SelfstoreError("BAD_FORMAT", "Unrecognized cache record (not a sealed envelope).");
|
|
1910
|
+
}
|
|
1911
|
+
const meta = JSON.parse(new TextDecoder().decode(await unseal(k, v.meta)));
|
|
1912
|
+
if (typeof meta.name !== "string" || typeof meta.mime !== "string") {
|
|
1913
|
+
throw new SelfstoreError(
|
|
1914
|
+
"BAD_FORMAT",
|
|
1915
|
+
"Unrecognized cache record (file name or type missing)."
|
|
1916
|
+
);
|
|
1917
|
+
}
|
|
1918
|
+
return { name: meta.name, mime: meta.mime };
|
|
1919
|
+
}
|
|
1897
1920
|
function indexedDbCache(name, opts) {
|
|
1898
1921
|
let _db = null;
|
|
1899
1922
|
const db = () => _db ??= openDB(name, 1, {
|
|
@@ -1930,8 +1953,10 @@ function indexedDbCache(name, opts) {
|
|
|
1930
1953
|
if (!isEnvelope(v)) {
|
|
1931
1954
|
throw new SelfstoreError("BAD_FORMAT", "Unrecognized cache record (not a sealed envelope).");
|
|
1932
1955
|
}
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1956
|
+
const k = await key();
|
|
1957
|
+
const { name: name2, mime } = await openFileMeta(k, v);
|
|
1958
|
+
const bytes = await unseal(k, v);
|
|
1959
|
+
return { name: name2, mime, blob: new Blob([bytes], { type: mime }) };
|
|
1935
1960
|
}
|
|
1936
1961
|
const kv = {
|
|
1937
1962
|
async get(key2) {
|
|
@@ -1978,8 +2003,8 @@ function indexedDbCache(name, opts) {
|
|
|
1978
2003
|
const k = await key();
|
|
1979
2004
|
const fresh = await Promise.all(
|
|
1980
2005
|
files.filter((f) => !have.has(f.id)).map(async (f) => {
|
|
1981
|
-
const
|
|
1982
|
-
return { id: f.id, rec: { name: f.name, mime: f.mime,
|
|
2006
|
+
const bytes = new Uint8Array(await f.blob.arrayBuffer());
|
|
2007
|
+
return { id: f.id, rec: await sealFile(k, { name: f.name, mime: f.mime }, bytes) };
|
|
1983
2008
|
})
|
|
1984
2009
|
);
|
|
1985
2010
|
const tx = d.transaction("files", "readwrite");
|
|
@@ -2031,11 +2056,8 @@ function indexedDbCache(name, opts) {
|
|
|
2031
2056
|
for (const fileKey of await d.getAllKeys("files")) {
|
|
2032
2057
|
const v = await d.get("files", fileKey);
|
|
2033
2058
|
if (!v) continue;
|
|
2034
|
-
const
|
|
2035
|
-
files.push({
|
|
2036
|
-
id: fileKey,
|
|
2037
|
-
rec: { name: v.name, mime: v.mime, ...await seal(next, bytes) }
|
|
2038
|
-
});
|
|
2059
|
+
const meta = await openFileMeta(previous, v);
|
|
2060
|
+
files.push({ id: fileKey, rec: await sealFile(next, meta, await unseal(previous, v)) });
|
|
2039
2061
|
}
|
|
2040
2062
|
const tx = d.transaction(["kv", "files"], "readwrite");
|
|
2041
2063
|
const store = tx.objectStore("kv");
|
|
@@ -2203,5 +2225,5 @@ function gisDriveAuth(opts) {
|
|
|
2203
2225
|
}
|
|
2204
2226
|
|
|
2205
2227
|
export { RESERVED_STORE_MODES, createLocalStore, deriveStatus, gisDriveAuth, indexedDbCache, isLockableCache, isReservedStoreMode, memoryCache, preloadGoogleIdentity };
|
|
2206
|
-
//# sourceMappingURL=chunk-
|
|
2207
|
-
//# sourceMappingURL=chunk-
|
|
2228
|
+
//# sourceMappingURL=chunk-HQSK7HK3.js.map
|
|
2229
|
+
//# sourceMappingURL=chunk-HQSK7HK3.js.map
|