mirror of
https://github.com/tlsnotary/docs-mdbook.git
synced 2026-01-08 20:28:02 -05:00
feat: adding docs for user params in provider api + added local/sessionStorage to pluginconfig (#124)
This commit is contained in:
@@ -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 -->
|
<!-- https://github.com/tlsnotary/tlsn-extension/blob/p2p/src/utils/misc.ts#L315-L326 -->
|
||||||
```ts
|
```ts
|
||||||
export type PluginConfig = {
|
export type PluginConfig = {
|
||||||
title: string; // The name of the plugin
|
title: string; // The name of the plugin
|
||||||
description: string; // A description of the plugin's purpose
|
description: string; // A description of the plugin purpose
|
||||||
icon?: string; // A base64-encoded image string representing the plugin's icon (optional)
|
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)
|
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
|
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)
|
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)
|
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
|
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)
|
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)
|
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));
|
Host.outputString(JSON.stringify(secretResps));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ type PluginConfig = {
|
|||||||
hostFunctions?: string[];
|
hostFunctions?: string[];
|
||||||
cookies?: string[];
|
cookies?: string[];
|
||||||
headers?: string[];
|
headers?: string[];
|
||||||
|
localStorage?: string[];
|
||||||
|
sessionStorage?: string[];
|
||||||
requests: { method: string; url: string }[];
|
requests: { method: string; url: string }[];
|
||||||
notaryUrls?: string[];
|
notaryUrls?: string[];
|
||||||
proxyUrls?: string[];
|
proxyUrls?: string[];
|
||||||
@@ -189,12 +191,13 @@ const plugin = await client.getPlugins('**', 'https://swapi.dev', {id: 'demo-plu
|
|||||||
#### Screenshot
|
#### Screenshot
|
||||||

|

|
||||||
|
|
||||||
### `client.runPlugin(id)`
|
### `client.runPlugin(id, params)`
|
||||||
|
|
||||||
This method is used to request the execution of a plugin.
|
This method is used to request the execution of a plugin.
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
1. `id`: The ID of the plugin.
|
1. `id`: The ID of the plugin.
|
||||||
|
2. `params` *(optional)*: An object containing user input parameters as key-value pairs.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
A promise that resolves to the proof data.
|
A promise that resolves to the proof data.
|
||||||
@@ -208,8 +211,11 @@ type ProofData = {
|
|||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```ts
|
```ts
|
||||||
const plugin = await client.runPlugin("6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02");
|
const plugin = await client.runPlugin(
|
||||||
|
"6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02",
|
||||||
|
{ Key: "Value" }
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Screenshot
|
#### Screenshot
|
||||||

|

|
||||||
|
|||||||
Reference in New Issue
Block a user