Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/functional-tests/lib/targets/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@ export abstract class BaseTarget {
readonly authServerUrl: string,
emailUrl?: string
) {
// Default to v2 key stretching — that's the state new accounts are
// created in nowadays. Creating accounts as v1 here means the first
// sign-in triggers a v1→v2 upgrade (password/change/start + finish)
// that bumps account.verifierSetAt; subsequent OAuth /authorization
// calls reusing the cached session then 401 on assertion validation.
const keyStretchVersion = parseInt(
process.env.AUTH_CLIENT_KEY_STRETCH_VERSION || '1'
process.env.AUTH_CLIENT_KEY_STRETCH_VERSION || '2'
);
this.authClient = this.createAuthClient(keyStretchVersion);
this.emailClient = new EmailClient(emailUrl);
}

createAuthClient(keyStretchVersion = 1): AuthClient {
createAuthClient(keyStretchVersion = 2): AuthClient {
if (![1, 2].includes(keyStretchVersion)) {
throw new Error(
`Invalid keyStretchVersion =${keyStretchVersion}. The` +
Expand Down
6 changes: 4 additions & 2 deletions packages/functional-tests/tests/misc/authClientV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ test.describe('auth-client-tests', () => {
target,
testAccountTracker,
}) => {
const client = target.authClient;
// target.authClient defaults to v2 now; force v1 for this test.
const client = target.createAuthClient(1);
const { email, password } = testAccountTracker.generateAccountDetails();

await signUp(client, email, password, target);
Expand Down Expand Up @@ -127,7 +128,8 @@ test.describe('auth-client-tests', () => {
target,
testAccountTracker,
}) => {
const client = target.authClient;
// target.authClient defaults to v2 now; force v1 for this test.
const client = target.createAuthClient(1);
const { email, password } = testAccountTracker.generateAccountDetails();

await signUp(client, email, password, target);
Expand Down
Loading