@inrupt/solid-client / acp/acp

Module: acp/acp

Type aliases

WithAccessibleAcr

Ƭ WithAccessibleAcr: WithAcp & { internal_acp: { acr: Exclude<WithAcp["internal_acp"]["acr"], null> } }

Resources that conform to this type have an Access Control Resource attached. See hasAccessibleAcr.

since 1.6.0

Defined in

src/acp/acp.ts:300


WithAcp

Ƭ WithAcp: Object

The Access Control Resource of Resources that conform to this type were attempted to be fetched together with those Resources. This might not have been successful; see hasAccessibleAcr to check.

since 1.6.0

Type declaration

Name

Type

internal_acp

{ acr: AccessControlResource | null }

internal_acp.acr

AccessControlResource | null

Defined in

src/acp/acp.ts:291

Functions

getFileWithAccessDatasets

getFileWithAccessDatasets(url, options?): Promise<File & WithAcp | WithAcl>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Fetch a File, and:

  • if the Resource is governed by an ACR: its associated Access Control Resource (if available to the current user), and all the Access Control Policies referred to therein, if available to the current user.

  • if the Resource is governed by an ACL: its associated Resource ACL (if available to the current user), or its Fallback ACL if it does not exist.

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the File to fetch.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<File & WithAcp | WithAcl>

A File and either the ACL access data or the ACR access data, if available to the current user.

Defined in

src/acp/acp.ts:198


getFileWithAcr

getFileWithAcr(url, options?): Promise<File & WithAcp>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Fetch a file and its associated Access Control Resource (if available to the current user).

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the file to fetch.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<File & WithAcp>

A file and the ACR that applies to it, if available to the authenticated user.

Defined in

src/acp/acp.ts:95


getLinkedAcrUrl

getLinkedAcrUrl<Resource>(resource): UrlString | undefined

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Resource, find out the URL of its governing Access Control Resource.

since 1.15.0

Type parameters

Name

Type

Resource

extends WithServerResourceInfo

Parameters

Name

Type

Description

resource

Resource

Resource which should be governed by Access Policies.

Returns

UrlString | undefined

The URL of the Access Control Resource, or undefined if not ACR is found.

Defined in

src/acp/acp.ts:444


getReferencedPolicyUrlAll

getReferencedPolicyUrlAll(withAcr): UrlString[]

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

To make it easy to fetch all the relevant Access Policy Resources, this function returns all referenced Access Policy Resources referenced in an Access Control Resource. In other words, if Access Controls refer to different Policies in the same Access Policy Resource, this function will only return that Access Policy Resource’s URL once.

since 1.6.0

Parameters

Name

Type

Description

withAcr

WithAccessibleAcr

A Resource with an Access Control Resource attached.

Returns

UrlString[]

List of all unique Access Policy Resources that are referenced in the given Access Control Resource.

Defined in

src/acp/acp.ts:396


getResourceInfoWithAccessDatasets

getResourceInfoWithAccessDatasets(url, options?): Promise<WithServerResourceInfo & WithAcp | WithAcl>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Fetch information about a Resource, and:

  • if the Resource is governed by an ACR: its associated Access Control Resource (if available to the current user), and all the Access Control Policies referred to therein, if available to the current user.

  • if the Resource is governed by an ACL: its associated Resource ACL (if available to the current user), or its Fallback ACL if it does not exist.

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the Resource information about which to fetch.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<WithServerResourceInfo & WithAcp | WithAcl>

Information about a Resource and either the ACL access data or the ACR access data, if available to the current user.

Defined in

src/acp/acp.ts:237


getResourceInfoWithAcr

getResourceInfoWithAcr(url, options?): Promise<WithServerResourceInfo & WithAcp>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Retrieve information about a Resource and its associated Access Control Resource (if available to the current user), without fetching the Resource itself.

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the Resource about which to fetch its information.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<WithServerResourceInfo & WithAcp>

Metadata describing a Resource, and the ACR that applies to it, if available to the authenticated user.

Defined in

src/acp/acp.ts:125


getSolidDatasetWithAccessDatasets

