OfflineAppProvider. Import from @offline-protocol/id-react on web or @offline-protocol/id-react-native on mobile. This page covers React 0.2.0 and React Native 0.3.3.
Authentication
React Native additionally exposes
sessionRestoreError with network, unauthorized or unknown reasons. See mobile setup.
Profiles
useProfiles() provides profiles, profileCount and searchProfile(query). Search returns a promise of matching strings. These operations access the hosted profile service.
Connections
useConnections() provides the connections array, addConnection(username) and removeConnection(id). Adding returns a connection or null; removing takes the connection ID and returns a boolean result. In React 0.2.0, each connection has id, peer, sharingLocationWithThem and sharingLocationWithMe, and addConnection returns the same shape. There is no getConnections or isConnected hook method in these published versions.
React 0.2.0 also provides setLocationSharing(connectionId, share), which turns sharing of your location with that peer on or off and updates connections at once. It resolves to a LocationSharingResult whose status is applied, rejected, unknown or superseded. A rejected update restores what the server last confirmed. After an unknown result the list shows sharing as on until the server says otherwise, because it may be on.
Location and sharing
Only the profile owner receives its exactlocation from GET /profiles/{username}. Other callers receive location: null.
Location sharing is opt-in per connection, one-directional and off by default, including existing connections. Set location sharing with { "share": true } to share your own side; use false to turn it off. Connection lists report sharingLocationWithThem and sharingLocationWithMe. Connection locations returns only peers sharing with the caller. Do not infer consent from the existence of a connection.
The public GET /stats/nodes endpoint returns device counts per area for the network map, in three privacy tiers, and never returns a device’s or profile’s location. Responses are paginated, 50 items per page by default.
React Native 0.3.3 has removed useProofOfLocation, and React 0.2.0 has removed useLocation. The hooks in older versions omit the required witness id and ignore attestation replies, so they cannot produce usable witness evidence. Use the standalone @offline-protocol/pol package (0.1.2 on npm), which completes the witness exchange; see Submit a location claim.
Signed credentials
React Native 0.3.3 exportsuseOfflineIdCredential; React 0.2.0 does not. See signed credentials.
