#[non_exhaustive]#[repr(u16)]pub enum TargetRexProgram {
HttpGet {
url: RexUrl,
filter: Option<Vec<HttpFilter>>,
headers: Headers,
},
HttpPost {
url: RexUrl,
filter: Option<Vec<HttpFilter>>,
body: RexValue,
content_type: String,
headers: Headers,
},
Time = 2,
Number = 3,
SecretKeyGeneration {
committee_id: String,
committee_members: Vec<String>,
},
SecretKeyEncryption {
target_tee_id: String,
secret_data: Vec<u8>,
committee_id: String,
},
SecretKeyDecryption {
encrypted_data: Vec<u8>,
source_committee_id: String,
},
WebSocket(WebSocketOperation),
Wasm {
bytecode_account: Pubkey,
input: Vec<RexValue>,
program_index: Option<u32>,
},
}Expand description
Enum that represents the target REX Program of the REX request.
Discriminant values are fixed to ensure stable serialization across builds with different feature flags.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HttpGet
HTTP GET request to the REX. The URL is specified in the RexDutyRequest. The URL must be an HTTPS URL. The filter is optional, and if provided, it is used to filter the response.
HttpPost
HTTP POST request to the REX. The URL is specified in the RexDutyRequest. The URL must be an HTTPS URL. This REX type is restricted to single-validator assignment to prevent duplicate operations on non-idempotent endpoints.
Fields
filter: Option<Vec<HttpFilter>>Time = 2
Get the current time from several NIST servers.
Number = 3
Only used for testing purposes, to simulate an REX that always returns a fixed value. TODO: remove this variant with a cfg testing flag.
SecretKeyGeneration
Generate a shared secret key within a committee of TEEs. The manager TEE generates the key and distributes it to all committee members.
SecretKeyEncryption
Encrypt a secret key for a target TEE using their public key. This is used to share keys with TEEs outside the original committee.
SecretKeyDecryption
Decrypt a secret key that was encrypted for this TEE. This is used by TEEs to access keys shared with them.
WebSocket(WebSocketOperation)
WebSocket REX operations for persistent connections
Wasm
Execute WASM bytecode inside the TEE. The bytecode must be a WASI-compatible component deployed to an on-chain account.
Fields
input: Vec<RexValue>Per-argument input data for the WASM module. Each entry is one argument, independently Plain (borsh-serialized) or Encrypted (HPKE ciphertext the TEE decrypts). The TEE decrypts each Encrypted entry and concatenates all bytes into a borsh tuple. From CLI: pass base64-encoded bytes (single plain argument).
Implementations§
Source§impl TargetRexProgram
impl TargetRexProgram
Sourcepub fn websocket_op(&self) -> Option<WebSocketOperation>
pub fn websocket_op(&self) -> Option<WebSocketOperation>
Extracts the WebSocket operation if this is a WebSocket target.
Sourcepub fn encrypted_payloads(&self) -> Box<dyn Iterator<Item = &[u8]> + '_>
pub fn encrypted_payloads(&self) -> Box<dyn Iterator<Item = &[u8]> + '_>
Ciphertext bytes of every field on this program that can carry an
encrypted payload: the encrypted URL, body, WebSocket Send message(s),
or WASM input(s). Single source of truth for which fields are ciphertext
carriers; the version-gated routing (Router::dkg_payload_bytes) and
the on-chain ciphertext-match check (encrypted_payload_iter) build on
this and additionally require the DKG_PAYLOAD_VERSION byte (a constant
that lives above this crate, so it is applied by those callers).
Sourcepub fn is_dkg_encrypted(&self) -> bool
pub fn is_dkg_encrypted(&self) -> bool
True if this program carries any encrypted payload, meaning the duty
cannot be served by a direct fetch and must go through the
threshold-decryption committee + combine pipeline before any result can
exist. Used to size the encrypted duty’s collection window
(DutyRequest::inner); does not inspect DKG_PAYLOAD_VERSION —
encryption alone is sufficient (and conservative) for that purpose.
Source§impl TargetRexProgram
impl TargetRexProgram
Sourcepub fn is_websocket(&self) -> bool
pub fn is_websocket(&self) -> bool
Returns true if this is a WebSocket operation.
Trait Implementations§
Source§impl AsRef<str> for TargetRexProgram
impl AsRef<str> for TargetRexProgram
Source§impl Clone for TargetRexProgram
impl Clone for TargetRexProgram
Source§fn clone(&self) -> TargetRexProgram
fn clone(&self) -> TargetRexProgram
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TargetRexProgram
impl Debug for TargetRexProgram
Source§impl<'de> Deserialize<'de> for TargetRexProgram
impl<'de> Deserialize<'de> for TargetRexProgram
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TargetRexProgram, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TargetRexProgram, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for TargetRexProgram
Source§impl FromStr for TargetRexProgram
impl FromStr for TargetRexProgram
Source§impl PartialEq for TargetRexProgram
impl PartialEq for TargetRexProgram
Source§fn eq(&self, other: &TargetRexProgram) -> bool
fn eq(&self, other: &TargetRexProgram) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TargetRexProgram
impl Serialize for TargetRexProgram
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TargetRexProgram
Auto Trait Implementations§
impl Freeze for TargetRexProgram
impl RefUnwindSafe for TargetRexProgram
impl Send for TargetRexProgram
impl Sync for TargetRexProgram
impl Unpin for TargetRexProgram
impl UnsafeUnpin for TargetRexProgram
impl UnwindSafe for TargetRexProgram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.