import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { decryptHandoffValue, encryptHandoffValue } from '../lib/handoff-crypto' describe('handoff encryption', () => { const context = JSON.stringify(['token', 'consent', 'user', 'https://brand.example', 'provider_code']) beforeEach(() => vi.stubEnv('SUPABASE_SERVICE_ROLE_KEY', 'test-only-server-secret')) afterEach(() => vi.unstubAllEnvs()) it('encrypts identical values differently and preserves Unicode error text', () => { const plaintext = 'Återanrop: känsligt fel