monoidentity 0.8.1 → 0.9.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/dist/storage.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const setup: (i: Record<string, string>, a: string) => void;
1
+ export declare const conf: (i: Record<string, string>, a: string) => void;
2
2
  export declare const LOGIN_RECOGNIZED_PATH = ".core/login.encjson";
3
3
  export declare const getLoginRecognized: () => {
4
4
  email: string;
package/dist/storage.js CHANGED
@@ -8,7 +8,7 @@ import publicKey from "./verification/public-key.js";
8
8
  import attest from "./verification/attest-remote.js";
9
9
  let implementation;
10
10
  let app = "";
11
- export const setup = (i, a) => {
11
+ export const conf = (i, a) => {
12
12
  implementation = i;
13
13
  app = a;
14
14
  };
@@ -1,10 +1,10 @@
1
1
  import {} from "./utils-transport.js";
2
2
  import { init as initLocal, wrapWithBackup } from "./storage/localstorage.js";
3
- import { LOGIN_RECOGNIZED_PATH, setup } from "./storage.js";
3
+ import { LOGIN_RECOGNIZED_PATH, conf } from "./storage.js";
4
4
  export const trackReady = (app, intents, requestBackup, ready) => {
5
5
  const params = new URLSearchParams(location.hash.slice(1));
6
- let memory = localStorage.monoidentityMemory
7
- ? JSON.parse(localStorage.monoidentityMemory)
6
+ let setup = localStorage["monoidentity-x/setup"]
7
+ ? JSON.parse(localStorage["monoidentity-x/setup"])
8
8
  : undefined;
9
9
  let provisions = [];
10
10
  const cb = params.get("monoidentitycallback");
@@ -14,11 +14,11 @@ export const trackReady = (app, intents, requestBackup, ready) => {
14
14
  }
15
15
  for (const provision of provisions) {
16
16
  if ("setup" in provision) {
17
- memory = provision.setup;
18
- localStorage.monoidentityMemory = JSON.stringify(memory);
17
+ setup = provision.setup;
18
+ localStorage["monoidentity-x/setup"] = JSON.stringify(setup);
19
19
  }
20
20
  }
21
- if (!memory) {
21
+ if (!setup) {
22
22
  const target = new URL("https://usemonoidentity.web.app");
23
23
  target.hash = JSON.stringify({
24
24
  intents: [{ storage: true }, ...intents],
@@ -28,18 +28,18 @@ export const trackReady = (app, intents, requestBackup, ready) => {
28
28
  return;
29
29
  }
30
30
  let storage;
31
- if (memory.method == "cloud") {
31
+ if (setup.method == "cloud") {
32
32
  // TODO
33
33
  throw new Error("unimplemented");
34
34
  }
35
- else if (memory.method == "localStorage") {
35
+ else if (setup.method == "localStorage") {
36
36
  storage = initLocal();
37
37
  storage = wrapWithBackup(storage, requestBackup);
38
38
  }
39
39
  else {
40
40
  throw new Error("unreachable");
41
41
  }
42
- setup(storage, app);
42
+ conf(storage, app);
43
43
  for (const provision of provisions) {
44
44
  if ("createLoginRecognized" in provision) {
45
45
  storage[LOGIN_RECOGNIZED_PATH] = provision.createLoginRecognized;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "repository": "KTibow/monoidentity",
5
5
  "author": {
6
6
  "name": "KTibow"