Permissions
Public surface (permissions):
camera · microphone · photoLibrary · location · bluetooth · biometric
Outside iOS, permission helpers return a safe default (they do not throw for wrong environment). Network failures on iOS throw MobileLockerError.
type PermissionStatus = | 'authorized' | 'authorized_always' | 'authorized_when_in_use' | 'denied' | 'restricted' | 'not_determined' | 'limited' | 'unknown'
type BiometricType = 'face_id' | 'touch_id' | 'optic_id' | 'none' | 'unknown'
interface PermissionResult { status: PermissionStatus granted: boolean}
interface BiometricResult { available: boolean biometric_type: BiometricType error: string | null}Common permissions
Section titled “Common permissions”camera(): Promise<PermissionResult>microphone(): Promise<PermissionResult>photoLibrary(): Promise<PermissionResult>location(): Promise<PermissionResult>bluetooth(): Promise<PermissionResult>// Outside iOS → { status: 'not_determined', granted: false }import mobilelocker from '@mobilelocker/javascript-sdk'
const camera = await mobilelocker.permissions.camera()const microphone = await mobilelocker.permissions.microphone()const photoLibrary = await mobilelocker.permissions.photoLibrary()const location = await mobilelocker.permissions.location()const bluetooth = await mobilelocker.permissions.bluetooth()
if (!camera.granted) { // prompt user via host settings / UI}Status notes:
- Location may use
'authorized_always'/'authorized_when_in_use' - Photo library may use
'limited'
Biometrics
Section titled “Biometrics”biometric(): Promise<BiometricResult>// Outside iOS → { available: false, biometric_type: 'unknown', error: null }const biometric = await mobilelocker.permissions.biometric()// biometric.available, biometric.biometric_type, biometric.errorRelated
Section titled “Related”- Scanner — camera required in practice
- Environments —
isIOS()
API reference
Section titled “API reference”- Module:
permissions - Types:
PermissionResult,BiometricResult