From a7b002d02bd1bb3064b2d70e011b9e80209b7dda Mon Sep 17 00:00:00 2001 From: chereseeriepa Date: Thu, 25 Jul 2024 11:43:23 +1200 Subject: [PATCH 1/4] fix: update indexdb readme --- packages/indexdb/README.md | 84 ++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/packages/indexdb/README.md b/packages/indexdb/README.md index e825a37..9c38aaa 100644 --- a/packages/indexdb/README.md +++ b/packages/indexdb/README.md @@ -1,28 +1,80 @@ # @pluto-encrypted/indexdb -This package contains a RXDB compatible wrapper over IndexDB and can be used as database engine inside @pluto-encrypted package with secure database encryption. -### Documentation -[@Pluto-encrypted REFERENCE](https://github.com/elribonazo/pluto-encrypted/blob/master/docs/README.md) +## Overview -### How to use +`@pluto-encrypted/indexdb` is a package that provides secure, encrypted interactions with the IndexedDB database. By leveraging encryption for data at rest and during transactions, this package ensures data integrity and confidentiality, making it ideal for applications that demand enhanced data security. -Creating a IndexDB compatible storage is very simple. +This package includes `@pluto-encrypted/encryption`, which serves as an RxDB wrapper over IndexedDB. This integration allows developers to easily incorporate encrypted storage solutions within their RxDB-based applications, providing seamless and robust data protection. + +## Installation + +To install the `@pluto-encrypted/indexdb` package, use npm or yarn: + +```bash +npm install @pluto-encrypted/indexdb +``` + +or + +```bash +yarn add @pluto-encrypted/indexdb +``` + +## Usage + +### Initialization + +The `@pluto-encrypted/indexdb` package leverages `rxdb` and the `wrappedKeyEncryptionStorage` method from `@pluto-encrypted/encryption` to provide a secure storage solution. Below is the main export for the package: + +```javascript +import { wrappedKeyEncryptionStorage } from '@pluto-encrypted/encryption'; +import { type RxStorage } from 'rxdb'; +import { getRxStorageDexie } from 'rxdb/plugins/storage-dexie'; + +const storage: RxStorage = wrappedKeyEncryptionStorage({ + storage: getRxStorageDexie() +}); + +export default storage; +``` + +### Using with Atala Prism Wallet SDK + +Here is a practical example of how to integrate `@pluto-encrypted/indexdb` with the Atala Prism Wallet SDK: ```typescript -import IndexDB from "@pluto-encrypted/indexdb"; -import { Database } from "@pluto-encrypted/database"; -//default password must be 32 bytes long -const defaultPassword = new Uint8Array(32).fill(1); -const database = db = await Database.createEncrypted( - { - name: `my-db`, - encryptionKey: defaultPassword, - storage: IndexDB, - } -); +import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk' +import IndexDB from '@pluto-encrypted/indexdb' + +const mediatorDIDString = 'your-mediator-did-string'; // Replace with your actual mediator DID string +const mediatorDID = Domain.DID.fromString(mediatorDIDString); +const store = new Store({ + name: 'my-app-db', + storage: IndexDB, + password: 'something secure 1235!' // Use a secure password +}); +const apollo = new Apollo(); +const pluto = new Pluto(store, apollo); + +const agent = Agent.initialize({ mediatorDID, pluto, apollo }); ``` +## Contributing + +We welcome contributions! Please read our [Contributing Guide](https://github.com/atala-community-projects/pluto-encrypted/blob/master/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. + +## License + +This project is licensed under the Apache License, Version 2.0. See [LICENCE](./LICENSE) file for the full terms and conditions. + +## Support + +If you have any questions or need help, feel free to open an issue on our [GitHub repository](https://github.com/atala-community-projects/pluto-encrypted/issues). + +--- + ## QA & Documentation + | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | | ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) | From 2b8502b6f75bf70171bca3b055e4151c1e0eaa7f Mon Sep 17 00:00:00 2001 From: chereseeriepa Date: Thu, 25 Jul 2024 11:52:29 +1200 Subject: [PATCH 2/4] fix: update inmemory readme --- packages/inmemory/README.md | 86 +++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 17 deletions(-) diff --git a/packages/inmemory/README.md b/packages/inmemory/README.md index 84ef4de..76ec016 100644 --- a/packages/inmemory/README.md +++ b/packages/inmemory/README.md @@ -1,30 +1,82 @@ # @pluto-encrypted/inmemory -This package contains a RXDB compatible wrapper over inmemory and can be used as database engine inside @pluto-encrypted package with secure database encryption. -### Documentation -[@Pluto-encrypted REFERENCE](https://github.com/elribonazo/pluto-encrypted/blob/master/docs/README.md) +## Overview -### How to use +`@pluto-encrypted/inmemory` is a package that provides a secure, encrypted in-memory storage solution for RxDB. By utilizing encryption for data stored in memory, this package ensures the integrity and confidentiality of transient data. It is ideal for applications where secure handling of data in memory is essential, without persisting it to disk. -Creating a InMemory compatible storage is very simple. +This package integrates with `@pluto-encrypted/encryption`, offering an RxDB adapter that wraps in-memory storage with encryption features. This enables developers to implement secure in-memory storage solutions effortlessly within their RxDB-based applications. + +## Installation + +To install the `@pluto-encrypted/inmemory` package, use npm or yarn: + +```bash +npm install @pluto-encrypted/inmemory +``` + +or + +```bash +yarn add @pluto-encrypted/inmemory +``` + +## Usage + +### Initialization + +The `@pluto-encrypted/inmemory` package leverages `rxdb` and the `wrappedKeyEncryptionStorage` method from `@pluto-encrypted/encryption` to provide an encrypted in-memory storage adapter. Below is the main export for the package: + +```javascript +import { wrappedKeyEncryptionStorage } from '@pluto-encrypted/encryption'; +import { type RxStorage } from 'rxdb'; +import { getRxStorageMemory } from 'rxdb/plugins/storage-memory'; + +const storage: RxStorage = wrappedKeyEncryptionStorage({ + storage: getRxStorageMemory() +}); + +export default storage; +``` + +### Using with Atala Prism Wallet SDK + +Here is an example of how to integrate `@pluto-encrypted/inmemory` with the Atala Prism Wallet SDK: ```typescript -import InMemory from "@pluto-encrypted/inmemory"; -import { Database } from "@pluto-encrypted/database"; -//default password must be 32 bytes long -const defaultPassword = new Uint8Array(32).fill(1); -const database = db = await Database.createEncrypted( - { - name: `my-db`, - encryptionKey: defaultPassword, - storage: InMemory, - } -); +import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk'; +import InMemory from '@pluto-encrypted/inmemory'; + +const mediatorDIDString = 'your-mediator-did-string'; // Replace with your actual mediator DID string +const mediatorDID = Domain.DID.fromString(mediatorDIDString); +const store = new Store({ + name: 'my-app-db', + storage: InMemory, + password: 'something secure 1235!' // Use a secure password +}); +const apollo = new Apollo(); +const pluto = new Pluto(store, apollo); + +const agent = Agent.initialize({ mediatorDID, pluto, apollo }); ``` +## Contributing + +We welcome contributions! Please read our [Contributing Guide](https://github.com/atala-community-projects/pluto-encrypted/blob/master/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. + +## License + +This project is licensed under the Apache License, Version 2.0. See [LICENSE](./LICENSE) for the full terms and conditions. + +## Support + +If you have any questions or need help, feel free to open an issue on our [GitHub repository](https://github.com/atala-community-projects/pluto-encrypted/issues). + +--- + ## QA & Documentation + | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | | ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) | - +--- From 57b6dff3b82bf71b92b5e912a700ecae5aea656c Mon Sep 17 00:00:00 2001 From: chereseeriepa Date: Thu, 25 Jul 2024 12:00:14 +1200 Subject: [PATCH 3/4] fix: update leveldb readme --- packages/leveldb/README.md | 97 ++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 19 deletions(-) diff --git a/packages/leveldb/README.md b/packages/leveldb/README.md index 4dc6aca..b8c1c93 100644 --- a/packages/leveldb/README.md +++ b/packages/leveldb/README.md @@ -1,31 +1,90 @@ # @pluto-encrypted/leveldb -This package contains a RXDB compatible wrapper over leveldb and can be used as database engine inside @pluto-encrypted package with secure database encryption. -### Documentation -[@Pluto-encrypted REFERENCE](https://github.com/elribonazo/pluto-encrypted/blob/master/docs/README.md) +## Overview -### How to use +`@pluto-encrypted/leveldb` provides a secure, encrypted storage solution for RxDB using LevelDB. By integrating encryption middleware, this package ensures data security and confidentiality while leveraging LevelDB's persistence features. It is ideal for applications that require robust and secure storage capabilities. -Creating a levelDB compatible storage is very simple. +This package uses `@pluto-encrypted/encryption` to wrap LevelDB with encryption, allowing for seamless integration with RxDB-based applications. + +## Installation + +To install the `@pluto-encrypted/leveldb` package, use npm or yarn: + +```bash +npm install @pluto-encrypted/leveldb +``` + +or + +```bash +yarn add @pluto-encrypted/leveldb +``` + +## Usage + +### Initialization + +To use `@pluto-encrypted/leveldb` with RxDB, you need to create an encrypted LevelDB storage instance. Below is an example of how to set it up: ```typescript -import { createLevelDBStorage } from "@pluto-encrypted/leveldb"; -import { Database } from "@pluto-encrypted/database"; -//default password must be 32 bytes long +import { createLevelDBStorage } from '@pluto-encrypted/leveldb'; +import { Database } from '@pluto-encrypted/database'; + +// Ensure the default password is 32 bytes long const defaultPassword = new Uint8Array(32).fill(1); -const database = db = await Database.createEncrypted( - { - name: `my-db`, - encryptionKey: defaultPassword, - storage: createLevelDBStorage({ - dbName: "demo", - dbPath: "/tmp/demo" - }), - } -); + +const database = await Database.createEncrypted({ + name: 'my-db', + encryptionKey: defaultPassword, + storage: createLevelDBStorage({ + dbName: 'demo', + dbPath: '/tmp/demo' // Adjust the path as needed + }) +}); +``` + +### Using with Atala Prism Wallet SDK + +Here’s how to integrate `@pluto-encrypted/leveldb` with the Atala Prism Wallet SDK: + +```typescript +import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk'; +import { createLevelDBStorage } from '@pluto-encrypted/leveldb'; + +const mediatorDIDString = 'your-mediator-did-string'; // Replace with your actual mediator DID string +const mediatorDID = Domain.DID.fromString(mediatorDIDString); + +const store = new Store({ + name: 'my-app-db', + storage: createLevelDBStorage({ + dbName: 'my-app-db', + dbPath: '/path/to/db' + }), + password: 'something secure 1235!' // Use a secure password +}); +const apollo = new Apollo(); +const pluto = new Pluto(store, apollo); + +const agent = Agent.initialize({ mediatorDID, pluto, apollo }); ``` +## Contributing + +We welcome contributions! Please read our [Contributing Guide](https://github.com/atala-community-projects/pluto-encrypted/blob/master/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. + +## License + +This project is licensed under the Apache License, Version 2.0. See [LICENSE](./LICENSE) for the full terms and conditions. + +## Support + +If you have any questions or need help, feel free to open an issue on our [GitHub repository](https://github.com/atala-community-projects/pluto-encrypted/issues). + +--- + ## QA & Documentation | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | -| ![Statements](https://img.shields.io/badge/statements-92.85%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-75%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-94.11%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-94.5%25-brightgreen.svg?style=flat) | +| ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) | + +--- From 0d2570b4db08d1892cd3e8a6a4c7c9a46252a1f3 Mon Sep 17 00:00:00 2001 From: chereseeriepa Date: Thu, 25 Jul 2024 12:04:07 +1200 Subject: [PATCH 4/4] fix: add link to the sdk --- packages/indexdb/README.md | 2 +- packages/inmemory/README.md | 2 +- packages/leveldb/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/indexdb/README.md b/packages/indexdb/README.md index 9c38aaa..f816345 100644 --- a/packages/indexdb/README.md +++ b/packages/indexdb/README.md @@ -40,7 +40,7 @@ export default storage; ### Using with Atala Prism Wallet SDK -Here is a practical example of how to integrate `@pluto-encrypted/indexdb` with the Atala Prism Wallet SDK: +Here is a practical example of how to integrate `@pluto-encrypted/indexdb` with the [Atala Prism Wallet SDK](https://github.com/hyperledger/identus-edge-agent-sdk-ts): ```typescript import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk' diff --git a/packages/inmemory/README.md b/packages/inmemory/README.md index 76ec016..436293f 100644 --- a/packages/inmemory/README.md +++ b/packages/inmemory/README.md @@ -40,7 +40,7 @@ export default storage; ### Using with Atala Prism Wallet SDK -Here is an example of how to integrate `@pluto-encrypted/inmemory` with the Atala Prism Wallet SDK: +Here is an example of how to integrate `@pluto-encrypted/inmemory` with the [Atala Prism Wallet SDK](https://github.com/hyperledger/identus-edge-agent-sdk-ts): ```typescript import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk'; diff --git a/packages/leveldb/README.md b/packages/leveldb/README.md index b8c1c93..e523624 100644 --- a/packages/leveldb/README.md +++ b/packages/leveldb/README.md @@ -45,7 +45,7 @@ const database = await Database.createEncrypted({ ### Using with Atala Prism Wallet SDK -Here’s how to integrate `@pluto-encrypted/leveldb` with the Atala Prism Wallet SDK: +Here’s how to integrate `@pluto-encrypted/leveldb` with the [Atala Prism Wallet SDK](https://github.com/hyperledger/identus-edge-agent-sdk-ts): ```typescript import { Agent, Domain, Store, Apollo, Pluto } from '@atala/prism-wallet-sdk';