@last1id/sdk-react-native — CHANGELOG¶
0.1.1¶
Docs only. Production issuer is https://auth.last1.id. client_id accepts the App ID slug or the Client ID UUID.
0.1.0 (initial release)¶
First public version. Companion to @last1id/sdk@^0.3.0.
Added¶
createExpoSecureStoreAdapter(SecureStore, options?)— wraps an injectedexpo-secure-storemodule as aSecureTokenStore. Defaults toWHEN_UNLOCKED_THIS_DEVICE_ONLYKeychain accessibility (survives reboots, not included in iCloud Keychain backup).createMemoryTokenStore(seed?)— in-memory store for tests and "don't remember me" sessions. Includes_dump()for snapshot assertions.loadSecureLast1Client(options)— restore a primedLast1Clientfrom previously-stored tokens. Returnsnullwhen no refresh token is stored (render Connect CTA). Returned client hasonTokensRefreshedpre-wired to persist rotated pairs back to the same store. ToleratesaccessTokenmissing butrefreshTokenpresent (e.g. force-killed mid-refresh) by seeding a sentinel that triggers refresh on first request.beginPkceFlow(options)— builds the authorize URL + PKCE pair + state + nonce. Always includesoffline_accessin the requested scopes so a refresh token is actually issued. Caller handsauthorizeUrltoexpo-web-browser.completePkceFlow(options)— exchanges the authorization code for tokens, persists to the supplied store, decodes theid_tokenpayload to stashidentityId(best-effort, unverified — partner backend handles signature verification), and returns a primedLast1Client. SurfacesLast1AuthErrorwhen the server forgets to issue a refresh token (a sign the consumer omittedoffline_access).clearSecureLast1Tokens(options)— wipes every stored key under the prefix. Idempotent. Use for explicit logout/unlink and as the recovery path from aLast1AuthError.- Re-exports
Last1Client,Last1AuthError,Last1HttpErrorfrom the base SDK so consumers only need one import line.
Security defaults¶
- Keychain class:
WHEN_UNLOCKED_THIS_DEVICE_ONLY(survives reboots, requires device unlock to read, NOT in iCloud Keychain backup). - No biometric gate on refresh-token reads — backgrounded silent refresh would otherwise demand FaceID at the wrong moment.
- Persist failures are swallowed: a transient secure-store write error doesn't break the parent request. The
onAuthErrorcallback (if provided) gets{ kind: "persist_failed", error }so partners can log; the in-memory pair is still good for the current session. - No AsyncStorage fallback. Refresh tokens never touch plaintext storage.
Tests¶
22 vitest cases covering:
- Storage adapter round-trips + expo-secure-store delegation
- PKCE handle shape + offline_access auto-inclusion
- Cold-boot restore + crash-recovery sentinel
- Token rotation persisting to storage
- Multi-tenant prefix isolation
- id_token payload decoding tolerant of malformed input
- Last1AuthError on missing refresh_token from server
- clearSecureLast1Tokens prefix-scoped + idempotent