diff --git a/asset-api/README.md b/asset-api/README.md
index 59958f6..ae2b054 100644
--- a/asset-api/README.md
+++ b/asset-api/README.md
@@ -6,7 +6,7 @@ The Asset API, takes care of storing user-generated assets.
1. Copy the `.env.example` file: `cp .env.example .env`
2. Run `yarn` to install the dependencies.
- * You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
+ - You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
3. Run `yarn start` to start the server.
- * You may need to create an empty folder at `$/asset-api/.keys`.
-4. You're ready to go! You will need to restart the server manually when you make changed (unless you use something like [Nodemon](https://www.npmjs.com/package/nodemon)).
\ No newline at end of file
+ - You may need to create an empty folder at `$/asset-api/.keys`.
+4. You're ready to go! You will need to restart the server manually when you make changed (unless you use something like [Nodemon](https://www.npmjs.com/package/nodemon)).
diff --git a/asset-api/src/consts.js b/asset-api/src/consts.js
index 3adb104..c11f68e 100644
--- a/asset-api/src/consts.js
+++ b/asset-api/src/consts.js
@@ -38,5 +38,5 @@ export const LISTEN_PORT = Number(process.env["ASSET_API_LISTEN_PORT"]) || 3001;
export const ASSETS_FOLDER = process.env["ASSET_API_ASSETS_FOLDER"];
export const IDENTITY_API_ENDPOINT = process.env["ASSET_API_IDENTITY_API_ENDPOINT"];
export const M2M_ALGORITHM = process.env["ASSET_API_M2M_ALGORITHM"] || "RSA-SHA512";
-export const PRIVATE_KEY_PATH = process.env["ASSET_API_PRIVATE_KEY_PATH"]
-export const PUBLIC_KEY_PATH = process.env["ASSET_API_PUBLIC_KEY_PATH"]
+export const PRIVATE_KEY_PATH = process.env["ASSET_API_PRIVATE_KEY_PATH"];
+export const PUBLIC_KEY_PATH = process.env["ASSET_API_PUBLIC_KEY_PATH"];
diff --git a/asset-api/src/index.js b/asset-api/src/index.js
index ed8b691..6ede9f7 100644
--- a/asset-api/src/index.js
+++ b/asset-api/src/index.js
@@ -1,16 +1,16 @@
// Identity. Store your memories and mental belongings
// Copyright (C) 2024 SofĂa Aritz
-//
+//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
-//
+//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
@@ -24,7 +24,14 @@ import mime from "mime";
import { promisify } from "node:util";
import { pipeline } from "node:stream";
import cors from "@fastify/cors";
-import { M2M_ALGORITHM, ASSETS_FOLDER, ASSET_API_LANDING_MESSAGE, IDENTITY_API_ENDPOINT, PRIVATE_KEY_PATH, PUBLIC_KEY_PATH } from "./consts.js";
+import {
+ M2M_ALGORITHM,
+ ASSETS_FOLDER,
+ ASSET_API_LANDING_MESSAGE,
+ IDENTITY_API_ENDPOINT,
+ PRIVATE_KEY_PATH,
+ PUBLIC_KEY_PATH,
+} from "./consts.js";
const { private: M2M_PRIVATE_KEY, public: M2M_PUBLIC_KEY } = loadM2MKeys();
if (M2M_PRIVATE_KEY == null || M2M_PUBLIC_KEY == null) {
@@ -39,7 +46,7 @@ const app = new Fastify({
app.register(multipart);
app.register(cors, {
origin: true,
-})
+});
app.get("/", async () => {
return signString(ASSET_API_LANDING_MESSAGE);
@@ -82,7 +89,7 @@ app.put("/asset", {
return {
asset_id: full_id,
- }
+ };
},
schema: {
query: {
@@ -97,11 +104,11 @@ app.put("/asset", {
app.get("/asset", {
async handler(request, reply) {
- let { user, limits } = await userFromSessionKey(request.query.session_key);
+ let { user } = await userFromSessionKey(request.query.session_key);
- if ('statusCode' in user) {
+ if ("statusCode" in user) {
reply.code(500);
- return "Something failed, please try again later"
+ return "Something failed, please try again later";
}
if (user.assets.includes(request.query.asset_id)) {
@@ -151,13 +158,13 @@ function loadM2MKeys() {
let privateDir = join(PRIVATE_KEY_PATH, "..");
if (!existsSync(privateDir)) {
- console.warn("The private key folder does not exist. It will be created.")
+ console.warn("The private key folder does not exist. It will be created.");
mkdirSync(privateDir, { recursive: true });
}
let publicDir = join(PUBLIC_KEY_PATH, "..");
if (!existsSync(publicDir)) {
- console.warn("The public key folder does not exist. It will be created.")
+ console.warn("The public key folder does not exist. It will be created.");
mkdirSync(publicDir, { recursive: true });
}
diff --git a/identity-api/README.md b/identity-api/README.md
index 347d719..2c1817b 100644
--- a/identity-api/README.md
+++ b/identity-api/README.md
@@ -6,8 +6,8 @@ The Identity API, takes care of storing user data.
1. Copy the `.env.example` file: `cp .env.example .env`
2. Run `yarn` to install the dependencies.
- * You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
+ - You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
3. Run `yarn start` to start the server.
- * **Note:** The `asset-api` server **must** be running before this command is run. [More info](./docs/asset-implementation.md).
- * You may need to create an empty folder at `$/identity-api/.database`.
-4. You're ready to go! You will need to restart the server manually when you make changed (unless you use something like [Nodemon](https://www.npmjs.com/package/nodemon)).
\ No newline at end of file
+ - **Note:** The `asset-api` server **must** be running before this command is run. [More info](./docs/asset-implementation.md).
+ - You may need to create an empty folder at `$/identity-api/.database`.
+4. You're ready to go! You will need to restart the server manually when you make changed (unless you use something like [Nodemon](https://www.npmjs.com/package/nodemon)).
diff --git a/identity-api/src/database.ts b/identity-api/src/database.ts
index c5f3872..f9ece36 100644
--- a/identity-api/src/database.ts
+++ b/identity-api/src/database.ts
@@ -37,7 +37,7 @@ export function fromDBList(input: string): Array {
export async function startDatabase() {
let dir = join(SQLITE_PATH, "..");
if (!existsSync(dir)) {
- console.warn("The database folder does not exist. It will be created.")
+ console.warn("The database folder does not exist. It will be created.");
await mkdir(dir, { recursive: true });
}
diff --git a/identity-api/src/m2m.ts b/identity-api/src/m2m.ts
index cfcf79b..9946729 100644
--- a/identity-api/src/m2m.ts
+++ b/identity-api/src/m2m.ts
@@ -23,7 +23,7 @@ let assetPubKey;
try {
assetPubKey = await fetchAssetPubkey();
} catch (e) {
- console.error("Couldn't retrieve the pubkey from the asset-api. Is the asset-api server running?")
+ console.error("Couldn't retrieve the pubkey from the asset-api. Is the asset-api server running?");
process.exit(1);
}
@@ -31,7 +31,7 @@ let assetAlgorithm;
try {
assetAlgorithm = await fetchAssetAlgorithm();
} catch (e) {
- console.error("Couldn't retrieve the algorithm from the asset-api. Is the asset-api server running?")
+ console.error("Couldn't retrieve the algorithm from the asset-api. Is the asset-api server running?");
process.exit(1);
}
diff --git a/identity-web/README.md b/identity-web/README.md
index 0822c81..d7376e7 100644
--- a/identity-web/README.md
+++ b/identity-web/README.md
@@ -6,19 +6,19 @@ The web app that interacts with the Identiy API and the Asset API.
1. Copy the `.env.example` file: `cp .env.example .env`
2. Run `yarn` to install the dependencies.
- * You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
+ - You may need to [enable Corepack](https://nodejs.org/api/corepack.html).
3. Run `yarn dev` and open the specified URL.
4. You're ready to go! Any changes should be reflected in real time.
## Structure
-* `./routes` - The pages and associated components. Part of the SvelteKit filesystem routing.
-Most of the code is here.
-* `./lib` - Various global elements.
- * `./lib/api.ts` - The stateless functions that interact with the Identity API and the Asset API.
- * `./lib/stores.ts` - The global stores, used to store things like tokens and account info.
- * `./lib/entry.ts` - The definitions for an entry.
- - **Note:** This file may be moved to a common package in the near future to simplify the
- server development process.
- * `./lib/assets` - Images used in the landing page.
- * `./lib/components` - Components used across various pages.
\ No newline at end of file
+- `./routes` - The pages and associated components. Part of the SvelteKit filesystem routing.
+ Most of the code is here.
+- `./lib` - Various global elements.
+ - `./lib/api.ts` - The stateless functions that interact with the Identity API and the Asset API.
+ - `./lib/stores.ts` - The global stores, used to store things like tokens and account info.
+ - `./lib/entry.ts` - The definitions for an entry.
+ - **Note:** This file may be moved to a common package in the near future to simplify the
+ server development process.
+ - `./lib/assets` - Images used in the landing page.
+ - `./lib/components` - Components used across various pages.
diff --git a/identity-web/src/lib/api.ts b/identity-web/src/lib/api.ts
index d784542..c09a018 100644
--- a/identity-web/src/lib/api.ts
+++ b/identity-web/src/lib/api.ts
@@ -126,21 +126,28 @@ export async function deleteEntry(credentials: Credentials, entry_id: string): P
await sendRequest('/entry', credentials, { method: 'DELETE' }, `?entry_id=${entry_id}`);
}
-export async function insertHeir(credentials: Credentials, heirs: InsertHeir): Promise {
- return await asJson(sendRequest('/auth/heirs', credentials, {
- method: 'PUT',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(heirs)
- }));
+export async function insertHeir(
+ credentials: Credentials,
+ heirs: InsertHeir
+): Promise {
+ return await asJson(
+ sendRequest('/auth/heirs', credentials, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(heirs)
+ })
+ );
}
export async function removeHeir(credentials: Credentials, heirID: string): Promise {
- return await asJson(sendRequest('/auth/heirs', credentials, {
- method: 'DELETE',
- body: heirID,
- }));
+ return await asJson(
+ sendRequest('/auth/heirs', credentials, {
+ method: 'DELETE',
+ body: heirID
+ })
+ );
}
export async function listHeirs(credentials: Credentials): Promise {
diff --git a/identity-web/src/routes/auth/account/+page.svelte b/identity-web/src/routes/auth/account/+page.svelte
index 4084742..eec12f1 100644
--- a/identity-web/src/routes/auth/account/+page.svelte
+++ b/identity-web/src/routes/auth/account/+page.svelte
@@ -5,7 +5,13 @@