PERMISSIONS
Cross-platform permission registry and runtime helpers for Expo, React Native, and React Native Web apps, with unified request/check APIs for camera, media, location, notifications, microphone, and other web/native capabilities.
Usage
CLI
Ankhorage packages expose their command-line interface through ankh. Use ankh --help to discover available package commands, or run a package command with --help for package-specific usage.
# Install the Ankhorage CLI
bun add --global @ankhorage/ankh
# Show usage information for permissions
ankh permissions --help
Basic permissions
Basic permissions runtime example.
Create a permission client, provide it at the app root, and use
usePermission to read, refresh, and request a normalized permission state.
export default function BasicPermissionsExample() {
return (
<PermissionsProvider client={permissionClient}>
<CameraPermissionExample />
</PermissionsProvider>
);
}
This package contains 1 additional example. See the generated documentation for the complete set.
Generated documentation
- Interactive documentation app
- Public API reference
- Component registry
- Architecture overview
- Module relationships
- Export graph
- assertKnownPermission sequence
- createFakePermissionClient sequence
- createWebPermissionClient sequence
- getPermissionDefinition sequence
- normalizePermissionState sequence
- PermissionsProvider sequence
- usePermission sequence
- usePermissions sequence
Public API
Utilities
createFakePermissionClient
createFakePermissionClient(options?: FakePermissionClientOptions) => FakePermissionClient
Creates a deterministic in-memory client for tests and examples.
Fake clients make permission flows testable without native devices, browser prompts, simulators, or network access.
Module: src/testing/index.ts
Source: src/testing/index.ts:61:1
Related symbols: FakePermissionClient, FakePermissionClientOptions
createPermissionClient
createPermissionClient() => PermissionClient
Creates a permission client backed by Expo SDK modules.
Denials that Expo cannot request again are normalized to blocked. Limited
media-library access and provisional or ephemeral iOS notification access
are normalized to usable limited states, where granted remains true.
The client requires expo-linking for settings recovery and rejects with a
stable error when the operating-system settings page cannot be opened.
Expo modules are loaded only when a client operation uses them. The package root and Expo manifest metadata remain free of native module imports.
Module: src/expo/client.ts
Source: src/expo/client.ts:38:1
Related symbols: PermissionClient
createPermissionManager
createPermissionManager(client: PermissionClient) => PermissionManager
Creates a permission manager from a runtime-specific client.
The manager validates permission names and normalizes client results. Native app configuration remains a separate build-time concern.
Module: src/manager/createPermissionManager.ts
Source: src/manager/createPermissionManager.ts:21:1
Related symbols: PermissionClient, PermissionManager
createWebPermissionClient
createWebPermissionClient(options?: WebPermissionClientOptions) => PermissionClient
Creates a browser permission client using guarded structural globals.
Unsupported web APIs resolve to status: 'unavailable'. The adapter does not
import DOM types and does not assume it is running in a browser.
Module: src/web/index.ts
Source: src/web/index.ts:80:1
Related symbols: PermissionClient, WebPermissionClientOptions
Permission
Common runtime permissions supported by the registry.
The registry is intentionally platform-neutral. Adapters translate each permission into whatever a browser, React Native app, Expo app, or test environment can actually check or request.
Module: src/registry/permissions.ts
Source: src/registry/permissions.ts:9:1
PermissionsProvider
PermissionsProvider({
children,
client,
manager,
}: PermissionsProviderProps) => ReactNode
Provides a permission manager to React hooks.
React helpers are framework-neutral. They depend on React only and do not import browser, Expo, or React Native permission APIs.
Related types: PermissionsProviderProps
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | ReactNode | undefined | no | — | |
| client | PermissionClient | undefined | no | — | |
| manager | PermissionManager | undefined | no | — |