Skip to content

No db encryption key support for React Native #11737

Closed

Description

@HtSpChakradharCholleti

Issue description

Currently, TypeORM does not provide a way to specify an encryption key when using SQLite databases in React Native environments (e.g., with react-native-quick-sqlite or @op-engineering/op-sqlite). This PR adds support for passing an optional encryptionKey property through the connection options. The key is then included in the database initialization call, enabling developers to use encrypted SQLite databases via libraries such as SQLCipher.

Expected Behavior

Expected Behavior
• Developers can now securely open or create encrypted SQLite databases in React Native using:

  type: 'react-native',
  database: 'app.db',
  encryptionKey: 'my-secret-key',
  driver: 'quick-sqlite', // or 'op-sqlite'
  entities: [...],
});

Actual Behavior

Currently, TypeORM does not provide a way to specify an encryption key when using SQLite databases in React Native environments (e.g., with @op-engineering/op-sqlite).

Steps to reproduce

Create database connection with options including encryptionKey with an encryption supported database.
Verify that the database is not encrypted.

My Environment

Dependency Version
Operating System
Node.js version x.y.zzz
Typescript version x.y.zzz
TypeORM version x.y.zzz

Additional Context

This PR adds support for passing an optional encryptionKey property through the connection options. The key is then included in the database initialization call, enabling developers to use encrypted SQLite databases via libraries such as SQLCipher.

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions