monoidentity 0.15.2 → 0.15.4
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 +1 -1
- package/dist/+client.js +1 -1
- package/dist/storage/backuplocally.js +1 -1
- package/dist/utils-localstorage.d.ts +1 -0
- package/dist/utils-localstorage.js +1 -0
- package/dist/utils-transport.d.ts +0 -1
- package/dist/utils-transport.js +0 -1
- package/dist/verification/attest.d.ts +1 -0
- package/dist/verification/attest.js +6 -0
- package/dist/verification/jwt-utils.d.ts +1 -0
- package/dist/verification/jwt-utils.js +9 -0
- package/dist/verification/studentvue-client.d.ts +1 -0
- package/dist/verification/studentvue-client.js +24 -0
- package/dist/verification/use-studentvue-remote.d.ts +2 -0
- package/dist/verification/use-studentvue-remote.js +13 -0
- package/dist/verification-client.js +3 -3
- package/package.json +15 -15
- package/dist/verification/attest-proxy.disabled.d.ts +0 -4
- package/dist/verification/attest-proxy.disabled.js +0 -35
- package/dist/verification/attest-remote.d.ts +0 -2
- package/dist/verification/attest-remote.js +0 -13
package/dist/+client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./+common.js";
|
|
2
2
|
export { getLoginRecognized, relog, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
|
|
3
3
|
export { retrieveVerification } from "./verification-client.js";
|
|
4
|
-
export {
|
|
4
|
+
export { attest as rawAttest } from "./verification/attest.js";
|
|
5
5
|
export { trackReady } from "./trackready.js";
|
|
6
6
|
export { default as Monoidentity } from "./Monoidentity.svelte";
|
package/dist/+client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./+common.js";
|
|
2
2
|
export { getLoginRecognized, relog, getVerification, getStorage, getScopedFS, completeSync, } from "./storage.js";
|
|
3
3
|
export { retrieveVerification } from "./verification-client.js";
|
|
4
|
-
export {
|
|
4
|
+
export { attest as rawAttest } from "./verification/attest.js";
|
|
5
5
|
export { trackReady } from "./trackready.js";
|
|
6
6
|
export { default as Monoidentity } from "./Monoidentity.svelte";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createStore, get, set } from "idb-keyval";
|
|
2
2
|
import { STORAGE_EVENT, storageClient } from "./storageclient.svelte.js";
|
|
3
|
-
import { canBackup } from "../utils-
|
|
3
|
+
import { canBackup } from "../utils-localstorage.js";
|
|
4
4
|
import { shouldPersist } from "./_should.js";
|
|
5
5
|
let unmount;
|
|
6
6
|
const saveToDir = (shouldBackup, dir) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const canBackup: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const canBackup = navigator.userAgent.includes("CrOS") && Boolean(window.showDirectoryPicker);
|
|
@@ -30,4 +30,3 @@ export declare const login: import("valibot", { with: { "resolution-mode": "requ
|
|
|
30
30
|
readonly email: import("valibot", { with: { "resolution-mode": "require" } }).SchemaWithPipe<readonly [import("valibot", { with: { "resolution-mode": "require" } }).StringSchema<undefined>, import("valibot", { with: { "resolution-mode": "require" } }).EmailAction<string, undefined>]>;
|
|
31
31
|
readonly password: import("valibot", { with: { "resolution-mode": "require" } }).StringSchema<undefined>;
|
|
32
32
|
}, undefined>;
|
|
33
|
-
export declare const canBackup: boolean;
|
package/dist/utils-transport.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attest: (email: string, password: string) => Promise<any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateVerificationJWT: (email: string, method: string) => Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateStudentVueToken: (email: string, password: string) => Promise<any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/lib/verification/use-studentvue.remote.ts
|
|
2
|
+
async function use_studentvue_remote_default(arg, init) {
|
|
3
|
+
const res = await fetch("https://monoserve-by45xe47vq-uc.a.run.app/use-studentvue:d6da", {
|
|
4
|
+
method: "POST",
|
|
5
|
+
body: JSON.stringify(arg),
|
|
6
|
+
...init
|
|
7
|
+
});
|
|
8
|
+
if (!res.ok) throw new Error(await res.text());
|
|
9
|
+
return await res.json();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { use_studentvue_remote_default as default };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import attest from "./verification/attest
|
|
1
|
+
import { attest } from "./verification/attest.js";
|
|
2
2
|
import { getLoginRecognized, getVerification, setVerification } from "./storage.js";
|
|
3
|
-
import { encode } from "./utils-base36.js";
|
|
4
3
|
export const retrieveVerification = async () => {
|
|
5
4
|
let jwt;
|
|
6
5
|
try {
|
|
7
6
|
jwt = await getVerification();
|
|
8
7
|
}
|
|
9
8
|
catch {
|
|
10
|
-
|
|
9
|
+
const { email, password } = getLoginRecognized();
|
|
10
|
+
jwt = await attest(email, password);
|
|
11
11
|
setVerification(jwt);
|
|
12
12
|
}
|
|
13
13
|
return jwt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monoidentity",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
|
+
"license": "ISC",
|
|
4
5
|
"repository": "KTibow/monoidentity",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "KTibow"
|
|
@@ -32,35 +33,34 @@
|
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@tsndr/cloudflare-worker-jwt": "^3.2.0",
|
|
34
35
|
"aws4fetch": "^1.0.20",
|
|
35
|
-
"devalue": "^5.
|
|
36
|
+
"devalue": "^5.4.2",
|
|
36
37
|
"idb-keyval": "^6.2.2",
|
|
37
38
|
"valibot": "^1.1.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
41
|
-
"@sveltejs/kit": "^2.
|
|
42
|
+
"@sveltejs/kit": "^2.48.4",
|
|
42
43
|
"@sveltejs/package": "^2.5.4",
|
|
43
44
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
44
|
-
"@types/wicg-file-system-access": "^2023.10.
|
|
45
|
-
"fast-studentvue": "^2.0.
|
|
46
|
-
"knip": "^5.
|
|
47
|
-
"monoserve": "^3.2.
|
|
48
|
-
"publint": "^0.3.
|
|
49
|
-
"rolldown": "1.0.0-beta.
|
|
50
|
-
"school-districts": "^
|
|
51
|
-
"svelte": "^5.
|
|
52
|
-
"svelte-check": "^4.3.
|
|
45
|
+
"@types/wicg-file-system-access": "^2023.10.7",
|
|
46
|
+
"fast-studentvue": "^2.0.3",
|
|
47
|
+
"knip": "^5.68.0",
|
|
48
|
+
"monoserve": "^3.2.2",
|
|
49
|
+
"publint": "^0.3.15",
|
|
50
|
+
"rolldown": "1.0.0-beta.47",
|
|
51
|
+
"school-districts": "^4.0.0",
|
|
52
|
+
"svelte": "^5.43.5",
|
|
53
|
+
"svelte-check": "^4.3.3",
|
|
53
54
|
"tinyglobby": "^0.2.15",
|
|
54
55
|
"typescript": "^5.9.3",
|
|
55
|
-
"vite": "^7.
|
|
56
|
+
"vite": "^7.2.2"
|
|
56
57
|
},
|
|
57
58
|
"keywords": [
|
|
58
59
|
"svelte"
|
|
59
60
|
],
|
|
60
61
|
"scripts": {
|
|
61
62
|
"dev": "vite dev",
|
|
62
|
-
"build": "
|
|
63
|
-
"preview": "vite preview",
|
|
63
|
+
"build": "pnpm run prepack && pnpm --prefix firebase-functions run build",
|
|
64
64
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
65
65
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
66
66
|
"knip": "knip"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
async fetch(request) {
|
|
5
|
-
const target = request.headers.get("x-proxy-target");
|
|
6
|
-
if (!target) {
|
|
7
|
-
return new Response("Missing x-proxy-target header", { status: 400 });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const targetUrl = new URL(target);
|
|
12
|
-
if (
|
|
13
|
-
targetUrl.protocol != "https:" ||
|
|
14
|
-
!targetUrl.host.endsWith("-psv.edupoint.com") ||
|
|
15
|
-
targetUrl.pathname != "/Service/PXPCommunication.asmx/ProcessWebServiceRequest"
|
|
16
|
-
) {
|
|
17
|
-
throw new Error();
|
|
18
|
-
}
|
|
19
|
-
} catch {
|
|
20
|
-
return new Response("Invalid target URL", { status: 400 });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const newHeaders = new Headers(request.headers);
|
|
24
|
-
newHeaders.delete("x-proxy-target");
|
|
25
|
-
newHeaders.delete("host");
|
|
26
|
-
|
|
27
|
-
const newRequest = new Request(target, {
|
|
28
|
-
method: request.method,
|
|
29
|
-
headers: newHeaders,
|
|
30
|
-
body: request.body,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return fetch(newRequest);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/lib/verification/attest.remote.ts
|
|
2
|
-
async function attest_remote_default(arg, init) {
|
|
3
|
-
const res = await fetch("https://benignmonoserver.fly.dev/attest:c5", {
|
|
4
|
-
method: "POST",
|
|
5
|
-
body: JSON.stringify(arg),
|
|
6
|
-
...init
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(await res.text());
|
|
9
|
-
return await res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { attest_remote_default as default };
|