API reference / @evolu/common / local-first / AppOwner

Interface: AppOwner

Defined in: packages/common/src/local-first/Owner.ts:172

The AppOwner represents the application owner. It's created using a cryptographically secure random generator or derived from an external source, e.g., mnemonic stored securely in a hardware device.

While it's possible to store all application data in AppOwner, the better approach is to use it only for sync coordination. Storing all app data in AppOwner means that data will be stored/synced forever. And that's a problem if we want to provide real data deletion or in-app data migration without data duplication. In local-first apps/distributed systems, we can't delete individual changes, we only mark them as deleted, otherwise sync could not work.

If we really want to delete data or at least avoid syncing it, we must store it using a different owner than AppOwner, e.g. ShardOwner or SharedOwner, and delete that owner. The AppOwner itself must be preserved because it coordinates deletion information across devices. Other devices need to sync the information that an owner was deleted so they can delete their local data as well.

Privacy Considerations

AppOwner must never be shared with anyone, except for its OwnerId, which can be used for authorization with createOwnerWebSocketTransport. It's safe because OwnerId is pseudonymous (it can't be assigned to a specific person).

For data sharing scenarios, use SharedOwner and SharedReadonlyOwner instead, which are designed specifically for collaborative access.

Extends

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
encryptionKeyreadonlyUint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length32"> & Brand<"EncryptionKey"> & Brand<"OwnerEncryptionKey">-Owner.encryptionKeypackages/common/src/local-first/Owner.ts:56
idreadonlystring & Brand<"Id"> & Brand<"OwnerId">-Owner.idpackages/common/src/local-first/Owner.ts:55
mnemonic?readonly| string & Brand<"Trimmed"> & Brand<"MinLength1"> & Brand<"Mnemonic"> | nullThe mnemonic that was used to derive the AppOwner keys. Optional when the AppOwner is created from external keys to avoid sharing the mnemonic with the Evolu app.-packages/common/src/local-first/Owner.ts:180
typereadonly"AppOwner"--packages/common/src/local-first/Owner.ts:173
writeKeyreadonlyUint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length16"> & Brand<"OwnerWriteKey">-Owner.writeKeypackages/common/src/local-first/Owner.ts:57

Was this page helpful?