persist-secure-store
Persist small secrets with Expo SecureStore via @stainless-code/persist/backends/secure-store. ~2KB/key — use partialize; async → useHydrated.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Persist small secrets with Expo SecureStore via @stainless-code/persist/backends/secure-store. ~2KB/key — use partialize; async → useHydrated.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Gate Alpine.js UI on Persist hydration (Alpine.plugin + useHydrated / $hydrated). Use when wiring HydrationSignal into Alpine data components.
Gate Angular UI on Persist hydration with useHydrated (readonly Signal). Call inside an injection context; use when avoiding flash of default state on async backends.
Gate Lit element UI on Persist hydration with HydrationController. Use when wiring HydrationSignal into a ReactiveControllerHost; not a hook.
Persist with React Native AsyncStorage via @stainless-code/persist/backends/async-storage. Use for RN string-wire JSON state; always gate with useHydrated.
Compress a string-wire StateStorage with @stainless-code/persist/backends/compressed (gzip/deflate). Backend wrapper — compose with createStorage; stack compress-then-encrypt.
Cross-tab sync for backends without storage events via @stainless-code/persist/transport/crosstab (createBroadcastCrossTab). Wrap storage + pass crossTabEventTarget; call close() on teardown.
| name | persist-secure-store |
| description | Persist small secrets with Expo SecureStore via @stainless-code/persist/backends/secure-store. ~2KB/key — use partialize; async → useHydrated. |
| license | MIT |
| metadata | {"type":"composition","library":"@stainless-code/persist","library_version":"0.4.1","framework":"expo-secure-store"} |
| requires | ["persist"] |
| sources | ["stainless-code/persist:src/adapters/backends/secure-store.ts"] |
For tokens / small secrets, not full app state (~2KB/key). Async → gate UI. Keys sanitized to /^[\w.-]+$/ (: → _).
bun add @stainless-code/persist expo-secure-store zustand
Peers: expo-secure-store >=12.0.0; example uses zustand (any ./sources/* adapter works).
import { create } from "zustand";
import { createSecureStoreStorage } from "@stainless-code/persist/backends/secure-store";
import { persistStore } from "@stainless-code/persist/sources/zustand";
type Auth = { token: string };
const useAuth = create<Auth>(() => ({ token: "" }));
const storage = createSecureStoreStorage<string>()!;
persistStore(useAuth, {
name: "auth:token:v1",
storage,
partialize: (s) => s.token,
});
partialize.createSecureStoreStorage() · secureStoreStateStorage()See also: persist-mmkv; persist-encrypted.