Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(service-identity): call the dialect self-check's scrypt input inputSha256

Mauricef85b9dc3ff34
diff --git a/scripts/ci/check-registration-dialect.mjs b/scripts/ci/check-registration-dialect.mjs
index 96518987f..a6a46066d 100644
--- a/scripts/ci/check-registration-dialect.mjs
+++ b/scripts/ci/check-registration-dialect.mjs
@@ -451,7 +451,7 @@ export function runtimeProblems(mod, version) {
};
const attempt = dialect.begin(inputs);
const { password, salt } = attempt.work(check.nonce);
- if (sha256(password) !== check.passwordSha256) problems.push('its password is not the one the issuer computed');
+ if (sha256(password) !== check.inputSha256) problems.push('its password is not the one the issuer computed');
if (sha256(salt) !== check.saltSha256) problems.push('its salt is not the one the issuer computed');
const { N, r, p } = check.challenge;
if (scryptSync(password, salt, 32, { N, r, p }).toString('hex') !== check.scrypt) {
diff --git a/server/src/nest/service-identity/registration-dialect.ts b/server/src/nest/service-identity/registration-dialect.ts
index d9a765a00..f6b9f5aab 100644
--- a/server/src/nest/service-identity/registration-dialect.ts
+++ b/server/src/nest/service-identity/registration-dialect.ts
@@ -39,7 +39,7 @@ export const SELF_CHECK: DialectSelfCheck = {
random: '000102030405060708090a0b0c0d0e0f',
nowSeconds: 1800000000,
nonce: 41,
- passwordSha256: '6da395852966856653d9efba4dd3230e31f0fa325558474c91ae719247cc20ac',
+ inputSha256: '6da395852966856653d9efba4dd3230e31f0fa325558474c91ae719247cc20ac',
saltSha256: '9a4f2641b36f212d95eeceb212ce3587672322074288da20da4822809816aa7b',
scrypt: 'f3de9aab4d5d9e114d63ba51bb0c8f007a644c1e24ef7b8e4062d49e9eed5376',
requestSha256: '840dd80c265fba34a73ff4927eaa8416aa344d32372bf4d85273bf5ce130af99',
diff --git a/server/src/nest/service-identity/registration-dialect.types.ts b/server/src/nest/service-identity/registration-dialect.types.ts
index 6df16f8f8..d2f5f7c67 100644
--- a/server/src/nest/service-identity/registration-dialect.types.ts
+++ b/server/src/nest/service-identity/registration-dialect.types.ts
@@ -64,7 +64,7 @@ export interface DialectSelfCheck {
random: string;
nowSeconds: number;
nonce: number;
- passwordSha256: string;
+ inputSha256: string;
saltSha256: string;
/** Hex. */
scrypt: string;
diff --git a/server/tests/fixtures/service-identity/registration-dialect.example.ts b/server/tests/fixtures/service-identity/registration-dialect.example.ts
index 2fe07420d..a78c9d693 100644
--- a/server/tests/fixtures/service-identity/registration-dialect.example.ts
+++ b/server/tests/fixtures/service-identity/registration-dialect.example.ts
@@ -64,7 +64,7 @@ export const SELF_CHECK: DialectSelfCheck = {
random: '000102030405060708090a0b0c0d0e0f',
nowSeconds: 1800000000,
nonce: 41,
- passwordSha256: 'cf7d2be18b531a1a1f2427ce744cd1bd7b18ae731e1449ac56c827e7a683da51',
+ inputSha256: 'cf7d2be18b531a1a1f2427ce744cd1bd7b18ae731e1449ac56c827e7a683da51',
saltSha256: '005cc836f9d0a082e0c3712401f1d95515b6066855e8f10533353b6eb0e76f3d',
scrypt: '5fd715b7942b9bc9ccee9b811b5566d31aa7ca6d3a011222fe3101d6178d4396',
requestSha256: '2b41dc94a997e22cecc7bb946889208fc86c8dff0f5e30075a2fcee28239f0b8',
diff --git a/server/tests/unit/nest/service-identity/registration-dialect.test.ts b/server/tests/unit/nest/service-identity/registration-dialect.test.ts
index 2d0547094..0af8a6414 100644
--- a/server/tests/unit/nest/service-identity/registration-dialect.test.ts
+++ b/server/tests/unit/nest/service-identity/registration-dialect.test.ts
@@ -48,7 +48,7 @@ const modules: [string, { registrationDialect: RegistrationDialect; SELF_CHECK:
describe.each(modules)('%s', (_, { registrationDialect: dialect, SELF_CHECK: check }) => {
it('SIDIA-001: computes the password, salt and proof of work the issuer computed', () => {
const { password, salt } = dialect.begin(inputsOf(check)).work(check.nonce);
- expect(sha256(password)).toBe(check.passwordSha256);
+ expect(sha256(password)).toBe(check.inputSha256);
expect(sha256(salt)).toBe(check.saltSha256);
const { N, r, p } = check.challenge;
expect(scryptSync(password, salt, 32, { N, r, p }).toString('hex')).toBe(check.scrypt);