mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix new account again
This commit is contained in:
@@ -12,6 +12,7 @@ export const PkiAcmeAccountsSchema = z.object({
|
||||
profileId: z.string().uuid(),
|
||||
emails: z.string().array(),
|
||||
publicKey: z.unknown(),
|
||||
alg: z.string(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date()
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
},
|
||||
handler: async (req, res) => {
|
||||
const { payload, protectedHeader, jwk } = await server.services.pkiAcme.validateJwsPayload(
|
||||
const { payload, protectedHeader } = await server.services.pkiAcme.validateJwsPayload(
|
||||
req.body as TRawJwsPayload,
|
||||
async (protectedHeader) => {
|
||||
if (!protectedHeader.jwk) {
|
||||
@@ -120,13 +120,11 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
|
||||
},
|
||||
CreateAcmeAccountBodySchema
|
||||
);
|
||||
if (!jwk) {
|
||||
throw new AcmeBadPublicKeyError({ detail: "JWK is required in the protected header" });
|
||||
}
|
||||
const { alg, jwk } = protectedHeader;
|
||||
const { status, body, headers } = await server.services.pkiAcme.createAcmeAccount(
|
||||
req.params.profileId,
|
||||
protectedHeader.alg,
|
||||
jwk,
|
||||
alg,
|
||||
jwk!,
|
||||
payload
|
||||
);
|
||||
// TODO: DRY
|
||||
|
||||
@@ -156,6 +156,7 @@ export const pkiAcmeServiceFactory = ({
|
||||
|
||||
const newAccount = await acmeAccountDAL.create({
|
||||
profileId: profile.id,
|
||||
alg,
|
||||
publicKey: jwk,
|
||||
emails: contact ?? []
|
||||
});
|
||||
|
||||
@@ -40,7 +40,6 @@ export type TFinalizeAcmeOrderPayload = z.infer<typeof FinalizeAcmeOrderBodySche
|
||||
|
||||
export type TJwsPayload<T> = {
|
||||
protectedHeader: TProtectedHeader;
|
||||
jwk?: JsonWebKey;
|
||||
payload: T;
|
||||
};
|
||||
export type TAcmeResponse<TPayload> = {
|
||||
|
||||
Reference in New Issue
Block a user