// Push device registration — the CREDENTIAL-FREE half. // // After the OS issues a push token (via `expo-notifications`), the app upserts a // `_voltro_devices` row so the server can later fan a notification out to it. The // SENDER (APNs/FCM/Expo push) is server-side and creds-gated — see // plans/open/mobile/02-push-pipeline.md. This module only builds the row, purely, // so it is testable without a device. // // `userId` / `tenantId` are deliberately NOT set here: the server stamps them // from the authenticated request (never trusted from the client). import { resolveDeviceRegistration, type DeviceRegistration, type DevicePlatform, type DeviceRegistrationEnv, } from '@voltro/react-native' /** * Build the registration row from an Expo push token + platform. Pure given an * `env` (inject `now` / `locale` / `timezone` in tests); in a real runtime the * locale/timezone defaults come from the device. */ export const buildDeviceRegistration = ( expoPushToken: string, platform: DevicePlatform, env?: DeviceRegistrationEnv, ): DeviceRegistration => resolveDeviceRegistration( { deviceToken: expoPushToken, platform, metadata: { via: 'expo' } }, env, )