Bridge

Ease of Use
Extensibility
Performance
Security
Pros:
  • Highly configurable
  • No Rust skills required
Cons:
  • Some WebAPIs unavailable
  • Challenge to implement

Description

The Bridge recipe is a secure pattern where messages are passed between brokers via an implicit bridge using the API. It isolates functionality to scope and passes messages instead of functionality.

Diagram

graph TD H==>F subgraph WEBVIEW F-.-E end D-->E E-->D B-->D D-->B subgraph RUST A==>H A-->B B-.-C B-.-G end A[Binary] B{Rust Broker} C[Subprocess 2] G[Subprocess 1] D(( API BRIDGE )) E{JS Broker} F[Window] H{Bootstrap} style D fill:#ccc,stroke:#333,stroke-width:4px,color:white style RUST fill:#fad3a9,stroke:#F28918,stroke-width:4px style WEBVIEW fill:#abd0f9,stroke:#1D81EE,stroke-width:4px

Configuration

Here's what you need to add to your tauri.conf.json file:

"tauri": {
  "embeddedServer": {
    "active": false               // do not use a localhost server
  },
  "allowlist": {                  // all API values are default false
    "all": false,                 // use this flag to enable all API features
    "answer": true,               // enable rust to direct the UI
    "event": true,                // enable binding to message
    "execute": false,             // enable application execution
    "listFiles": false,           // list files in a directory
    "open": false,                // open link in a browser
    "readBinaryFile": false,      // read binary file from local filesystem
    "readTextFile": false,        // read text file from local filesystem
    "setTitle": false,            // set the window title
    "writeFile": false            // write file to local filesystem
  }
}