feat: add modular services and repositories for improved code organization

Introduce repository pattern across multiple services, including `favorites`, `tags`, `sessions`, `reports`, `auth`, and more. Decouple crypto functionalities into modular services like `HashingService`, `JwtService`, and `EncryptionService`. Improve testability and maintainability by simplifying dependencies and consolidating utility logic.
This commit is contained in:
Mathis HERRIOT
2026-01-14 12:11:39 +01:00
parent 9c45bf11e4
commit 514bd354bf
64 changed files with 1801 additions and 1295 deletions

View File

@@ -0,0 +1,3 @@
module.exports = {
createCuid: () => () => 'mocked-cuid',
};

View File

@@ -0,0 +1,13 @@
module.exports = {
SignJWT: class {
constructor() { return this; }
setProtectedHeader() { return this; }
setIssuedAt() { return this; }
setExpirationTime() { return this; }
sign() { return Promise.resolve('mocked-token'); }
},
jwtVerify: () => Promise.resolve({ payload: { sub: 'mocked-user' } }),
importJWK: () => Promise.resolve({}),
exportJWK: () => Promise.resolve({}),
generateKeyPair: () => Promise.resolve({ publicKey: {}, privateKey: {} }),
};

View File

@@ -0,0 +1,7 @@
module.exports = {
ml_kem768: {
keygen: () => ({ publicKey: Buffer.alloc(1184), secretKey: Buffer.alloc(2400) }),
encapsulate: () => ({ cipherText: Buffer.alloc(1088), sharedSecret: Buffer.alloc(32) }),
decapsulate: () => Buffer.alloc(32),
}
};

View File

@@ -0,0 +1,5 @@
module.exports = {
sha3_256: () => ({ update: () => ({ digest: () => Buffer.alloc(32) }) }),
sha3_512: () => ({ update: () => ({ digest: () => Buffer.alloc(64) }) }),
shake256: () => ({ update: () => ({ digest: () => Buffer.alloc(32) }) }),
};