All files / realm/blong-access/gateway/access accessRegistrationAdd.ts

100% Statements 31/31
100% Branches 2/2
100% Functions 1/1
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x  
import {validation} from '@feasibleone/blong';
 
/**
 * Public RPC endpoint for self-registration (no session token exists yet).
 * Uses `auth: 'login'` so the gateway's MLE layer decrypts the request body
 * (same pre-auth level as `login.token.create`).
 */
export default validation(
    async ({lib: {type}}) =>
        function accessRegistrationAdd() {
            return {
                auth: 'login',
                params: type.Object({
                    emailAddress: type.String(),
                    password: type.String(),
                    firstName: type.String(),
                    middleName: type.Optional(type.String()),
                    lastName: type.String(),
                    birthDate: type.Optional(type.String()),
                    gender: type.Optional(type.String()),
                    nationality: type.Optional(type.String()),
                    occupation: type.Optional(type.String()),
                }),
                result: type.Object({
                    userId: type.String(),
                    personId: type.String(),
                    emailAddress: type.String(),
                }),
            };
        },
);