-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use extism_pdk::*; | ||
|
||
#[host_fn] | ||
extern "ExtismHost" { | ||
pub fn redirect(url: &str); | ||
} | ||
|
||
#[host_fn] | ||
extern "ExtismHost" { | ||
pub fn notarize(params: &str) -> String; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::collections::HashMap; | ||
|
||
use extism_pdk::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(FromBytes, Deserialize, PartialEq, Debug, Serialize, ToBytes)] | ||
#[serde(rename_all = "camelCase")] | ||
#[encoding(Json)] | ||
pub struct PluginConfig<'a> { | ||
pub title: &'a str, | ||
pub description: &'a str, | ||
pub icon: String, | ||
pub steps: Vec<StepConfig<'a>>, | ||
pub host_functions: Vec<&'a str>, | ||
pub cookies: Vec<&'a str>, | ||
pub headers: Vec<&'a str>, | ||
pub requests: Vec<RequestObject<'a>>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub notary_urls: Option<Vec<&'a str>>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub proxy_urls: Option<Vec<&'a str>>, | ||
} | ||
|
||
#[derive(FromBytes, Deserialize, PartialEq, Debug, Serialize, ToBytes)] | ||
#[serde(rename_all = "camelCase")] | ||
#[encoding(Json)] | ||
pub struct StepConfig<'a> { | ||
pub title: &'a str, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub description: Option<&'a str>, | ||
pub cta: &'a str, | ||
pub action: &'a str, | ||
pub prover: bool, | ||
} | ||
|
||
#[derive(FromBytes, Deserialize, PartialEq, Debug, Serialize, ToBytes)] | ||
#[serde(rename_all = "camelCase")] | ||
#[encoding(Json)] | ||
pub struct RequestObject<'a> { | ||
pub url: &'a str, | ||
pub method: &'a str, | ||
} | ||
|
||
#[derive(FromBytes, Deserialize, PartialEq, Debug, Serialize, ToBytes)] | ||
#[serde(rename_all = "camelCase")] | ||
#[encoding(Json)] | ||
pub struct RequestConfig<'a> { | ||
pub url: &'a str, | ||
pub method: &'a str, | ||
pub headers: HashMap<&'a str, &'a str>, | ||
pub secret_headers: Vec<&'a str>, | ||
} |