monoidentity 0.14.1 → 0.15.1

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/+client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./+common.js";
2
- export { getLoginRecognized, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
2
+ export { getLoginRecognized, relog, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
3
3
  export { retrieveVerification } from "./verification-client.js";
4
4
  export { default as rawAttest } from "./verification/attest-remote.js";
5
5
  export { trackReady } from "./trackready.js";
package/dist/+client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./+common.js";
2
- export { getLoginRecognized, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
2
+ export { getLoginRecognized, relog, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
3
3
  export { retrieveVerification } from "./verification-client.js";
4
4
  export { default as rawAttest } from "./verification/attest-remote.js";
5
5
  export { trackReady } from "./trackready.js";
package/dist/storage.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const getLoginRecognized: () => {
6
6
  password: string;
7
7
  };
8
8
  export declare const setLoginRecognized: (login: string) => void;
9
+ export declare const relog: () => never;
9
10
  export declare const getVerification: () => Promise<any>;
10
11
  export declare const setVerification: (jwt: string) => void;
11
12
  export declare const getStorage: (realm: "config" | "cache") => Record<string, any>;
package/dist/storage.js CHANGED
@@ -5,6 +5,7 @@ import { login as loginSchema } from "./utils-transport.js";
5
5
  import { verify } from "@tsndr/cloudflare-worker-jwt";
6
6
  import publicKey from "./verification/public-key.js";
7
7
  import { storageClient } from "./storage/storageclient.svelte.js";
8
+ import { switchToHub } from "./utils-hub.js";
8
9
  let app = "unknown";
9
10
  let syncPromise = Promise.resolve();
10
11
  export const conf = (a) => {
@@ -26,6 +27,9 @@ export const setLoginRecognized = (login) => {
26
27
  const client = storageClient();
27
28
  client[LOGIN_RECOGNIZED_PATH] = login;
28
29
  };
30
+ export const relog = () => {
31
+ switchToHub([{ loginRecognized: true }]);
32
+ };
29
33
  const VERIFICATION_PATH = ".core/verification.jwt";
30
34
  export const getVerification = async () => {
31
35
  const client = storageClient();
@@ -5,6 +5,7 @@ import {} from "./utils-transport.js";
5
5
  import { conf, setLoginRecognized } from "./storage.js";
6
6
  import { backupLocally } from "./storage/backuplocally.js";
7
7
  import { backupCloud } from "./storage/backupcloud.js";
8
+ import { switchToHub } from "./utils-hub.js";
8
9
  export const trackReady = async (app, intents, shouldBackup, requestBackup) => {
9
10
  conf(app);
10
11
  let setup = localStorage["monoidentity-x/setup"]
@@ -24,13 +25,7 @@ export const trackReady = async (app, intents, shouldBackup, requestBackup) => {
24
25
  }
25
26
  }
26
27
  if (!setup) {
27
- const target = new URL("https://monoidentity.web.app");
28
- target.hash = JSON.stringify({
29
- intents: [{ storage: true }, ...intents],
30
- redirectURI: location.origin,
31
- });
32
- location.href = target.toString();
33
- throw new Error("halt: redirecting");
28
+ switchToHub([{ storage: true }, ...intents]);
34
29
  }
35
30
  if (setup.method == "localStorage") {
36
31
  await backupLocally(shouldBackup, requestBackup);
@@ -0,0 +1,2 @@
1
+ import type { Intent } from "./utils-transport.js";
2
+ export declare const switchToHub: (intents: Intent[]) => never;
@@ -0,0 +1,6 @@
1
+ export const switchToHub = (intents) => {
2
+ const target = new URL("https://monoidentity.web.app");
3
+ target.hash = JSON.stringify({ intents, redirectURI: location.origin });
4
+ location.href = target.toString();
5
+ throw new Error("halting");
6
+ };
@@ -1,15 +1,12 @@
1
- import { parse, stringify } from "devalue";
2
-
3
1
  //#region src/lib/verification/attest.remote.ts
4
2
  async function attest_remote_default(arg, init) {
5
3
  const res = await fetch("https://benignmonoserver.fly.dev/b1c8ae45b4", {
6
4
  method: "POST",
7
- body: stringify(arg),
5
+ body: JSON.stringify(arg),
8
6
  ...init
9
7
  });
10
8
  if (!res.ok) throw new Error(await res.text());
11
- if (!res.headers.get("content-type")?.includes("application/json")) return res;
12
- return parse(await res.text());
9
+ return await res.json();
13
10
  }
14
11
 
15
12
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.14.1",
3
+ "version": "0.15.1",
4
4
  "repository": "KTibow/monoidentity",
5
5
  "author": {
6
6
  "name": "KTibow"
@@ -44,7 +44,7 @@
44
44
  "@types/wicg-file-system-access": "^2023.10.6",
45
45
  "fast-xml-parser": "^5.2.5",
46
46
  "knip": "^5.64.1",
47
- "monoserve": "^2.2.0",
47
+ "monoserve": "^3.0.0",
48
48
  "publint": "^0.3.13",
49
49
  "rolldown": "1.0.0-beta.40",
50
50
  "school-districts": "^2.0.0",