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
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
encryptionKey | readonly | Uint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length32"> & Brand<"EncryptionKey"> & Brand<"OwnerEncryptionKey"> | - | Owner.encryptionKey | packages/common/src/local-first/Owner.ts:56 |
id | readonly | string & Brand<"Id"> & Brand<"OwnerId"> | - | Owner.id | packages/common/src/local-first/Owner.ts:55 |
mnemonic? | readonly | | string & Brand<"Trimmed"> & Brand<"MinLength1"> & Brand<"Mnemonic"> | null | The 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 |
type | readonly | "AppOwner" | - | - | packages/common/src/local-first/Owner.ts:173 |
writeKey | readonly | Uint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length16"> & Brand<"OwnerWriteKey"> | - | Owner.writeKey | packages/common/src/local-first/Owner.ts:57 |