A package to support access to your Data Vault hosted on a Solid Server, implemented by the ANU Software Innovation Institute supporting the Australian Solid Community.
Authors: Anushka Vidanage, Graham Williams, Jessica Moore, Dawei Chen, Kevin Wang, Zheyuan Xu.
Free (as in Libre) and Open Source Software License: MIT
See the AU Solid Community page for apps utilising the solidpod package.
SolidPod provides the core business logic for Dart applications to manage personal online data stores (PODs) hosted in a Data Vault on a Solid Server. It supports authenticating users to their PODs, reading and writing data, and managing access permissions programmatically. The companion solidui package builds on top of SolidPod to provide ready-made Flutter widgets for login screens, permission management, and other user-facing features.
Solid (https://solidproject.org/) is an open standard for a server to host personal online data stores (Pods). Numerous providers of Solid Server hosting are emerging allowing users to host and migrate their Pods on any such servers (or to run their own server).
To know more about our work relatd to Solid Pods visit https://solidcommunity.au
- Authenticate a user against a given Solid server.
- Read and write data files in a POD.
- Read, write and delete large data files.
For UI components such as login screens, security key management, permission granting/revoking, and shared resource views, see the solidui package.
Solid is an open standard for a server providing Data Vaults hosting personal online data stores (Pods). Numerous providers of Solid Server hosts support users host and migrate their Pods. Anyone can also host their own Community Solid Server. To know more about our work visit the ANU's Software Innovation Institute and the Australian Solid Community.
To start using the package add solidpod as a dependency in
your pubspec.yaml file.
dependencies:
solidpod: ^<latest-version>An example project that uses solidpod can be found
in the example
folder of the git repository.
If the package is being used to build either a macos or web app,
the following changes are required in order to make the package fully
functional.
For a release be sure to update
android/app/src/main/AndroidManifest.xml to include within the
queries section of the manifest:
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>Inside the app directory go to the directory /macos/Runner/. Inside
there are two files named DebugProfile.entitlements and
Release.entitlements. Add the following lines inside the <dict> </dict> tag in both files.
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>keychain-access-groups</key>
<array/>
<key>com.apple.security.keychain</key>
<true/>Note: You may already have some of the above lines in those files. If so fill the missing.
Inside the app directory go to the directory /web/. Inside create a
file called callback.html. Add the following piece of code into that
file.
<!DOCTYPE html>
<html>
<head>
<script>
const AUTH_DESTINATION_KEY = "openidconnect_auth_destination_url";
const AUTH_RESPONSE_KEY = "openidconnect_auth_response_info";
window.onload = function () {
if (window.opener && window.opener !== window) {
// Used when working as a popup.
// Uses post message to respond to the parent window
var parent = window.opener ?? window.parent;
parent.postMessage(location.href, "*");
} else { //Used for redirect loop functionality.
//Get the original page destination
const destination =
sessionStorage.getItem(AUTH_DESTINATION_KEY || "/");
sessionStorage.removeItem(AUTH_DESTINATION_KEY);
// Store current window location used to get
// authentication information
sessionStorage.setItem(AUTH_RESPONSE_KEY, window.location);
//Redirect to where we're going so that we can restore state completely
location.assign(destination);
}
}
</script>
</head>
<body>
</body>
</html>Following are the usage of main functionalities supported by the package.
A function to authenticate a user against a given Solid server
https://pods.solidcommunity.au/. Return a list containing
authentication data.
final authData = await solidAuthenticate(
'https://pods.solidcommunity.au/',
context,
);Read data from the file data/myfiles/my-data-file.ttl.
final fileContent = await readPod(
'data/myfiles/my-data-file.ttl',
);Write data to the file myfiles/my-data-file.ttl.
// Turtle string to be written to the file
final turtleString =
'@prefix somePrefix: <http://www.perceive.net/schemas/relationship/> .
<http://example.org/#green-goblin> somePrefix:enemyOf
<http://example.org/#spiderman> .';
await writePod(
'myfiles/my-data-file.ttl',
turtleString,
encrypted: false // non-required parameter. By default set to true
);writePod() also supports using inherited encryption keys and
.acl files. For instance, consider the following use-case.
Use-case: Write two files parentDir/child-1.ttl and parentDir/child-1.ttl
into a single directory parentDir. Use a single .acl file for both
the files and use a single encryption key to encrypt both the files.
Above can be achieved using following lines of code.
// Turtle string to be written to the file
final childDataString = '<Sample TTL Data>';
await writePod(
'parentDir/child-1.ttl',
childDataString,
createAcl: false,
inheritKeyFrom: 'parentDir/',
);
await writePod(
'parentDir/child-2.ttl',
childDataString,
createAcl: false,
inheritKeyFrom: 'parentDir/',
);The above will create a single .acl file for the directory
parentDir and use that as .acl file for both child-1.ttl and
child-2.ttl files. Also it will create a single key associated with
the directory parentDir and encrypt both files using that key.
To upload a large file in application myapp, use:
await writeLargeFile(
// Name of the file in POD
remoteFilePath: 'my-large-file.bin',
// Path of the file where it is locally stored
localFilePath: 'D:/my-large-file.bin',
)The uploaded file will be stored in the myapp/data folder.
To download a large file use:
await readLargeFile(
// Name of the file in POD
remoteFilePath: 'my-large-file.bin',
// Path of the file where it will be locally downloaded
localFilePath: 'D:/my-large-file.bin',
)To delete a large file use:
await deleteLargeFile(
// Name of the file in POD
remoteFilePath: 'my-large-file.bin',
)A Solid Pod's internal storage structure consists of turtle files containing security information about the pod's content (data files) and access. The internal structure is based on the solidpod ontology, which captures essential concepts about the app's security information, data files, encryption, shared resources, and access control lists.
The source code can be accessed via the GitHub repository. You can also file issues at GitHub Issues. The authors of the package will respond to issues as best we can but.
Time-stamp: <Monday 2026-01-19 16:52:57 +1100 Graham Williams>
