teamhanko / passkeys

FIDO2-certified passkey server and SDKs for adding passkey support to any auth system
https://hanko.io/passkey-api
GNU Affero General Public License v3.0
115 stars 8 forks source link

Check transaction_id before storing it #62

Closed FreddyDevelop closed 4 months ago

FreddyDevelop commented 5 months ago

We should check if the transaction_id already exists tor a tenant. Currently when a transaction_id is used twice while initialising a transaction status code 500 is returned because when trying to store the transaction an error is returned from the DB:

failed to store transaction: failed to close prepared statement: ERROR: current transaction is aborted, commands ignored until end of transaction block (SQLSTATE 25P02): ERROR: duplicate key value violates unique constraint \"transactions_identifier_tenant_id_idx\" (SQLSTATE 23505)

We should return status code 409 - Conflict when the transaction_id already exists.