import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; /** * Codegen spec. This is the raw bridge contract, NOT the public API. * * Every enum crosses as a plain `string` because codegen cannot express TS * string unions — the narrowing lives in `myid-types.ts`, and the native side * uppercases and falls back to the SDK default for anything it does not know. * * Nested object params must be *named* exported type aliases; an inline object * literal degrades to `AnyTypeAnnotation` and loses type safety on both platforms. */ export type MyIdOrganizationDetailsInput = { phone?: string; /** Native asset name: Android drawable / iOS image-set. Not a file path or URL. */ logo?: string; }; export type MyIdConfigInput = { sessionId: string; clientHash: string; clientHashId: string; minAge?: number; distance?: number; residency?: string; environment?: string; entryType?: string; locale?: string; cameraShape?: string; cameraSelector?: string; cameraResolution?: string; imageFormat?: string; screenOrientation?: string; presentationStyle?: string; withSoundGuides?: boolean; showErrorScreen?: boolean; huaweiAppId?: string; organizationDetails?: MyIdOrganizationDetailsInput; }; export type MyIdAppearanceInput = { colorPrimary?: string; colorOnPrimary?: string; colorError?: string; colorOnError?: string; colorOutline?: string; colorDivider?: string; colorSuccess?: string; colorButtonContainer?: string; colorButtonContainerDisabled?: string; colorButtonContent?: string; colorButtonContentDisabled?: string; colorScanButtonContainer?: string; buttonCornerRadius?: number; }; export type MyIdResultPayload = { code: string; base64?: string; }; export interface Spec extends TurboModule { /** * Both params are required at the bridge level — the public wrapper always * sends an appearance object, passing `{}` when the caller omits it. */ start( config: MyIdConfigInput, appearance: MyIdAppearanceInput ): Promise; } export default TurboModuleRegistry.getEnforcing('MyidSdk');