monoidentity 0.25.0 → 0.26.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/+client.d.ts +2 -7
- package/dist/+client.js +4 -7
- package/dist/old/storage/utils-sync.d.ts +13 -0
- package/dist/{storage → old/storage}/utils-sync.js +20 -7
- package/dist/storage.d.ts +1 -2
- package/dist/storage.js +2 -16
- package/dist/{storage/storageclient.svelte.d.ts → storageclient.svelte.d.ts} +1 -0
- package/dist/{storage/storageclient.svelte.js → storageclient.svelte.js} +4 -1
- package/package.json +1 -8
- package/dist/+server.d.ts +0 -2
- package/dist/+server.js +0 -2
- package/dist/Monoidentity.svelte +0 -86
- package/dist/Monoidentity.svelte.d.ts +0 -9
- package/dist/_common.d.ts +0 -1
- package/dist/_common.js +0 -1
- package/dist/readyup.d.ts +0 -2
- package/dist/readyup.js +0 -62
- package/dist/storage/utils-sync.d.ts +0 -3
- package/dist/verification/attest.d.ts +0 -1
- package/dist/verification/attest.js +0 -6
- package/dist/verification/gen.sh +0 -2
- package/dist/verification/jwt-utils.d.ts +0 -1
- package/dist/verification/jwt-utils.js +0 -9
- package/dist/verification/public-key.d.ts +0 -2
- package/dist/verification/public-key.js +0 -5
- package/dist/verification/studentvue-client.d.ts +0 -1
- package/dist/verification/studentvue-client.js +0 -24
- package/dist/verification/use-studentvue-remote.d.ts +0 -2
- package/dist/verification/use-studentvue-remote.js +0 -15
- package/dist/verification-client.d.ts +0 -1
- package/dist/verification-client.js +0 -14
- package/dist/verification-server.d.ts +0 -1
- package/dist/verification-server.js +0 -6
- /package/dist/{storage → old/storage}/_backupcloud.d.ts +0 -0
- /package/dist/{storage → old/storage}/_backupcloud.js +0 -0
- /package/dist/{storage → old/storage}/backupcloud-connection.d.ts +0 -0
- /package/dist/{storage → old/storage}/backupcloud-connection.js +0 -0
- /package/dist/{storage → old/storage}/backupcloud-pull.d.ts +0 -0
- /package/dist/{storage → old/storage}/backupcloud-pull.js +0 -0
- /package/dist/{storage → old/storage}/backupcloud-push.d.ts +0 -0
- /package/dist/{storage → old/storage}/backupcloud-push.js +0 -0
- /package/dist/{storage → old/storage}/backuplocally-pull.d.ts +0 -0
- /package/dist/{storage → old/storage}/backuplocally-pull.js +0 -0
- /package/dist/{storage → old/storage}/backuplocally-push.d.ts +0 -0
- /package/dist/{storage → old/storage}/backuplocally-push.js +0 -0
- /package/dist/{storage → old/storage}/utils-idb.d.ts +0 -0
- /package/dist/{storage → old/storage}/utils-idb.js +0 -0
- /package/dist/{storage → old/storage}/utils-storage.d.ts +0 -0
- /package/dist/{storage → old/storage}/utils-storage.js +0 -0
- /package/dist/{utils-localstorage.d.ts → old/utils-localstorage.d.ts} +0 -0
- /package/dist/{utils-localstorage.js → old/utils-localstorage.js} +0 -0
package/dist/+client.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { getLoginRecognized, relog,
|
|
1
|
+
export { encode, decode } from "./utils-base36.js";
|
|
2
|
+
export { getLoginRecognized, relog, getStorage, getScopedFS, VERIFICATION_PATH, } from "./storage.js";
|
|
3
3
|
export type { SyncStrategy } from "./client.js";
|
|
4
|
-
export { waitForSync } from "./storage/utils-sync.js";
|
|
5
|
-
export { retrieveVerification } from "./verification-client.js";
|
|
6
|
-
export { attest as rawAttest } from "./verification/attest.js";
|
|
7
|
-
export { readyUp } from "./readyup.js";
|
|
8
|
-
export { default as Monoidentity } from "./Monoidentity.svelte";
|
|
9
4
|
export type { Bucket, StorageSetup } from "./utils-transport.js";
|
package/dist/+client.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export { attest as rawAttest } from "./verification/attest.js";
|
|
6
|
-
export { readyUp } from "./readyup.js";
|
|
7
|
-
export { default as Monoidentity } from "./Monoidentity.svelte";
|
|
1
|
+
// common
|
|
2
|
+
export { encode, decode } from "./utils-base36.js";
|
|
3
|
+
// storage
|
|
4
|
+
export { getLoginRecognized, relog, getStorage, getScopedFS, VERIFICATION_PATH, } from "./storage.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SyncRequestDetail = {
|
|
2
|
+
key: string;
|
|
3
|
+
resolve?: () => void;
|
|
4
|
+
reject?: (reason?: unknown) => void;
|
|
5
|
+
};
|
|
6
|
+
declare global {
|
|
7
|
+
interface WindowEventMap {
|
|
8
|
+
"monoidentity-sync-request": CustomEvent<SyncRequestDetail>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const SYNC_REQUEST_EVENT = "monoidentity-sync-request";
|
|
12
|
+
export declare const addSync: (key: string, promise: Promise<void>) => void;
|
|
13
|
+
export declare const scheduleSync: (key: string, fn: () => Promise<void>, delay?: number) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const SYNC_REQUEST_EVENT = "monoidentity-sync-request";
|
|
1
2
|
const activeSyncs = {};
|
|
2
3
|
const scheduledSyncs = {};
|
|
3
4
|
export const addSync = (key, promise) => {
|
|
@@ -23,14 +24,9 @@ const scheduleInterval = setInterval(() => {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}, 100);
|
|
26
|
-
|
|
27
|
-
import.meta.hot.dispose(() => {
|
|
28
|
-
clearInterval(scheduleInterval);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
export const waitForSync = async (key) => {
|
|
27
|
+
const waitForTrackedSync = async (key) => {
|
|
32
28
|
if (key != "*") {
|
|
33
|
-
await
|
|
29
|
+
await waitForTrackedSync("*");
|
|
34
30
|
}
|
|
35
31
|
if (key in activeSyncs) {
|
|
36
32
|
await activeSyncs[key];
|
|
@@ -43,3 +39,20 @@ export const scheduleSync = (key, fn, delay = 1000) => {
|
|
|
43
39
|
const executeAt = Date.now() + delay;
|
|
44
40
|
scheduledSyncs[key] = { fn, executeAt };
|
|
45
41
|
};
|
|
42
|
+
const onSyncRequest = (event) => {
|
|
43
|
+
const { key, resolve, reject } = event.detail;
|
|
44
|
+
waitForTrackedSync(key)
|
|
45
|
+
.then(() => {
|
|
46
|
+
resolve?.();
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
reject?.(error);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
addEventListener(SYNC_REQUEST_EVENT, onSyncRequest);
|
|
53
|
+
if (import.meta.hot) {
|
|
54
|
+
import.meta.hot.dispose(() => {
|
|
55
|
+
clearInterval(scheduleInterval);
|
|
56
|
+
removeEventListener(SYNC_REQUEST_EVENT, onSyncRequest);
|
|
57
|
+
});
|
|
58
|
+
}
|
package/dist/storage.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare const getLoginRecognized: () => {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const setLoginRecognized: (login: string) => void;
|
|
6
6
|
export declare const relog: () => never;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const setVerification: (jwt: string) => void;
|
|
7
|
+
export declare const VERIFICATION_PATH = ".local/verification.jwt";
|
|
9
8
|
export declare const getStorage: (realm: "config" | "userdata" | "cache" | (string & {})) => Record<string, any>;
|
|
10
9
|
export declare const getScopedFS: (dir: string) => Record<string, any>;
|
package/dist/storage.js
CHANGED
|
@@ -2,9 +2,7 @@ import { stringify, parse } from "devalue";
|
|
|
2
2
|
import { parse as useSchema } from "valibot";
|
|
3
3
|
import { decode } from "./utils-base36.js";
|
|
4
4
|
import { login as loginSchema } from "./utils-transport.js";
|
|
5
|
-
import {
|
|
6
|
-
import publicKey from "./verification/public-key.js";
|
|
7
|
-
import { storageClient } from "./storage/storageclient.svelte.js";
|
|
5
|
+
import { storageClient } from "./storageclient.svelte.js";
|
|
8
6
|
import { switchToHub } from "./utils-hub.js";
|
|
9
7
|
const LOGIN_RECOGNIZED_PATH = ".local/login.encjson";
|
|
10
8
|
export const getLoginRecognized = () => {
|
|
@@ -21,19 +19,7 @@ export const setLoginRecognized = (login) => {
|
|
|
21
19
|
export const relog = () => {
|
|
22
20
|
switchToHub([{ loginRecognized: true }]);
|
|
23
21
|
};
|
|
24
|
-
const VERIFICATION_PATH = ".local/verification.jwt";
|
|
25
|
-
export const getVerification = async () => {
|
|
26
|
-
const client = storageClient();
|
|
27
|
-
const jwt = client[VERIFICATION_PATH];
|
|
28
|
-
if (!jwt)
|
|
29
|
-
throw new Error("No verification found");
|
|
30
|
-
await verify(jwt, publicKey, { algorithm: "ES256", throwError: true });
|
|
31
|
-
return jwt;
|
|
32
|
-
};
|
|
33
|
-
export const setVerification = (jwt) => {
|
|
34
|
-
const client = storageClient();
|
|
35
|
-
client[VERIFICATION_PATH] = jwt;
|
|
36
|
-
};
|
|
22
|
+
export const VERIFICATION_PATH = ".local/verification.jwt";
|
|
37
23
|
export const getStorage = (realm) => {
|
|
38
24
|
const prefix = `.${realm}/${MONOIDENTITY_APP_ID}/`;
|
|
39
25
|
return storageClient((key) => `${prefix}${key}.devalue`, (key) => (key.startsWith(prefix) ? key.slice(prefix.length, -".devalue".length) : undefined), stringify, parse);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SYNC_REQUEST_EVENT } from "./old/storage/utils-sync.js";
|
|
2
|
+
export const waitForSync = async (key) => {
|
|
3
|
+
await new Promise((resolve, reject) => window.dispatchEvent(new CustomEvent(SYNC_REQUEST_EVENT, { detail: { key, resolve, reject } })));
|
|
4
|
+
};
|
|
2
5
|
export const STORAGE_EVENT = "monoidentity-storage";
|
|
3
6
|
const announce = (key, value) => {
|
|
4
7
|
// Announce to all, even third parties
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monoidentity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"repository": "KTibow/monoidentity",
|
|
6
6
|
"author": {
|
|
@@ -25,20 +25,14 @@
|
|
|
25
25
|
"./init": {
|
|
26
26
|
"types": "./dist/+init.d.ts",
|
|
27
27
|
"import": "./dist/+init.js"
|
|
28
|
-
},
|
|
29
|
-
"./server": {
|
|
30
|
-
"types": "./dist/+server.d.ts",
|
|
31
|
-
"import": "./dist/+server.js"
|
|
32
28
|
}
|
|
33
29
|
},
|
|
34
30
|
"peerDependencies": {
|
|
35
31
|
"svelte": "^5.0.0"
|
|
36
32
|
},
|
|
37
33
|
"dependencies": {
|
|
38
|
-
"@tsndr/cloudflare-worker-jwt": "^3.2.1",
|
|
39
34
|
"aws4fetch": "^1.0.20",
|
|
40
35
|
"devalue": "^5.6.2",
|
|
41
|
-
"fast-studentvue": "^2.1.1",
|
|
42
36
|
"idb-keyval": "^6.2.2",
|
|
43
37
|
"valibot": "^1.2.0"
|
|
44
38
|
},
|
|
@@ -51,7 +45,6 @@
|
|
|
51
45
|
"monoserve": "^3.2.4",
|
|
52
46
|
"publint": "^0.3.17",
|
|
53
47
|
"rolldown": "1.0.0-rc.4",
|
|
54
|
-
"school-districts": "^5.0.1",
|
|
55
48
|
"svelte": "^5.51.0",
|
|
56
49
|
"svelte-check": "^4.4.0",
|
|
57
50
|
"tinyglobby": "^0.2.15",
|
package/dist/+server.d.ts
DELETED
package/dist/+server.js
DELETED
package/dist/Monoidentity.svelte
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onDestroy, type Snippet } from "svelte";
|
|
3
|
-
import { readyUp } from "./readyup.js";
|
|
4
|
-
import type { Intent } from "./utils-transport.js";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
intents,
|
|
8
|
-
children,
|
|
9
|
-
}: {
|
|
10
|
-
intents?: Intent[];
|
|
11
|
-
children: Snippet;
|
|
12
|
-
} = $props();
|
|
13
|
-
|
|
14
|
-
const aborter = new AbortController();
|
|
15
|
-
onDestroy(() => {
|
|
16
|
-
aborter.abort();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
let backup: (() => void) | undefined = $state();
|
|
20
|
-
readyUp(
|
|
21
|
-
intents || [],
|
|
22
|
-
aborter.signal,
|
|
23
|
-
(startBackup) =>
|
|
24
|
-
(backup = () => {
|
|
25
|
-
startBackup();
|
|
26
|
-
backup = undefined;
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
{#snippet backupUI(yes: () => void, no: () => void)}
|
|
32
|
-
<p>Avoid reconfiguration with a backup folder.</p>
|
|
33
|
-
<button onclick={no}>Skip</button>
|
|
34
|
-
<button class="primary" onclick={yes}>Connect</button>
|
|
35
|
-
{/snippet}
|
|
36
|
-
|
|
37
|
-
{@render children()}
|
|
38
|
-
{#if backup}
|
|
39
|
-
<div class="backup toast">
|
|
40
|
-
{@render backupUI(backup, () => (backup = undefined))}
|
|
41
|
-
</div>
|
|
42
|
-
{/if}
|
|
43
|
-
|
|
44
|
-
<style>
|
|
45
|
-
.backup {
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
gap: 0.25rem;
|
|
49
|
-
line-height: 1;
|
|
50
|
-
|
|
51
|
-
> * {
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
height: 3rem;
|
|
56
|
-
margin: 0;
|
|
57
|
-
padding-inline: 0.5rem;
|
|
58
|
-
border-radius: 0.5rem;
|
|
59
|
-
border: none;
|
|
60
|
-
font: inherit;
|
|
61
|
-
&:first-child {
|
|
62
|
-
border-start-start-radius: 1.5rem;
|
|
63
|
-
border-start-end-radius: 1.5rem;
|
|
64
|
-
}
|
|
65
|
-
&:last-child {
|
|
66
|
-
border-end-start-radius: 1.5rem;
|
|
67
|
-
border-end-end-radius: 1.5rem;
|
|
68
|
-
}
|
|
69
|
-
background-color: light-dark(#fff, #000);
|
|
70
|
-
color: light-dark(#000, #fff);
|
|
71
|
-
}
|
|
72
|
-
> button {
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
}
|
|
75
|
-
> .primary {
|
|
76
|
-
background-color: light-dark(#000, #fff);
|
|
77
|
-
color: light-dark(#fff, #000);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
.toast {
|
|
81
|
-
position: fixed;
|
|
82
|
-
right: 1rem;
|
|
83
|
-
top: 1rem;
|
|
84
|
-
z-index: 1000;
|
|
85
|
-
}
|
|
86
|
-
</style>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Snippet } from "svelte";
|
|
2
|
-
import type { Intent } from "./utils-transport.js";
|
|
3
|
-
type $$ComponentProps = {
|
|
4
|
-
intents?: Intent[];
|
|
5
|
-
children: Snippet;
|
|
6
|
-
};
|
|
7
|
-
declare const Monoidentity: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
-
type Monoidentity = ReturnType<typeof Monoidentity>;
|
|
9
|
-
export default Monoidentity;
|
package/dist/_common.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { encode, decode } from "./utils-base36.js";
|
package/dist/_common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { encode, decode } from "./utils-base36.js";
|
package/dist/readyup.d.ts
DELETED
package/dist/readyup.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {} from "./utils-transport.js";
|
|
2
|
-
// import { createLocalStorage } from "./storage/createlocalstorage.js";
|
|
3
|
-
// import { wrapBackup } from "./storage/wrapbackup.js";
|
|
4
|
-
// import { wrapCloud } from "./storage/wrapcloud.js";
|
|
5
|
-
import { setLoginRecognized } from "./storage.js";
|
|
6
|
-
import { pullFromLocalBackup } from "./storage/backuplocally-pull.js";
|
|
7
|
-
import { mountLocalBackupPush } from "./storage/backuplocally-push.js";
|
|
8
|
-
import { createCloudClient } from "./storage/backupcloud-connection.js";
|
|
9
|
-
import { mountCloudPull, pullFromCloud } from "./storage/backupcloud-pull.js";
|
|
10
|
-
import { mountCloudPush } from "./storage/backupcloud-push.js";
|
|
11
|
-
import { switchToHub } from "./utils-hub.js";
|
|
12
|
-
export const readyUp = (intents, signal, requestBackup) => {
|
|
13
|
-
let setup = localStorage["monoidentity-x/setup"]
|
|
14
|
-
? JSON.parse(localStorage["monoidentity-x/setup"])
|
|
15
|
-
: undefined;
|
|
16
|
-
let provisions = [];
|
|
17
|
-
const params = new URLSearchParams(location.hash.slice(1));
|
|
18
|
-
const cb = params.get("monoidentitycallback");
|
|
19
|
-
if (cb) {
|
|
20
|
-
history.replaceState(null, "", location.pathname);
|
|
21
|
-
({ provisions } = JSON.parse(cb));
|
|
22
|
-
}
|
|
23
|
-
for (const provision of provisions) {
|
|
24
|
-
if ("setup" in provision) {
|
|
25
|
-
setup = provision.setup;
|
|
26
|
-
localStorage["monoidentity-x/setup"] = JSON.stringify(setup);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (!setup) {
|
|
30
|
-
switchToHub([{ storage: true }, ...intents]);
|
|
31
|
-
}
|
|
32
|
-
for (const provision of provisions) {
|
|
33
|
-
if ("createLoginRecognized" in provision) {
|
|
34
|
-
setLoginRecognized(provision.createLoginRecognized);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// fire off backup
|
|
38
|
-
if (setup.method == "localStorage") {
|
|
39
|
-
void pullFromLocalBackup(requestBackup)
|
|
40
|
-
.then((dir) => {
|
|
41
|
-
signal.throwIfAborted();
|
|
42
|
-
if (!dir)
|
|
43
|
-
return;
|
|
44
|
-
mountLocalBackupPush(dir, signal);
|
|
45
|
-
})
|
|
46
|
-
.catch((err) => {
|
|
47
|
-
console.error("[monoidentity local] pull failed", err);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (setup.method == "cloud") {
|
|
51
|
-
const client = createCloudClient(setup);
|
|
52
|
-
void pullFromCloud(client)
|
|
53
|
-
.then(() => {
|
|
54
|
-
signal.throwIfAborted();
|
|
55
|
-
mountCloudPull(client, signal);
|
|
56
|
-
mountCloudPush(client, signal);
|
|
57
|
-
})
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
console.error("[monoidentity cloud] pull failed", err);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const attest: (email: string, password: string) => Promise<any>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { generateStudentVueToken } from "./studentvue-client.js";
|
|
2
|
-
import useStudentVue from "./use-studentvue-remote.js";
|
|
3
|
-
export const attest = async (email, password) => {
|
|
4
|
-
const token = await generateStudentVueToken(email, password);
|
|
5
|
-
return await useStudentVue({ token, email });
|
|
6
|
-
};
|
package/dist/verification/gen.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateVerificationJWT: (email: string, method: string) => Promise<string>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { sign } from "@tsndr/cloudflare-worker-jwt";
|
|
2
|
-
import { VERIFICATION_PRIVATE_KEY } from "$env/static/private";
|
|
3
|
-
export const generateVerificationJWT = async (email, method) => {
|
|
4
|
-
return await sign({
|
|
5
|
-
sub: email,
|
|
6
|
-
verification: { method },
|
|
7
|
-
exp: Math.floor(Date.now() / 1000) + 24 * 3600 * 365,
|
|
8
|
-
}, VERIFICATION_PRIVATE_KEY, { algorithm: "ES256" });
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateStudentVueToken: (email: string, password: string) => Promise<any>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { districtApps } from "school-districts";
|
|
2
|
-
import fastStudentvue from "fast-studentvue";
|
|
3
|
-
const studentvue = (email, password, methodName, params = {}) => fastStudentvue({ email, password }, () => {
|
|
4
|
-
throw new Error("Invalid auth");
|
|
5
|
-
}, methodName, params);
|
|
6
|
-
export const generateStudentVueToken = async (email, password) => {
|
|
7
|
-
const domain = email.split("@")[1];
|
|
8
|
-
const apps = districtApps[domain];
|
|
9
|
-
if (!apps) {
|
|
10
|
-
throw new Error("Unknown domain");
|
|
11
|
-
}
|
|
12
|
-
const svApp = apps.find((app) => app.app == "StudentVue");
|
|
13
|
-
if (!svApp) {
|
|
14
|
-
throw new Error("Domain does not support StudentVue");
|
|
15
|
-
}
|
|
16
|
-
const response = await studentvue(email, password, "GenerateAuthToken", {
|
|
17
|
-
Username: "",
|
|
18
|
-
TokenForClassWebSite: "true",
|
|
19
|
-
DocumentID: "1",
|
|
20
|
-
AssignmentID: "1",
|
|
21
|
-
});
|
|
22
|
-
const token = response.AuthToken["@_EncyToken"];
|
|
23
|
-
return token;
|
|
24
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "devalue";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/verification/use-studentvue.remote.ts
|
|
4
|
-
async function use_studentvue_remote_default(arg, init) {
|
|
5
|
-
const res = await fetch("https://monoserve-by45xe47vq-uc.a.run.app/use-studentvue:d6da", {
|
|
6
|
-
method: "POST",
|
|
7
|
-
body: JSON.stringify(arg),
|
|
8
|
-
...init
|
|
9
|
-
});
|
|
10
|
-
if (!res.ok) throw new Error(await res.text());
|
|
11
|
-
return await res.json();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { use_studentvue_remote_default as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const retrieveVerification: () => Promise<any>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { attest } from "./verification/attest.js";
|
|
2
|
-
import { getLoginRecognized, getVerification, setVerification } from "./storage.js";
|
|
3
|
-
export const retrieveVerification = async () => {
|
|
4
|
-
let jwt;
|
|
5
|
-
try {
|
|
6
|
-
jwt = await getVerification();
|
|
7
|
-
}
|
|
8
|
-
catch {
|
|
9
|
-
const { email, password } = getLoginRecognized();
|
|
10
|
-
jwt = await attest(email, password);
|
|
11
|
-
setVerification(jwt);
|
|
12
|
-
}
|
|
13
|
-
return jwt;
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useVerification: (jwt: string) => Promise<import("@tsndr/cloudflare-worker-jwt").JwtData<{}, {}>>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { verify } from "@tsndr/cloudflare-worker-jwt";
|
|
2
|
-
import publicKey from "./verification/public-key.js";
|
|
3
|
-
export const useVerification = async (jwt) => {
|
|
4
|
-
const result = await verify(jwt, publicKey, { algorithm: "ES256", throwError: true });
|
|
5
|
-
return result;
|
|
6
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|