This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: tauri-mobile-secure-enclave-ipc-attestation

Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard

Enforces cryptographic hardware-backed attestation for high-privilege Tauri 2.0 mobile IPC operations. Eliminates trust in client-side boolean biometric verification by mandating server- or core-generated challenge nonces signed directly within the iOS Secure Enclave or Android Keystore before native Rust plugin dispatch.

Prohibited Anti-Pattern: Trusting Client-Side Boolean Biometric Prompts to Authorize High-Privilege IPC Commands

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard - Enforces cryptographic hardware-backed attestation for high-privilege Tauri 2.0 mobile IPC operations. Eliminates trust in client-side boolean biometric verification by mandating server- or core-generated challenge nonces signed directly within the iOS Secure Enclave or Android Keystore before native Rust plugin dispatch.
globs: src/**/*.{ts,tsx}, src-tauri/src/**/*.rs
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tauri-mobile-secure-enclave-ipc-attestation"
---

# Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Trusting Client-Side Boolean Biometric Prompts to Authorize High-Privilege IPC Commands

## System Constraints
You are a Principal Mobile Security Architect enforcing the Tauri 2.0 Mobile Secure Enclave & Keystore IPC Attestation Standard. In Tauri 2.0 mobile applications, webview contexts are vulnerable to script injection, state manipulation, and memory tampering. Never trust a boolean biometric result passed across the Tauri IPC bridge. All high-privilege native commands MUST require a cryptographic signature over a fresh, cryptographically secure nonce generated by the Rust host or a secure backend. The signature MUST be produced by a private key bound to hardware biometric authentication (iOS Secure Enclave / Android KeyStore) and verified natively in Rust before executing the sensitive operation.

## Strict Guidelines
- Engineers MUST NEVER authorize privileged native host plugin execution based on a boolean biometric check returned to the webview context.
- Engineers MUST generate single-use, cryptographically random nonces (with strict TTL <= 60 seconds) in the Rust host or remote backend prior to sensitive IPC invocations.
- Frontend services MUST request a hardware-signed attestation payload containing the challenge nonce and transaction digest from the native platform keystore.
- Mobile keystores MUST configure private keys with explicit biometric user presence flags: 'UserPresence' / 'BiometryAny' on iOS Secure Enclave, and 'setUserAuthenticationRequired(true)' on Android Keystore.
- Native Tauri Rust commands MUST verify the cryptographic signature against the registered hardware public key and validate nonce freshness before mutating state or executing privileged host plugins.
- Rust commands MUST invalidate the consumed nonce immediately upon verification to prevent replay attacks across the IPC bridge.

## Bad vs Good Implementations
### Vulnerable Client-Side Boolean Biometric Check vs Cryptographic Attestation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The webview executes a separate biometric check that returns a raw boolean. An attacker with webview script execution or runtime hooking can bypass this check and directly invoke 'execute_sensitive_transfer' without hardware biometric verification.
```typescript
import { invoke } from '@tauri-apps/api/core';

interface TransferParams {
  recipient: string;
  amount: number;
}

export async function executeHighValueTransfer(params: TransferParams): Promise<void> {
  // VULNERABLE: Relies on boolean biometric gate that can be bypassed
  // via prototype tampering, webview script injection, or memory modification.
  const isAuthenticated = await invoke<boolean>('plugin:biometrics|authenticate', {
    reason: 'Confirm high-value transaction'
  });

  if (!isAuthenticated) {
    throw new Error('Biometric authentication failed');
  }

  // IPC bridge receives unauthenticated high-privilege payload
  await invoke('execute_sensitive_transfer', { params });
}
```

#### Production Standard (Correct)
> **Standard**: The native core generates a cryptographically random nonce. The Secure Enclave signs the combined challenge and payload directly under biometric lock. The Rust host verifies the cryptographic signature against the hardware public key and marks the nonce consumed before dispatching the transfer.
```typescript
import { invoke } from '@tauri-apps/api/core';

interface TransferParams {
  recipient: string;
  amount: number;
}

interface AttestationChallenge {
  nonce: string;
  expiresAt: number;
}

interface AttestationPayload {
  signature: string;
  nonce: string;
  publicKeyId: string;
}

export async function executeHighValueTransfer(params: TransferParams): Promise<void> {
  // Step 1: Request an ephemeral single-use nonce from the Rust core
  const challenge = await invoke<AttestationChallenge>('create_attestation_challenge');

  // Step 2: Request the hardware enclave to sign the challenge + payload digest.
  // This triggers OS-level biometrics natively; private key never leaves Secure Enclave/Keystore.
  const attestation = await invoke<AttestationPayload>('plugin:hardware-keystore|sign_challenge', {
    challengeNonce: challenge.nonce,
    dataDigest: JSON.stringify(params),
    biometricPrompt: 'Authenticate to authorize transfer'
  });

  // Step 3: Pass payload alongside hardware signature for atomic native verification in Rust
  await invoke('execute_attested_transfer', {
    params,
    attestation
  });
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard

Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces cryptographic hardware-backed attestation for high-privilege Tauri 2.0 mobile IPC operations. Eliminates trust in client-side boolean biometric verification by mandating server- or core-generated challenge nonces signed directly within the iOS Secure Enclave or Android Keystore before native Rust plugin dispatch. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Trusting Client-Side Boolean Biometric Prompts to Authorize High-Privilege IPC Commands Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftTrusting Client-Side Boolean Biometric Prompts to Authorize High-Privilege IPC CommandsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST NEVER authorize privileged native host plugin execution based on a boolean biometric check returned to the webview context.

Engineers MUST NEVER authorize privileged native host plugin execution based on a boolean biometric check returned to the webview context.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST generate single-use, cryptographically random nonces (with strict TTL <= 60 seconds) in the Rust host or remote backend prior to sensitive IPC invocations.

Engineers MUST generate single-use, cryptographically random nonces (with strict TTL <= 60 seconds) in the Rust host or remote backend prior to sensitive IPC invocations.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Frontend services MUST request a hardware-signed attestation payload containing the challenge nonce and transaction digest from the native platform keystore.

Frontend services MUST request a hardware-signed attestation payload containing the challenge nonce and transaction digest from the native platform keystore.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Mobile keystores MUST configure private keys with explicit biometric user presence flags

Mobile keystores MUST configure private keys with explicit biometric user presence flags: 'UserPresence' / 'BiometryAny' on iOS Secure Enclave, and 'setUserAuthenticationRequired(true)' on Android Keystore.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Native Tauri Rust commands MUST verify the cryptographic signature against the registered hardware public key and validate nonce freshness before mutating state or executing privileged host plugins.

Native Tauri Rust commands MUST verify the cryptographic signature against the registered hardware public key and validate nonce freshness before mutating state or executing privileged host plugins.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Rust commands MUST invalidate the consumed nonce immediately upon verification to prevent replay attacks across the IPC bridge.

Rust commands MUST invalidate the consumed nonce immediately upon verification to prevent replay attacks across the IPC bridge.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Tauri 2.0 Mobile Secure Enclave Keystore IPC Attestation Standard critical for AI coding assistants?

Enforces cryptographic hardware-backed attestation for high-privilege Tauri 2.0 mobile IPC operations. Eliminates trust in client-side boolean biometric verification by mandating server- or core-generated challenge nonces signed directly within the iOS Secure Enclave or Android Keystore before native Rust plugin dispatch. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Trusting Client-Side Boolean Biometric Prompts to Authorize High-Privilege IPC Commands) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

Related MOBILE Rules

View all rules →
1 Rule in Stack

Tauri