solid_encrypt 0.1.7 solid_encrypt: ^0.1.7 copied to clipboard
A data encryption library which can be used to encrypt the content in turtle files stored in Solid PODs.
Solid Encrypt #
Solid Encrypt is an implementation of data encryption which can be used to encrypt the content in turtle files stored in Solid PODs.
The encryption of files works with both Android and Web based client applications. The main fucntionalities in the package include set up encryption keys, encrypt file content, change/update encryption keys, and revoke the encryption.
The strength of this package is that the encryption key is not stored in Solid server, but in local storage. Only the key checksum is saved in the Solid sever.
Features #
- Set up an encryption key for encrypting files in a Solid POD
- Encrypt content of a file in a Solid POD
- Change the encryption key which will re-encrypt all the encrypted files in the POD
- Revoke the encryption completely which will decrypt all encrypted files and remove the encryption key
Dependencies #
To use the Solid Encrypt package you will also need the Solid Auth package. This package uses authentication tokens provided by the Solid Auth package to read and write data from and to Solid PODs.
Usage #
To use this package add solid_encrypt
as a dependency in your pubspec.yaml
file.
An example project that uses solid_auth
can be found here.
Getting authentication data required for the package #
import 'package:solid_auth/solid_auth.dart';
// Example WebID
String _myWebId = 'https://charlieb.solidcommunity.net/profile/card#me';
// Authentication process for the Solid POD using Solid Auth package
var authData = await authenticate(...);
Setting up an encryption key #
import 'package:solid_auth/solid_encrypt.dart';
// Set up encryption client object
EncryptClient encryptClient = EncryptClient(authData, _myWebId);
// Set up encryption key
String encryptKey = 'my-enc-key';
await encryptClient.setupEncKey(encryptKey);
Encrypting files #
import 'package:solid_auth/solid_encrypt.dart';
// Set up encryption client object
EncryptClient encryptClient = EncryptClient(authData, _myWebId);
// Verify and store the encryption key in local storage
String encryptKey = 'my-enc-key';
await encryptClient.verifyEncKey(encryptKey);
// Encrypt files
String encryptFileLocation = 'private/medical-data';
String encryptFileName = 'vaccination_history.ttl'
await encryptClient.encryptFile(encryptFileLocation, encryptFileName);
Update encryption key #
import 'package:solid_auth/solid_encrypt.dart';
// Set up encryption client object
EncryptClient encryptClient = EncryptClient(authData, _myWebId);
// Define old and new encryption keys
String encryptKeyPrev = 'my-enc-key';
String encryptKeyNew = 'my-new-enc-key';
// Update encryption key
await encryptClient.updateEncKey(encryptKeyPrev, encryptKeyNew);
Revoke encryption #
import 'package:solid_auth/solid_encrypt.dart';
// Set up encryption client object
EncryptClient encryptClient = EncryptClient(authData, _myWebId);
// Define encryption keys
String encryptKey = 'my-enc-key';
// Revoke encryption
await encryptClient.revokeEnc(encryptKey);
Additional information #
The source code can be accessed via GitHub repository. You can also file issues you face at GitHub Issues.