Failed to test signature verification

This commit is contained in:
ian
2025-12-03 16:00:04 +07:00
parent 66069aa0a9
commit 8bab86bdaf
4 changed files with 41 additions and 28 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import merchantNonces from '~/db/schema/merchant_nonces'
import { verify } from '~/helpers/signature'
import { UnauthenticatedError } from '~/helpers/errors'
export const apiKey = new Elysia().macro({
export const apiKeyAuth = new Elysia().macro({
verifyKey: {
headers: t.Object({
'x-api-key': t.String(),
@@ -14,7 +14,7 @@ export const apiKey = new Elysia().macro({
'x-signature': t.String(),
'x-timestamp': t.Number(),
}),
body: t.Unknown(),
async beforeHandle({ headers, body }) {
const apiKey = headers['x-api-key']
const nonce = headers['x-nonce']