This commit is contained in:
eric
2026-03-25 16:18:38 -05:00
parent e764abb32a
commit fe051d390d
160 changed files with 0 additions and 250 deletions

View File

@@ -1,36 +0,0 @@
import { requireOptionalNativeModule } from 'expo-modules-core'
export type EasyTierConfigInput = {
networkName: string
networkSecret: string
peerUrls: string[]
}
type NativeModule = {
isAvailable: () => boolean
saveAndPrepareTunnel: (configJson: string) => Promise<Record<string, unknown>>
checkVpnPermissionGranted: () => Promise<Record<string, unknown>>
}
const Native = requireOptionalNativeModule<NativeModule>('ExpoEasyTierVpn')
export function isExpoEasyTierVpnAvailable(): boolean {
try {
return Native?.isAvailable?.() === true
} catch {
return false
}
}
export async function saveAndPrepareTunnel(config: EasyTierConfigInput): Promise<Record<string, unknown>> {
if (!Native?.saveAndPrepareTunnel) {
return { ok: false, reason: 'native_module_missing' }
}
return Native.saveAndPrepareTunnel(JSON.stringify(config))
}
export async function checkVpnPermissionGranted(): Promise<boolean> {
if (!Native?.checkVpnPermissionGranted) return false
const r = await Native.checkVpnPermissionGranted()
return r?.granted === true
}