getSolidDatasetWithAccessDatasets(url, options?): Promise<SolidDataset & WithAcp | WithAcl>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Fetch a SolidDataset, and:

  • if the Resource is governed by an ACR: its associated Access Control Resource (if available to the current user), and all the Access Control Policies referred to therein, if available to the current user.

  • if the Resource is governed by an ACL: its associated Resource ACL (if available to the current user), or its Fallback ACL if it does not exist.

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the SolidDataset to fetch.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<SolidDataset & WithAcp | WithAcl>

A SolidDataset and either the ACL access data or the ACR access data, if available to the current user.

Defined in

src/acp/acp.ts:159


getSolidDatasetWithAcr

getSolidDatasetWithAcr(url, options?): Promise<SolidDataset & WithServerResourceInfo & WithAcp>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Fetch a SolidDataset and its associated Access Control Resource (if available to the current user).

since 1.6.0

Parameters

Name

Type

Default value

Description

url

string | Url

undefined

URL of the SolidDataset to fetch.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<SolidDataset & WithServerResourceInfo & WithAcp>

A SolidDataset and the ACR that applies to it, if available to the authenticated user.

Defined in

src/acp/acp.ts:66


getVcAccess

getVcAccess(resourceWithAcr): AccessModes

Note

The ACP specification is a draft. As such, this function is experimental and subject to change, even in a non-major release. See also: https://solid.github.io/authorization-panel/acp-specification/

Get the maximum access modes that are allowed for a VC holder for a given resource. If the resource owner issued an Access Grant for the resource, the agent that has been granted access will have at most the permissions returned by this function. The Access Grant may be more restrictive.

Note that only the modes set using setVcAccess will be returned by this function. Additional access may have been set if the ACR has been manipulated not using this library, which is currently out of scope.

since 1.17.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The resource for which the VC access modes are looked up.

Returns

AccessModes

The access modes available to a VC holder.

Defined in

src/acp/util/getVcAccess.ts:75


hasAccessibleAcr

hasAccessibleAcr(resource): resource is WithAccessibleAcr

since 1.6.0

Parameters

Name

Type

Description

resource

WithAcp

Resource of which to check whether it has an Access Control Resource attached.

Returns

resource is WithAccessibleAcr

Boolean representing whether the given Resource has an Access Control Resource attached for use in e.g. getPolicyUrlAll.

Defined in

src/acp/acp.ts:311


isAcpControlled

isAcpControlled(resource, options?): Promise<boolean>

Verify whether the access to the given resource is controlled using the ACP system.

since 1.14.0.

Parameters

Name

Type

Default value

Description

resource

string | Url

undefined

The target resource

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<boolean>

True if the access to the resource is controlled using ACP, false otherwise.

Defined in

src/acp/acp.ts:417


saveAcrFor

saveAcrFor<ResourceExt>(resource, options?): Promise<ResourceExt>

Note

The Web Access Control specification is not yet finalised. As such, this function is still experimental and subject to change, even in a non-major release.

Save a Resource’s Access Control Resource.

since 1.6.0

Type parameters

Name

Type

ResourceExt

extends WithAccessibleAcr

Parameters

Name

Type

Default value

Description

resource

ResourceExt

undefined

Resource with an Access Control Resource that should be saved.

options

Partial<{ fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response> = fetch }>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns

Promise<ResourceExt>

Defined in

src/acp/acp.ts:270


setVcAccess

setVcAccess(resourceWithAcr, access): WithAccessibleAcr

Note

The ACP specification is a draft. As such, this function is experimental and subject to change, even in a non-major release. See also: https://solid.github.io/authorization-panel/acp-specification/

Set the maximum access modes that are allowed for a VC holder for a given resource. If the resource owner issued an Access Grant for the resource, the agent that has been granted access will have at most the permissions set by this function. The Access Grant may be more restrictive.

Note that additional access may have been set if the ACR has been manipulated not using this library, which is currently out of scope. In this case, the access set by this function may not apply.

since 1.17.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The resource for which the access modes are being set for VC holders.

access

Partial<AccessModes>

The access modes to set. Setting a mode to true will enable it, to false will disable it, and to undefined will leave it unchanged compared to what was previously set.

Returns

WithAccessibleAcr

A copy of the resource and its attached ACR, updated to the new access modes.

Defined in

src/acp/util/setVcAccess.ts:69