Skip to content

IdentiFI-Protocol/identifi-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

🧩 IdentiFI SDK: The Pre-Swap Authority Layer

The identifi-sdk is a professional integration toolkit designed for dApps and DEXs. It acts as a Sovereign Validation Middleware that intercepts transactions before execution to ensure identity integrity and protocol sustainability.

  • Core Logic: Pre-Swap Validation

Unlike standard tools, our SDK operates in the Pre-Swap phase. It performs a "Three-Way Handshake" between the user, the platform, and the protocol:

  • Proof Retrieval: The SDK can fetch a stored IdentiFI Proof directly from the dApp’s database to ensure a seamless "One-Click" UX.

  • Cryptographic Cross-Check:

  • Genesis Sync: Validates if the Genesis Wallet linked to the dApp profile matches the Genesis fingerprint inside the Proof.

  • Strand Verification: Confirms if the current active wallet (the Strand) has the authority to execute the swap.

  • Fee Collection & Routing: Once validated, the SDK triggers the IdentiFI Fee Contract to collect the protocol fee (0.066%) and then "pushes" the clean, authorized transaction to the DEX’s original router.

Key Advantages

  • No-DB Requirement for Users: The user doesn't need to manually provide the proof every time; the SDK handles the link via the dApp's existing infrastructure.

  • Anti-Poisoning Protection: By validating the Genesis-Strand link, we prevent unauthorized or malicious addresses from hijacking the swap flow.

Implementation Example (Pre-Swap Flow)

Integrate the IdentiFI authority check directly into your swap logic.

The SDK handles the local decryption and validation before routing the transaction.

async function executeAuthorizedSwap(amount) {
    // 1. Fetch the Proof from the dApp Database
    const storedProof = await dAppApi.getUserProof(userAddress); 
    const wallet = (await window.ethereum.request({ method: 'eth_requestAccounts' }))[0];

    // 2. Unseal & Validate via WASM (X-CORE Engine)
    // Local decryption: No sensitive data ever leaves the user's browser
    const isValid = unseal_vault(storedProof, wallet); 
    if (!isValid) throw new Error("Unauthorized: Identity/Genesis Mismatch");

    // 3. User Authorization (EIP-191)
    // The user signs a message to unlock the master signal for this session
    const signature = await signer.signMessage("IdentiFI Protocol: Authorize X-Core Engine...");

    // 4. Settlement & Routing
    // Our contract collects the fee and pushes the swap to the final router
    const tx = await identifiContract.settlement(
        wallet, 
        amount,
        signature, // Authority signal
        { value: protocolFee } // 0.066% revenue collection
    );

    return tx.wait();
}

Why this matters:

  • Unseal_vault: Performs the local "handshake" between the stored data and the connected wallet without needing a central validator.

  • Pre-Swap Interception: We collect the protocol revenue before the transaction reaches the DEX's liquidity router, securing the 0.066% fee.

  • Sovereign Experience: The user doesn't need to copy/paste anything; the SDK crosses the information automatically.

Technical Implementation

  • Built to be compatible with modern Web3 stacks (Ethers.js, Viem, Wagmi). It ensures that all heavy cryptographic lifting happens in memory, maintaining our Dataless philosophy.

About

🛠️ Get started with IdentiFI SDK concepts, guides, and integration resources.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors