feat: adding docs for user params in provider api + added local/sessionStorage to pluginconfig (#124)

This commit is contained in:
Tanner
2025-04-22 10:04:40 -07:00
committed by GitHub
parent 051ff6305f
commit 2a5b7fc7b9
2 changed files with 21 additions and 13 deletions

View File

@@ -25,16 +25,18 @@ A plugin must include a configuration JSON file that describes its behavior and
<!-- https://github.com/tlsnotary/tlsn-extension/blob/p2p/src/utils/misc.ts#L315-L326 -->
```ts
export type PluginConfig = {
title: string; // The name of the plugin
description: string; // A description of the plugin's purpose
icon?: string; // A base64-encoded image string representing the plugin's icon (optional)
steps?: StepConfig[]; // An array describing the UI steps and behavior (see Step UI below) (optional)
hostFunctions?: string[];// Host functions that the plugin will have access to
cookies?: string[]; // Cookies the plugin will have access to, cached by the extension from specified hosts (optional)
headers?: string[]; // Headers the plugin will have access to, cached by the extension from specified hosts (optional)
title: string; // The name of the plugin
description: string; // A description of the plugin purpose
icon?: string; // A base64-encoded image string representing the plugin's icon (optional)
steps?: StepConfig[]; // An array describing the UI steps and behavior (see Step UI below) (optional)
hostFunctions?: string[]; // Host functions that the plugin will have access to
cookies?: string[]; // Cookies the plugin will have access to, cached by the extension from specified hosts (optional)
headers?: string[]; // Headers the plugin will have access to, cached by the extension from specified hosts (optional)
localStorage?: string[]; // LocalStorage the plugin will have access to, cached by the extension from specified hosts (optional)
sessionStorage?: string[]; // SessionStorage the plugin will have access to, cached by the extension from specified hosts (optional)
requests: { method: string; url: string }[]; // List of requests that the plugin is allowed to make
notaryUrls?: string[]; // List of notary services that the plugin is allowed to use (optional)
proxyUrls?: string[]; // List of websocket proxies that the plugin is allowed to use (optional)
notaryUrls?: string[]; // List of notary services that the plugin is allowed to use (optional)
proxyUrls?: string[]; // List of websocket proxies that the plugin is allowed to use (optional)
};
```
@@ -118,4 +120,4 @@ function parseResponse() {
];
Host.outputString(JSON.stringify(secretResps));
}
```
```

View File

@@ -175,6 +175,8 @@ type PluginConfig = {
hostFunctions?: string[];
cookies?: string[];
headers?: string[];
localStorage?: string[];
sessionStorage?: string[];
requests: { method: string; url: string }[];
notaryUrls?: string[];
proxyUrls?: string[];
@@ -189,12 +191,13 @@ const plugin = await client.getPlugins('**', 'https://swapi.dev', {id: 'demo-plu
#### Screenshot
![Screenshot 2024-07-04 at 3 23 14PM](./images/share_installed_plugins.png)
### `client.runPlugin(id)`
### `client.runPlugin(id, params)`
This method is used to request the execution of a plugin.
#### Parameters
1. `id`: The ID of the plugin.
2. `params` *(optional)*: An object containing user input parameters as key-value pairs.
#### Returns
A promise that resolves to the proof data.
@@ -208,8 +211,11 @@ type ProofData = {
#### Example
```ts
const plugin = await client.runPlugin("6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02");
const plugin = await client.runPlugin(
"6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02",
{ Key: "Value" }
);
```
#### Screenshot
![Screenshot 2024-07-04 at 3 24 09PM](./images/execute_plugin.png)
![Screenshot 2024-07-04 at 3 24 09PM](./images/execute_plugin.png)