diff --git a/package.json b/package.json index 296546b..9639d29 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "rxjs": "^7.8.1", "sharp": "^0.35.5", "swagger-ui-express": "^5.0.1", - "tc-core-library-js": "github:topcoder-platform/tc-core-library-js#v4.0.0-rc.2", + "tc-core-library-js": "https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a", "uuid": "^14.0.1", "winston": "^3.1.0", "yamljs": "^0.3.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 544d33b..f59cf02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -192,8 +192,8 @@ importers: specifier: ^5.0.1 version: 5.0.1(express@4.22.1(supports-color@8.1.1)) tc-core-library-js: - specifier: github:topcoder-platform/tc-core-library-js#v4.0.0-rc.2 - version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6(supports-color@8.1.1) + specifier: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a + version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a(supports-color@8.1.1) uuid: specifier: ^14.0.1 version: 14.0.1 @@ -3576,9 +3576,9 @@ packages: resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} engines: {node: '>=6'} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6: - resolution: {gitHosted: true, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6} - version: 4.0.0-rc.2 + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a: + resolution: {gitHosted: true, integrity: sha512-n+4KUOeV4LEIsTI/R216dBc6bUkbSyO/2O0LpoY3Hk7eqKsRQFUHloB3y0hfK/v1rzf8qYQxTdv8ikeRGBn4pQ==, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a} + version: 4.0.0-rc.2.1 engines: {node: '>=22.13'} tc-identity-service@https://codeload.github.com/topcoder-platform/identity-api-v6/tar.gz/1b34a83edf9382dd16e8289a5704702a6b19b9d6: @@ -7697,7 +7697,7 @@ snapshots: tapable@2.3.0: {} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6(supports-color@8.1.1): + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a(supports-color@8.1.1): dependencies: '@types/jsonwebtoken': 9.0.10 jsonwebtoken: 9.0.3 diff --git a/test/unit/jwt-configuration.test.ts b/test/unit/jwt-configuration.test.ts index 545b826..b6e373d 100644 --- a/test/unit/jwt-configuration.test.ts +++ b/test/unit/jwt-configuration.test.ts @@ -66,7 +66,7 @@ describe('route JWT configuration', () => { } it('accepts browser RSA tokens using JWT_AUDIENCE', async () => { - const token = jwt.sign({ userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 }); const result = await verify(token); assert.equal(result.status, 200); assert.equal(result.user.isMachine, false); @@ -80,12 +80,12 @@ describe('route JWT configuration', () => { }); it('retains legacy HS256 human tokens without an audience', async () => { - const token = jwt.sign({ userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 }); assert.equal((await verify(token)).status, 200); }); it('rejects an untrusted audience', async () => { - const token = jwt.sign({ userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 }); assert.equal((await verify(token)).status, 401); }); @@ -95,7 +95,7 @@ describe('route JWT configuration', () => { }); it('rejects an invalid signature', async () => { - const token = jwt.sign({ userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 }); assert.equal((await verify(token)).status, 401); }); });