Phase 3 (Factory Contract) is open for contributors — see open issues
Getting Started

Getting Started

This guide walks you through setting up the Veil smart contract and TypeScript SDK in a local development environment.

Prerequisites

  • Rust with wasm32-unknown-unknown target
  • Stellar CLI
  • Node.js 18+ and npm
  • A browser with WebAuthn support (Chrome 67+, Firefox 60+, Safari 14+)

Installation

Install Rust WASM target

rustup target add wasm32-unknown-unknown

Clone the repository

git clone https://github.com/Miracle656/veil.git
cd invisible_wallet

Build the contract

cd contracts/invisible_wallet
cargo build --target wasm32-unknown-unknown --release

Output: target/wasm32-unknown-unknown/release/invisible_wallet.wasm

Install the SDK

cd ../../sdk
npm install
npm run build

Run contract unit tests

cd contracts/invisible_wallet
cargo test

Expected output — 6 passing tests:

test test_init_registers_signer ... ok
test test_init_twice_fails ... ok
test test_verify_webauthn_valid ... ok
test test_verify_webauthn_wrong_key_fails ... ok
test test_verify_webauthn_wrong_challenge_fails ... ok
test test_verify_webauthn_tampered_authdata_fails ... ok

SDK Usage

React — useInvisibleWallet hook

import { useInvisibleWallet } from 'invisible-wallet-sdk'
 
export default function WalletDemo() {
  const { address, isPending, error, register, signAuthEntry, login } =
    useInvisibleWallet('FACTORY_CONTRACT_ADDRESS')
 
  return (
    <div>
      {address ? (
        <p>Wallet: {address}</p>
      ) : (
        <button onClick={() => register('alice')} disabled={isPending}>
          {isPending ? 'Creating...' : 'Create Wallet'}
        </button>
      )}
    </div>
  )
}

Signing a Soroban auth entry

// signaturePayload is the 32-byte Soroban HashIdPreimage
const sig = await signAuthEntry(signaturePayload)
 
if (sig) {
  // sig = { publicKey, authData, clientDataJSON, signature }
  console.log('Public key:', sig.publicKey)
  console.log('Signature (r||s):', sig.signature)
}

signAuthEntry triggers a native biometric prompt on the user’s device. The signaturePayload is used as the WebAuthn challenge, cryptographically binding the assertion to that specific transaction.

Environment Setup

Local Stellar node

docker run --rm -it \
  -p 8000:8000 \
  --name stellar \
  stellar/quickstart:latest \
  --local \
  --enable-soroban-rpc

RPC URL: http://localhost:8000/soroban/rpc

Testnet

  • RPC: https://soroban-testnet.stellar.org
  • Network passphrase: Test SDF Network ; September 2015
  • Friendbot: https://friendbot.stellar.org/?addr=<your_address>

Next Steps