mirror of
https://github.com/documenso/documenso.git
synced 2025-11-17 02:01:33 +10:00
fix: refactor auth router (#1983)
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
import { createPasskeySigninOptions } from '@documenso/lib/server-only/auth/create-passkey-signin-options';
|
||||
import { nanoid } from '@documenso/lib/universal/id';
|
||||
|
||||
import { procedure } from '../trpc';
|
||||
import {
|
||||
ZCreatePasskeySigninOptionsRequestSchema,
|
||||
ZCreatePasskeySigninOptionsResponseSchema,
|
||||
} from './create-passkey-signin-options.types';
|
||||
|
||||
export const createPasskeySigninOptionsRoute = procedure
|
||||
.input(ZCreatePasskeySigninOptionsRequestSchema)
|
||||
.output(ZCreatePasskeySigninOptionsResponseSchema)
|
||||
.mutation(async () => {
|
||||
const sessionIdToken = nanoid(16);
|
||||
|
||||
const [sessionId] = decodeURI(sessionIdToken).split('|');
|
||||
|
||||
const options = await createPasskeySigninOptions({ sessionId });
|
||||
|
||||
return {
|
||||
options,
|
||||
sessionId,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user