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-unknowntarget - 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-unknownClone the repository
git clone https://github.com/Miracle656/veil.git
cd invisible_walletBuild the contract
cd contracts/invisible_wallet
cargo build --target wasm32-unknown-unknown --releaseOutput: target/wasm32-unknown-unknown/release/invisible_wallet.wasm
Install the SDK
cd ../../sdk
npm install
npm run buildRun contract unit tests
cd contracts/invisible_wallet
cargo testExpected 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 ... okSDK 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-rpcRPC 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
- Architecture — understand the full WebAuthn verification pipeline
- Contract API — all public contract functions and types
- SDK Reference — complete SDK function signatures