From a3f1f4ea3000156506f49dfa09cfbc5df420b3fc Mon Sep 17 00:00:00 2001 From: Miguel Diaz Date: Mon, 27 Jul 2026 22:08:14 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20server:=20add=20auth=20method=20to?= =?UTF-8?q?=20sardine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/test/api/auth.test.ts | 40 ++++++++++++++++++++++++++++---- server/utils/createCredential.ts | 5 +++- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/server/test/api/auth.test.ts b/server/test/api/auth.test.ts index 4d7b8208bf..907645ffaa 100644 --- a/server/test/api/auth.test.ts +++ b/server/test/api/auth.test.ts @@ -437,7 +437,13 @@ describe("authentication", () => { expect(customer).toHaveBeenCalledWith( expect.objectContaining({ flow: { name: "signup", type: "signup" }, - customer: { id, tags: [{ name: "source", value: "12345", type: "string" }] }, + customer: { + id, + tags: [ + { name: "source", value: "12345", type: "string" }, + { name: "auth_method", value: "siwe", type: "string" }, + ], + }, }), ); @@ -463,7 +469,13 @@ describe("authentication", () => { expect(customer).toHaveBeenCalledWith( expect.objectContaining({ flow: { name: "signup", type: "signup" }, - customer: { id, tags: [{ name: "source", value: "EXA", type: "string" }] }, + customer: { + id, + tags: [ + { name: "source", value: "EXA", type: "string" }, + { name: "auth_method", value: "siwe", type: "string" }, + ], + }, }), ); @@ -704,7 +716,13 @@ describe("registration", () => { expect(customer).toHaveBeenCalledWith( expect.objectContaining({ flow: { name: "signup", type: "signup" }, - customer: { id, tags: [{ name: "source", value: "EXA", type: "string" }] }, + customer: { + id, + tags: [ + { name: "source", value: "EXA", type: "string" }, + { name: "auth_method", value: "siwe", type: "string" }, + ], + }, }), ); @@ -775,7 +793,13 @@ describe("registration", () => { expect(customer).toHaveBeenCalledWith( expect.objectContaining({ flow: { name: "signup", type: "signup" }, - customer: { id: "dGVzdC1jcmVkLWlk2", tags: [{ name: "source", value: "12345", type: "string" }] }, + customer: { + id: "dGVzdC1jcmVkLWlk2", + tags: [ + { name: "source", value: "12345", type: "string" }, + { name: "auth_method", value: "webauthn", type: "string" }, + ], + }, }), ); @@ -850,7 +874,13 @@ describe("registration", () => { expect(customer).toHaveBeenCalledWith( expect.objectContaining({ flow: { name: "signup", type: "signup" }, - customer: { id: "YW5vdGhlci1jcmVkLWlk2", tags: [{ name: "source", value: "EXA", type: "string" }] }, + customer: { + id: "YW5vdGhlci1jcmVkLWlk2", + tags: [ + { name: "source", value: "EXA", type: "string" }, + { name: "auth_method", value: "webauthn", type: "string" }, + ], + }, }), ); const credential = await database.query.credentials.findFirst({ diff --git a/server/utils/createCredential.ts b/server/utils/createCredential.ts index 89540a50c2..c1a7a8a283 100644 --- a/server/utils/createCredential.ts +++ b/server/utils/createCredential.ts @@ -60,7 +60,10 @@ export default async function createCredential( flow: { name: "signup", type: "signup" }, customer: { id: credentialId, - tags: [{ name: "source", value: options?.source ?? "EXA", type: "string" }], + tags: [ + { name: "source", value: options?.source ?? "EXA", type: "string" }, + { name: "auth_method", value: isAddress(credentialId) ? "siwe" : "webauthn", type: "string" }, + ], }, }).catch((error: unknown) => captureException(error, { level: "error" })), ]);