mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:51:12 -05:00
12 lines
407 B
PL/PgSQL
12 lines
407 B
PL/PgSQL
-- Fix hash_session_ip to use pgcrypto from extensions schema
|
|
CREATE OR REPLACE FUNCTION public.hash_session_ip(session_ip inet)
|
|
RETURNS text
|
|
LANGUAGE plpgsql
|
|
IMMUTABLE
|
|
SET search_path = 'public', 'extensions'
|
|
AS $$
|
|
BEGIN
|
|
-- Return last 8 chars of SHA256 hash with asterisks prefix for privacy
|
|
RETURN '****' || RIGHT(encode(digest(session_ip::text || 'session_salt_2025', 'sha256'), 'hex'), 8);
|
|
END;
|
|
$$; |