Skip to main content
@capgo/capacitor-persistent-uuid Auth & Security Open source

Persistent UUID Capacitor plugin

Generate and persist one app-scoped UUID across reinstalls, app updates, and OS updates

Install

bun add @capgo/capacitor-persistent-uuid bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-persistent-uuid
  • pnpm add @capgo/capacitor-persistent-uuid
  • yarn add @capgo/capacitor-persistent-uuid

Guide

How to use Persistent UUID in Capacitor

Using @capgo/capacitor-persistent-uuid

Generate one persistent app-scoped UUID for Capacitor and keep it stable across reinstall and update flows where normal app storage is removed.

Install

npm install @capgo/capacitor-persistent-uuid
npx cap sync

What This Plugin Exposes

  • getId - Read the stored UUID, creating one if none exists for the selected scope.
  • resetId - Rotate the stored UUID for logout, privacy reset, or test cleanup flows.
  • scope - Optional namespace for apps whose debug and production package identifiers differ.

Example Usage

import { PersistentUuid } from '@capgo/capacitor-persistent-uuid';

const { id, created, scope } = await PersistentUuid.getId();

console.log(id);
console.log(created);
console.log(scope);

Share One UUID Across Build Variants

const result = await PersistentUuid.getId({
  scope: 'com.example.app',
});

console.log(result.id);

Reset The Identifier

const replacement = await PersistentUuid.resetId();
console.log(replacement.id);

Platform Notes

Android stores the UUID in AccountManager so it can survive Android Studio reinstall cycles and debug vs Play signing differences when the package name or custom scope is stable. iOS stores the UUID in Keychain and keeps it through app and iOS updates while Keychain access remains compatible. Web uses localStorage as a development fallback.

This plugin does not expose a hardware ID and does not survive factory reset, manual account removal, Keychain clearing, browser storage clearing, or resetId.

Full Reference

Keep Going

If you are using @capgo/capacitor-persistent-uuid to keep app identity stable, connect it with @capgo/capacitor-persistent-uuid for the overview, Getting Started for install and API examples, Android behavior for reinstall details, iOS behavior for Keychain details, and @capgo/capacitor-persistent-account when you need account data persistence instead of a UUID.

FAQ

Persistent UUID plugin FAQ

How do I install the Persistent UUID plugin in a Capacitor app?

Run "bun add @capgo/capacitor-persistent-uuid" (or "npm install @capgo/capacitor-persistent-uuid"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-persistent-uuid" in your app code.

Does @capgo/capacitor-persistent-uuid work with React, Vue and Angular?

Yes. Persistent UUID is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-persistent-uuid support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-persistent-uuid free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-persistent-uuid/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Persistent UUID without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Persistent UUID changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo