AGENT SKILL

persist-mmkv

Persist with react-native-mmkv via @stainless-code/persist/backends/mmkv (createMmkvStorage). Sync JSON string-wire; id required; optional MMKV encryptionKey (≤16 bytes).

License 许可
MIT
最近更新
2026-11-01
Stars
★ 5
Forks
0

01 前言 Front Matter

name
persist-mmkv
license
MIT
sources
[ "stainless-code/persist:src/adapters/backends/mmkv.ts" ]
metadata
{ "type": "composition", "library": "@stainless-code/persist", "framework": "react-native-mmkv", "library_version": "0.4.1" }
requires
[ "persist" ]
description
Persist with react-native-mmkv via @stainless-code/persist/backends/mmkv (createMmkvStorage). Sync JSON string-wire; id required; optional MMKV encryptionKey (≤16 bytes).

03 SKILL.md 正文

MMKV backend

Sync backend — no hydrate UI gate required for flash. JSON string-wire. id namespaces the MMKV file. encryptionKey is MMKV's own key (max 16 bytes), not persist-encrypted.

Install

bun add @stainless-code/persist react-native-mmkv

Peer: react-native-mmkv >=4.0.0.

Minimal wiring

import { createMmkvStorage } from "@stainless-code/persist/backends/mmkv";

const storage = createMmkvStorage<Prefs>({ id: "app-prefs" })!;

Common mistakes

  • Gating like IDB — MMKV is sync.
  • Confusing encryptionKey with backends/encrypted.
  • Omitting id.

API surface

  • createMmkvStorage({ id, path?, encryptionKey? }) · mmkvStateStorage(instance)

See also: persist-async-storage; persist-encrypted for WebCrypto AES-GCM.

04 同仓库更多 Skills