Skip to content

Commit dd4ac0d

Browse files
committed
refactor(signup): use auth-client directly for signup instead of gql
1 parent fc6721f commit dd4ac0d

9 files changed

Lines changed: 99 additions & 355 deletions

File tree

packages/fxa-graphql-api/src/gql/account.resolver.spec.ts

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -701,77 +701,6 @@ describe('#integration - AccountResolver', () => {
701701
});
702702
});
703703

704-
describe('signUp', () => {
705-
it('calls auth-client and proxy the result', async () => {
706-
const now = Date.now();
707-
const mockRespPayload = {
708-
clientMutationId: 'testid',
709-
uid: '1337',
710-
sessionToken: '2048',
711-
sessionVerified: true,
712-
authAt: now,
713-
};
714-
authClient.signUpWithAuthPW = jest
715-
.fn()
716-
.mockResolvedValue(mockRespPayload);
717-
const result = await resolver.signUp(headers, {
718-
authPW: '00000000',
719-
720-
options: { service: 'testo-co' },
721-
});
722-
expect(authClient.signUpWithAuthPW).toBeCalledTimes(1);
723-
expect(authClient.signUpWithAuthPW).toBeCalledWith(
724-
725-
'00000000',
726-
{},
727-
{ service: 'testo-co' },
728-
headers
729-
);
730-
expect(result).toStrictEqual(mockRespPayload);
731-
});
732-
733-
it('calls auth-client and proxy the result with V2 password', async () => {
734-
const now = Date.now();
735-
const mockRespPayload = {
736-
clientMutationId: 'testid',
737-
uid: '1337',
738-
sessionToken: '2048',
739-
sessionVerified: true,
740-
authAt: now,
741-
};
742-
authClient.signUpWithAuthPW = jest
743-
.fn()
744-
.mockResolvedValue(mockRespPayload);
745-
const result = await resolver.signUp(headers, {
746-
authPW: '00000000',
747-
748-
passwordV2: {
749-
wrapKb: '1234'.repeat(8),
750-
authPWVersion2: '1234'.repeat(8),
751-
wrapKbVersion2: '1234'.repeat(8),
752-
clientSalt:
753-
'identity.mozilla.com/picl/v1/quickStretchV2:0123456789abcdef0123456789abcdef',
754-
},
755-
options: { service: 'testo-co' },
756-
});
757-
expect(authClient.signUpWithAuthPW).toBeCalledTimes(1);
758-
expect(authClient.signUpWithAuthPW).toBeCalledWith(
759-
760-
'00000000',
761-
{
762-
wrapKb: '1234'.repeat(8),
763-
authPWVersion2: '1234'.repeat(8),
764-
wrapKbVersion2: '1234'.repeat(8),
765-
clientSalt:
766-
'identity.mozilla.com/picl/v1/quickStretchV2:0123456789abcdef0123456789abcdef',
767-
},
768-
{ service: 'testo-co' },
769-
headers
770-
);
771-
expect(result).toStrictEqual(mockRespPayload);
772-
});
773-
});
774-
775704
describe('finishSetup', () => {
776705
it('calls auth-client and proxy the result', async () => {
777706
const mockRespPayload = {

packages/fxa-graphql-api/src/gql/account.resolver.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import { DeleteAvatarInput } from './dto/input/delete-avatar';
6363
import { MetricsOptInput } from './dto/input/metrics-opt';
6464
import { RejectUnblockCodeInput } from './dto/input/reject-unblock-code';
6565
import { SignInInput } from './dto/input/sign-in';
66-
import { SignUpInput } from './dto/input/sign-up';
6766
import {
6867
AccountResetPayload,
6968
AccountStatusPayload,
@@ -83,7 +82,6 @@ import {
8382
WrappedKeysPayload,
8483
} from './dto/payload';
8584
import { SignedInAccountPayload } from './dto/payload/signed-in-account';
86-
import { SignedUpAccountPayload } from './dto/payload/signed-up-account';
8785
import { CatchGatewayError } from './lib/error';
8886
import { Account as AccountType } from './model/account';
8987
import { uuidTransformer } from 'fxa-shared/db/transformers';
@@ -585,28 +583,6 @@ export class AccountResolver {
585583
};
586584
}
587585

588-
@Mutation((returns) => SignedUpAccountPayload, {
589-
description: 'Call auth-server to sign up an account',
590-
})
591-
@CatchGatewayError
592-
public async signUp(
593-
@GqlXHeaders() headers: Headers,
594-
@Args('input', { type: () => SignUpInput })
595-
input: SignUpInput
596-
): Promise<SignedUpAccountPayload> {
597-
const result = await this.authAPI.signUpWithAuthPW(
598-
input.email,
599-
input.authPW,
600-
input.passwordV2 || {},
601-
input.options,
602-
headers
603-
);
604-
return {
605-
clientMutationId: input.clientMutationId,
606-
...result,
607-
};
608-
}
609-
610586
@Mutation((returns) => FinishedSetupAccountPayload, {
611587
description: 'Call auth-server to finish signing up a "stub" account',
612588
})

packages/fxa-graphql-api/src/gql/dto/input/sign-up.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.

packages/fxa-graphql-api/src/gql/dto/payload/signed-up-account.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)