tablinum 0.6.2 → 0.6.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/dist/index.js +24 -7
- package/dist/svelte/index.svelte.js +24 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2082,23 +2082,40 @@ var EpochStoreLive = Layer3.effect(
|
|
|
2082
2082
|
const config = yield* Config;
|
|
2083
2083
|
const identity = yield* Identity;
|
|
2084
2084
|
const storage = yield* Storage;
|
|
2085
|
+
let idbStore;
|
|
2085
2086
|
const idbRaw = yield* storage.getMeta("epochs");
|
|
2086
2087
|
if (typeof idbRaw === "string") {
|
|
2087
|
-
const
|
|
2088
|
-
if (Option7.isSome(
|
|
2089
|
-
|
|
2090
|
-
source: "storage",
|
|
2091
|
-
epochs: idbStore.value.epochs.size
|
|
2092
|
-
});
|
|
2093
|
-
return idbStore.value;
|
|
2088
|
+
const parsed = deserializeEpochStore(idbRaw);
|
|
2089
|
+
if (Option7.isSome(parsed)) {
|
|
2090
|
+
idbStore = parsed.value;
|
|
2094
2091
|
}
|
|
2095
2092
|
}
|
|
2096
2093
|
if (config.epochKeys && config.epochKeys.length > 0) {
|
|
2094
|
+
if (idbStore) {
|
|
2095
|
+
const configIsSubset = config.epochKeys.every((ek) => {
|
|
2096
|
+
const existing = idbStore.epochs.get(ek.epochId);
|
|
2097
|
+
return existing !== void 0 && existing.privateKey === ek.key;
|
|
2098
|
+
});
|
|
2099
|
+
if (configIsSubset) {
|
|
2100
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2101
|
+
source: "storage",
|
|
2102
|
+
epochs: idbStore.epochs.size
|
|
2103
|
+
});
|
|
2104
|
+
return idbStore;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2097
2107
|
const store2 = createEpochStoreFromInputs(config.epochKeys);
|
|
2098
2108
|
yield* storage.putMeta("epochs", stringifyEpochStore(store2));
|
|
2099
2109
|
yield* Effect12.logInfo("Epoch store loaded", { source: "config", epochs: store2.epochs.size });
|
|
2100
2110
|
return store2;
|
|
2101
2111
|
}
|
|
2112
|
+
if (idbStore) {
|
|
2113
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2114
|
+
source: "storage",
|
|
2115
|
+
epochs: idbStore.epochs.size
|
|
2116
|
+
});
|
|
2117
|
+
return idbStore;
|
|
2118
|
+
}
|
|
2102
2119
|
const store = createEpochStoreFromInputs(
|
|
2103
2120
|
[{ epochId: EpochId("epoch-0"), key: bytesToHex3(generateSecretKey2()) }],
|
|
2104
2121
|
{ createdBy: identity.publicKey }
|
|
@@ -2119,23 +2119,40 @@ var EpochStoreLive = Layer3.effect(
|
|
|
2119
2119
|
const config = yield* Config;
|
|
2120
2120
|
const identity = yield* Identity;
|
|
2121
2121
|
const storage = yield* Storage;
|
|
2122
|
+
let idbStore;
|
|
2122
2123
|
const idbRaw = yield* storage.getMeta("epochs");
|
|
2123
2124
|
if (typeof idbRaw === "string") {
|
|
2124
|
-
const
|
|
2125
|
-
if (Option7.isSome(
|
|
2126
|
-
|
|
2127
|
-
source: "storage",
|
|
2128
|
-
epochs: idbStore.value.epochs.size
|
|
2129
|
-
});
|
|
2130
|
-
return idbStore.value;
|
|
2125
|
+
const parsed = deserializeEpochStore(idbRaw);
|
|
2126
|
+
if (Option7.isSome(parsed)) {
|
|
2127
|
+
idbStore = parsed.value;
|
|
2131
2128
|
}
|
|
2132
2129
|
}
|
|
2133
2130
|
if (config.epochKeys && config.epochKeys.length > 0) {
|
|
2131
|
+
if (idbStore) {
|
|
2132
|
+
const configIsSubset = config.epochKeys.every((ek) => {
|
|
2133
|
+
const existing = idbStore.epochs.get(ek.epochId);
|
|
2134
|
+
return existing !== void 0 && existing.privateKey === ek.key;
|
|
2135
|
+
});
|
|
2136
|
+
if (configIsSubset) {
|
|
2137
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2138
|
+
source: "storage",
|
|
2139
|
+
epochs: idbStore.epochs.size
|
|
2140
|
+
});
|
|
2141
|
+
return idbStore;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2134
2144
|
const store2 = createEpochStoreFromInputs(config.epochKeys);
|
|
2135
2145
|
yield* storage.putMeta("epochs", stringifyEpochStore(store2));
|
|
2136
2146
|
yield* Effect12.logInfo("Epoch store loaded", { source: "config", epochs: store2.epochs.size });
|
|
2137
2147
|
return store2;
|
|
2138
2148
|
}
|
|
2149
|
+
if (idbStore) {
|
|
2150
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2151
|
+
source: "storage",
|
|
2152
|
+
epochs: idbStore.epochs.size
|
|
2153
|
+
});
|
|
2154
|
+
return idbStore;
|
|
2155
|
+
}
|
|
2139
2156
|
const store = createEpochStoreFromInputs(
|
|
2140
2157
|
[{ epochId: EpochId("epoch-0"), key: bytesToHex3(generateSecretKey2()) }],
|
|
2141
2158
|
{ createdBy: identity.publicKey }
|