solidpod library
Support for flutter apps accessing solid PODs.
Copyright (C) 2024-2025, Software Innovation Institute, ANU.
Licensed under the MIT License (the "License").
License: https://choosealicense.com/licenses/mit/.
Authors: Graham Williams, Anushka Vidanage
Classes
- AppInfo
- AppInfo is class that stores the information of a particular app (i.e. the app that invokes methods of this class), including: name, version, canonical name, package name, build number.
- GrantPermissionUi
- A StatefulWidget for showing and editing access permissions to a file. It displays the permission table of users with access, and allows the user to change access permissions: by granting access to others, changing a recipients access permissions or revoking access permissions.
- GrantPermissionUiState
- Class to build a UI for granting permission to a given file
- KeyManager
- KeyManager is a class to manage security key and encryption keys for data stored in PODs.
- SecurityColors
- Colours used across security dialogs and prompts.
- SecurityKeyUI
- A flexible StatefulWidget for security key operations with improved UI and WebID display.
- SecurityLayout
- Layout constants used across security dialogs and prompts.
- SecurityStrings
- Common text strings used across security dialogs and prompts.
- SecurityTextStyles
- Text styles used across security dialogs and prompts.
- A widget for the demonstration screen of the application.
- Class to build a UI for granting permission to a given file
Enums
- PathType
- PermissionLogLiteral
- A class to represent permission log literals
- RecipientType
- Type of recipient receiving access to a resource
- ResourceStatus
- Enum of resource status
- SecurityKeyDisplayMode
- Display mode for the SecurityKeyUI widget.
- SolidFunctionCallStatus
- Solid function call results
Constants
Functions
-
changeKeyPopup(
BuildContext context, Widget child) → Future< void> -
Displays a dialog for changing the key
contextis the BuildContext from which this function is called. -
checkPodInitialization(
) → Future< (bool, Map< String, dynamic> )> - Check if the user's POD structure is initialised.
-
checkResourceStatus(
String resUrl, {bool isFile = true}) → Future< ResourceStatus> - Asynchronously checks whether a given resource exists on the server.
-
deleteDataFileDialog(
String fileName, BuildContext context, {ResourceContentType contentType = ResourceContentType.turtleText}) → Future< void> - Delete a data file (and its ACL file if exist), remove its individual key and the corresponding IV from the ind-key-file.
-
deleteExternalFile(
String fileUrl, {ResourceContentType contentType = ResourceContentType.turtleText}) → Future< void> -
Delete an external file with path
fileUrland the shared key if the file is encrypted. Throws an exception if the file does not exist or any error occurs. -
deleteFile(
String filePath, {ResourceContentType contentType = ResourceContentType.turtleText, bool isKey = false}) → Future< void> -
Delete a file and its associated resources, after first revoking
external access to the file. The file with path
filePath, its ACL file, and its encryption key (if exists) will be deleted. The permission logs of any recipients to the file, will also be updated with a log line recording that permissions have been revoked. Throws an exception if the file does not exist or any error occurs. -
deleteLargeFile(
{required String remoteFilePath, void onProgress(int, int)?}) → Future< void> -
Delete a large file previously sent using
sendLargeFilewith URLremoteFilePath(relative to appname/data directory) in POD. -
deleteLogIn(
) → Future< bool> - Delete login information from the local storage
-
filenameToResourceUrl(
{required String fileName, bool isFile = true, bool isFileUrl = false, bool isExternalRes = false}) → Future< String> -
Get resource Url from a filename, with different options for how
the filename is provided. If
isExternalResorisFileUrlis set to true, the filename is already the resource url and is returned unchanged. -
generateCustomFolders(
List customFolderPaths) → List< String> - Generates a list of custom folder paths for a given application.
-
generateDefaultFiles(
) → Future< Map> - Generates a list of default folder paths for a given application.
-
generateDefaultFolders(
) → Future< List< String> > - Generates a list of default folder paths for a given application.
-
getAppNameVersion(
) → Future< ({String name, String version})> - Extract the app name and the version from the package info Return a record (with named fields https://dart.dev/language/records)
-
getDataDirPath(
) → Future< String> - Returns the path of the data directory
-
getDateTime(
String dateTimeStr) → String - Get date and time from a string
-
getDirUrl(
String dirPath, {String? webId}) → Future< String> - Create the URL for a directory (container)
-
getEncKeyPath(
) → Future< String> - Returns the path of file with verification key and private key
-
getFileUrl(
String filePath, {String? webId}) → Future< String> - Create the URL for a file
-
getLatestLog(
Map logDataMap, [String? userWebId]) → Map -
Get latest log entries
If need to exclude logs of files owned by a specific webid
define
userWebId. -
getResource(
String resourceUrl) → Future< Uint8List> -
Get the resource with URL
resourceUrlfrom server. The resource could be a text, turtle, binary file. IfresourceUrlends with '/', i.e., a container / directory, This function returns the bytes of a turtle string representing the list of resources in the container / directory. -
getResources(
) → Future< List< String> > - Get the list of files created by the user in their POD by querying the data directory of the POD.
-
getResourcesInContainer(
String containerUrl) → Future< ({List< String> files, List<String> subDirs})> - Get the list of sub-containers and files in a container Adapted from getContainerList() in gurriny/indi/lib/models/common/rest_api.dart
-
getTokensForResource(
String resourceUrl, String httpMethod) → Future< ({String accessToken, String dPopToken})> - Get tokens necessary to fetch a resource from a POD
-
getWebId(
) → Future< String?> - Return the web ID
-
grantPermission(
{required String fileName, required List permissionList, required RecipientType recipientType, required List recipientWebIdList, required String ownerWebId, required String granterWebId, bool isFile = true, bool isExternalRes = false, String? groupName}) → Future< SolidFunctionCallStatus> -
Grant access permissions to
fileNameto the type of recipient or specific recipients, if recipient type is individual or group, and group or individual recipients specified. This action updates the ACL file of the resource in the owner's Pod, and appends a log entry to the permission log in the owner, granter and recipients POD. -
initialStructureTest(
List< String> folders, Map files) → Future<List> -
The fetchPrvFile function is an asynchronous function designed to fetch
profile data from a specified URL
profCardUrl. It takes three parameters:profCardUrl(the URL to fetch data from),accessToken(used for authorization), anddPopToken(another form of token used in headers for enhanced security). Tests the initial structure of a user's resources in a Solid Pod by checking the existence of specified folders and files. -
initPod(
String securityKey, {List< String> ? dirUrls, List<String> ? fileUrls}) → Future<void> - Initialise the directory and file structure in a POD
-
isUserLoggedIn(
) → Future< bool> - Check whether a user is logged in or not
-
logoutPod(
) → Future< bool> - Logging out the user
-
readExternalPod(
String fileUrl) → Future -
Read
fileUrlfrom an external POD. -
readLargeFile(
{required String remoteFilePath, required String localFilePath, String? ownerWebId, void onProgress(int, int)?}) → Future< void> -
Get a large file previously sent using writeLargeFile with name
remoteFilePath(relative to appname/data directory) and save it to a local file with pathlocalFilePath. -
readLargeFileAsBytes(
{required String remoteFilePath, String? ownerWebId, void onProgress(int, int)?}) → Future< Uint8List> -
Get a large file previously sent using writeLargeFile with name
remoteFilePath(relative to appname/data directory) and return it as bytes. -
readPermission(
{required String fileName, required bool isFile, bool isFileUrl = false, bool isExternalRes = false}) → Future< Map> -
Read permission given for the
fileNamefrom the associated ACL file. -
readPermissionFileList(
{required List< String> fileList, bool isFile = true, bool isFilePath = false, bool isFileUrl = false}) → Future<Map< String, dynamic> > - Read permissions of each file in a list of files, Note: the list of files are always files owned by the user.
-
readPod(
String filePath, {PathType pathType = PathType.relativeToData}) → Future< String> - Read a (shared) file from POD..
-
revokePermission(
{required String fileName, required List permissionList, required String recipientIndOrGroupWebId, required String ownerWebId, required String granterWebId, required RecipientType recipientType, bool isFile = true, bool isFileUrl = false, bool isExternalRes = false}) → Future< SolidFunctionCallStatus> -
Revoke permissions to
fileNamefor a given individual or group Web IDrecipientIndOrGroupWebIdby removing the permission in the ACL within the owner's POD and adding a log entry recording the revoked permission in the permission logs of the owner, granter and recipient. -
revokePermissionToDelFile(
{required String fileName, required bool isFileEncrypted, required List permissionList, required String recipientWebId, required String ownerWebId, required String granterWebId, bool isFileUrl = false}) → Future< SolidFunctionCallStatus> -
Revoke permissions to non-existent
fileName(ie already deleted) for a given individual Web IDrecipientWebId. Note: assumed for use case of user updating their own logs to revoke their access to an external file that has already been deleted without prior revoking of access to recipients. This is the case for files deleted before revoking permission was included in the delete process, or files deleted on the server. -
setAppDirName(
String inputAppDirName) → Future< void> - Set directory name for the app for storing the POD data
-
setInheritKeyDir(
String dirUrl, {bool createAcl = true}) → Future< void> -
Set a key for a given directory so that key can be used to encrypt multiple
resources within the directory. Takes two input parameters
dirUrl- URL of the directorycreateAcl- Whther to crete an acl file for the directory or not (default: true) Directory will be created if not exist -
Read permission given for the
fileName. -
solidAuthenticate(
String serverId, BuildContext context) → Future< List?> -
Asynchronously authenticate a user against a Solid server
serverId. -
tripleMapToTurtle(
Map< URIRef, Map< triples, {Map<URIRef, dynamic> >String, Namespace> ? bindNamespaces}) → String - Generate Turtle string from triples stored in a map: {subject: {predicate: {object}}}
-
turtleToTripleMap(
String turtleStr) → Map< String, Map< String, dynamic> > - Parse the Turtle string into triples stored in a map: {subject: {predicate: object(s)}
-
updateFileByQuery(
String fileUrl, String query) → Future< void> - Updates a file on the server with the provided SPARQL query.
-
verifySecurityKey(
String securityKey, String verificationKey) → bool - Verify the security key
-
writeExternalPod(
String fileUrl, String fileContent, String fileOwnerWebId, {bool encrypted = true, bool overwrite = true, String? inheritKeyFrom}) → Future< void> -
Write file
fileUrlwith contentfileContentto an external PODs in the data directory (within potential subdirectories encoded infileUrl). The content will be encrypted if the original content is true. -
writeLargeFile(
{required String localFilePath, required String remoteFilePath, String? inheritKeyFrom, bool createAcl = true, void onProgress(int, int)?, bool encrypted = true}) → Future< void> -
Send a large local file with path
localFilePathto a remote server using nameremoteFilePath(relative to appname/data directory), encrypt the file content ifencryptedis true. -
writePod(
String filePath, String fileContent, {bool encrypted = true, bool createAcl = true, bool overwrite = false, PathType pathType = PathType.relativeToData, String? inheritKeyFrom}) → Future< void> -
Write
filePathwith contentfileContentto POD in the data directory (within potential subdirectories encoded infilePath).fileContentwill be encrypted by default.