SolidSharingClient

Client SDK for the Solid resource-sharing feature: create, list and revoke shares of pod resources, track shares received from others, browse an owner's catalog, and accept or reject access requests.

Sharing is enforced by the pod's access control (Web Access Control, or Access Control Policy on servers that use it). Calls are delegated over IPC to the Android Solid Services app.

Obtain an instance via Solid.getSharingClient. Collect connectionState and wait for true before issuing calls. All operations are suspend functions and throw SolidException on failure.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun acceptShareRequest(webId: String, request: ShareRequest): GivenShare?

Approves an incoming share request. Equivalent to creating the requested share — the requester gets an as:Offer informing them of the grant.

Link copied to clipboard
suspend fun addReceivedShare(webId: String, resourceUri: String, resourceType: String? = null, resourceName: String? = null): ReceivedShare?

Starts tracking access to resourceUri that was shared with this user (e.g. after scanning a QR code or opening a share link), verifying access first. Returns the received share, or null if access can't be verified.

Link copied to clipboard

Hot Flow of the IPC service connection state; emits true once connected.

Link copied to clipboard
suspend fun createShare(webId: String, resourceUri: String, mode: ShareMode, receiver: ShareReceiver, notifyReceiver: Boolean = true, resourceType: String? = null, resourceName: String? = null): GivenShare?

Grants receiver access of mode on resourceUri and records it in the given-shares index. For a container, members inherit the access. When notifyReceiver is true and receiver is a WebID, a best-effort notification is delivered to their inbox. Returns the created share.

Link copied to clipboard
suspend fun getAccessGrants(webId: String): List<AccessGrant>

Returns every observable access relationship for webId — shares given, shares received, incoming requests, and any grants discovered through Solid Application Interoperability (SAI) registries — unified into one list.

Link copied to clipboard
suspend fun getGivenSharesForResource(webId: String, resourceUri: String): List<GivenShare>

Returns the shares affecting resourceUri, read directly from that resource's ACL (authoritative).

Link copied to clipboard
suspend fun getOwnerCatalog(viewerWebId: String, ownerWebId: String): List<CatalogEntry>

Reads ownerWebId's public catalog from viewerWebId's perspective — used to browse what an owner accepts access requests for.

Link copied to clipboard

Returns the shares this user has given, read from the on-pod index (fast). Re-validate with refreshGivenShares.

Link copied to clipboard

Returns the shares this user has received, from the local index (fast). Re-validate with refreshReceivedShares.

Link copied to clipboard
suspend fun makePrivate(webId: String, resourceUri: String)

Strips every share from resourceUri, leaving it owner-only.

Link copied to clipboard
suspend fun publishCatalogEntry(webId: String, entry: CatalogEntry)

Adds or replaces entry in this user's public catalog of resources that others may request access to. The catalog is public; the listed resources stay private until access is granted.

Link copied to clipboard
suspend fun purgeGivenShares(webId: String, resourceUri: String, includeDescendants: Boolean = true, notifyReceivers: Boolean = true): List<GivenShare>

Drops the given-shares index rows of a deleted resourceUri — and, with includeDescendants, of everything beneath it — without touching access control. Call it after deleting a resource so its bookkeeping does not outlive it. Returns the removed rows; notifyReceivers additionally sends each WebID receiver an as:Undo.

Link copied to clipboard
suspend fun rebuildGivenIndex(webId: String): List<GivenShare>

Rebuilds the given-shares index by walking the pod and reading each resource's ACL. Expensive — expose as an explicit user action, not a routine refresh. Returns the rebuilt list.

Link copied to clipboard

Re-validates each given share against the resource's live ACL, drops entries no longer granted, and returns the verified list.

Link copied to clipboard

Re-validates each received share and drops entries that are no longer accessible.

Link copied to clipboard
suspend fun rejectShareRequest(webId: String, request: ShareRequest, reason: String? = null)

Declines an incoming share request by posting an as:Reject to the requester's inbox. Does not create any share.

Link copied to clipboard
suspend fun removeCatalogEntry(webId: String, resourceUri: String)

Removes the catalog entry for resourceUri, if present.

Link copied to clipboard
suspend fun removeReceivedShare(webId: String, resourceUri: String, ownerWebId: String)

Stops tracking a received share. Does not affect the resource itself.

Link copied to clipboard
suspend fun repairOwnerControl(webId: String, resourceUri: String)

Re-asserts the owner's acl:Control on a resource whose ACL lost it — the repair for a pod that dropped the owner rule and left the resource un-manageable.

Link copied to clipboard
suspend fun revokeShare(webId: String, resourceUri: String, receiver: ShareReceiver)

Removes receiver's access to resourceUri and the matching index entry. If receiver is a WebID, a best-effort withdrawal notification is sent.

Link copied to clipboard
suspend fun syncReceivedShares(webId: String, notifications: List<ShareNotification>): List<ReceivedShare>

Reconciles the received-shares index against inbox notifications: an Offer/Accept adds a row, an Undo removes one. Returns the reconciled index.

Link copied to clipboard
suspend fun updateShare(webId: String, resourceUri: String, mode: ShareMode, receiver: ShareReceiver, resourceType: String? = null, resourceName: String? = null): GivenShare?

Changes the access mode of an existing share for receiver on resourceUri. resourceType / resourceName refresh the typed-share marks as on createShare.