### Clone and Run Ethereum Identity Kit Quickstart Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt This snippet shows how to clone the Ethereum Identity Kit quickstart repository, install its dependencies using npm, and start the development environment. ```bash git clone https://github.com/signinwithethereum/siwe-quickstart cd siwe-quickstart npm install npm run dev ``` -------------------------------- ### Install and Run SIWE Notepad Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs dependencies and runs the SIWE notepad example locally using npm. ```bash cd siwe-notepad npm install npm run dev ``` -------------------------------- ### Project Setup and Package.json Scripts Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt This snippet demonstrates the initial project setup by creating necessary directories and files, and then updates the `package.json` file to include essential npm scripts for starting and developing the server. ```bash mkdir src routes middleware utils touch src/server.js routes/auth.js middleware/auth.js utils/nonce.js ``` ```json { "scripts": { "start": "node src/server.js", "dev": "nodemon src/server.js", "test": "echo \"Error: no test specified\" && exit 1" } } ``` -------------------------------- ### Rails Engine Setup Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Steps to set up the Rails Engine approach for Sign in with Ethereum. This involves installing dependencies, migrating the database, and starting the Rails server. ```bash cd siwe-rails-examples/rails-engine bundle install bin/rails db:migrate RAILS_ENV=development bundle exec rails server ``` -------------------------------- ### Clone NextAuth.js Example Project Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Clones the official NextAuth.js example project from GitHub and navigates into the project directory. This serves as a starting point for integrating SIWE. ```bash git clone https://github.com/nextauthjs/next-auth-example cd next-auth-example ``` -------------------------------- ### Go SIWE Library Usage Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms.txt Guide to installing and using the Go library for Sign in with Ethereum authentication. Includes setup instructions and common usage patterns. ```Go package main import ( "fmt" "log" "github.com/chainbound/siwe-go/pkg/siwe" ) func main() { message := "example.com is requesting to sign in with your Ethereum account:\n\n0x...\n\nURI: https://example.com\nVersion: 1\nChain ID: 1\nIssued At: 2023-10-27T10:00:00Z" signature := "0x..." ssiweMessage := siwe.NewMessage(message) err := ssiweMessage.VerifySignature(signature) if err != nil { log.Fatalf("Signature verification failed: %v", err) } fmt.Println("Signature verified successfully!") } ``` -------------------------------- ### Install SIWE Go Library Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the Sign in with Ethereum Go library using the 'go get' command. This is the first step to using the library in your Go projects. ```bash go get -u github.com/signinwithethereum/siwe-go ``` -------------------------------- ### Set Up React Frontend Project Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Bash commands to create a new React application named `siwe-frontend`, navigate into its directory, install necessary dependencies (`siwe`, `ethers`, `styled-components`), and start the development server. ```bash # Create a new React app npx create-react-app siwe-frontend cd siwe-frontend # Install Web3 dependencies npm install siwe ethers # Install additional UI dependencies (optional) npm install styled-components # Start the development server npm start ``` -------------------------------- ### Install Backend Dependencies and Run Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Bash commands to install necessary Node.js dependencies (`dotenv`, `axios`) for the backend and to start the development server using `npm run dev`. ```bash # Install additional dependencies npm install dotenv axios # Run in development mode npm run dev ``` -------------------------------- ### Rails Custom Controller Setup Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Steps to set up a custom controller approach for Sign in with Ethereum in a Rails application. This includes installing dependencies, migrating the database, and starting the server. ```bash cd siwe-rails-examples/custom-controller bundle install bin/rails db:migrate RAILS_ENV=development bundle exec rails server ``` -------------------------------- ### React SIWE Frontend Setup Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms.txt Guide to building a React frontend for connecting Ethereum wallets and using SIWE for authentication user signatures. Includes UI component examples. ```JavaScript /* // Example using ethers.js and a hypothetical SIWE hook import React, { useState } from 'react'; import { useSignMessage } from 'wagmi'; import { SiweMessage } from 'siwe'; function SignInButton() { const [message, setMessage] = useState(''); const { data: signature, signMessage } = useSignMessage({ onSuccess(data) { // Send signature and original message to backend for verification console.log('Signature:', data); }, }); const handleSignIn = async () => { const domain = window.location.host; const origin = window.location.origin; const address = "0x..."; // Get user's connected wallet address const siweMessage = new SiweMessage({ domain, address, statement: 'Sign in with Ethereum to your application.', uri: origin, version: '1', chainId: 1, // expirationTime: '2025-01-01T12:00:00Z' // Optional expiration }); const messageToSign = siweMessage.prepareMessage(); setMessage(messageToSign); signMessage({ message: messageToSign }); }; return ( ); } export default SignInWithEthereum; */ ``` -------------------------------- ### Local Development Setup with Docker Compose Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt This snippet outlines the steps for setting up the local development environment for SIWE OIDC using Docker Compose. It includes cloning the repository, navigating into the directory, and starting the services. ```bash # Clone repository git clone https://github.com/spruceid/siwe-oidc cd siwe-oidc # Start development environment with Docker Compose docker-compose -f docker-compose.dev.yml up # Edit /etc/hosts for local testing echo "127.0.0.1 oidc.localhost" >> /etc/hosts ``` -------------------------------- ### Backend Project Setup for SIWE (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Commands to set up a new Node.js backend project for SIWE implementation. It includes creating a directory, initializing the npm project, and installing necessary dependencies like Express, SIWE, Ethers, CORS, Helmet, and Express-Rate-Limit. ```bash # Create backend directory mkdir siwe-backend cd siwe-backend # Initialize Node.js project npm init -y # Install dependencies npm install express siwe ethers cors helmet express-rate-limit npm install -D nodemon ``` -------------------------------- ### Install SIWE for Python Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the SIWE library for Python projects using pip, the standard package installer for Python. ```bash pip install siwe ``` -------------------------------- ### Clone SIWE Notepad Repository Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Clones the Sign in with Ethereum notepad example repository from GitHub. ```bash git clone https://github.com/signinwithethereum/siwe-notepad ``` -------------------------------- ### Elixir SIWE Library Installation and Usage Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms.txt Provides Elixir library installation and usage instructions for Sign in with Ethereum integration. Covers setup and basic message handling. ```Elixir # Add to your mix.exs dependencies # {:siwe, "~> 0.1.0"} # In your Elixir code: # alias Siwe.Message # message_string = "example.com is requesting to sign in with your Ethereum account:\n\n0x...\n\nURI: https://example.com\nVersion: 1\nChain ID: 1\nIssued At: 2023-10-27T10:00:00Z" # signature = "0x..." # case Message.from_string(message_string) # when {:ok, message} # case Message.verify_signature(message, signature) # when :ok # IO.puts "Signature verified successfully!" # when {:error, reason} # IO.puts "Signature verification failed: #{inspect(reason)}" # end ``` -------------------------------- ### Install SIWE Ruby Gem Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the Sign in with Ethereum Ruby gem using the RubyGems package manager. ```bash gem install siwe ``` -------------------------------- ### Start Development Server with npm Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Starts the local development server for your frontend project using npm. This command is typically used to run the application during development, allowing for hot-reloading and easy testing. ```bash npm start ``` -------------------------------- ### Start Redis Container (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Starts a Redis container as a standalone Docker service, exposing the default Redis port. ```bash # Start Redis container docker run -d --name redis \ -p 6379:6379 \ redis:7-alpine ``` -------------------------------- ### Install Wrangler CLI (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the Wrangler CLI, a tool for deploying Cloudflare Workers, either globally or locally within a project. ```bash # Install Wrangler globally npm install -g @cloudflare/wrangler # Or install locally in project npm install --save-dev @cloudflare/wrangler ``` -------------------------------- ### Install Rubyzip Gem Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the rubyzip gem, a dependency for the Discourse SIWE plugin installation process. ```bash gem install rubyzip ``` -------------------------------- ### Install SIWE Gem for Ruby Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the SIWE gem for Ruby projects using the gem command, enabling SIWE functionality within Ruby applications. ```bash gem install siwe ``` -------------------------------- ### Clone SIWE OIDC Repository (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Clones the Sign-In with Ethereum OIDC repository from GitHub to start the deployment process. ```bash git clone https://github.com/signinwithethereum/siwe-oidc cd siwe-oidc ``` -------------------------------- ### Install SIWE and Ethers for JavaScript/TypeScript Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the SIWE and Ethers libraries using npm, commonly used for web3 interactions in JavaScript and TypeScript projects. ```bash npm install siwe ethers ``` -------------------------------- ### Bash: Install SIWE and Ethers Libraries Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the necessary Node.js packages for creating Sign in with Ethereum (SIWE) messages, including the `siwe` library and `ethers` for Ethereum utilities. Also installs TypeScript and related types for development. ```bash # Create a new project directory mkdir siwe-tutorial cd siwe-tutorial # Initialize a new Node.js project npm init -y # Install SIWE library and ethers for Ethereum utilities npm install siwe ethers # Install development dependencies npm install -D typescript @types/node ts-node ``` -------------------------------- ### Ethereum Identity Kit NPM Installation Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Command to install the Ethereum Identity Kit library using npm. This command downloads and adds the package to your project's dependencies. ```bash npm install @ethereum-identity-kit ``` -------------------------------- ### Run SIWE OIDC with Docker Compose (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Downloads and runs the SIWE OIDC Provider along with Redis using a docker-compose.yml file for a quick setup. ```bash # Run with docker-compose (includes Redis) curl -O https://raw.githubusercontent.com/spruceid/siwe-oidc/main/docker-compose.yml docker-compose up -d ``` -------------------------------- ### Install SIWE and Wagmi Dependencies Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the necessary npm packages for Sign in with Ethereum (SIWE), ethers, and Wagmi, which are required for wallet integration and signing in a Next.js application. ```bash yarn add siwe@beta ethers wagmi ``` -------------------------------- ### Add SIWE Go Module Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Adds the SIWE Go module to a project using 'go get', managing dependencies for Go applications that implement SIWE. ```bash go get github.com/signinwithethereum/siwe-go ``` -------------------------------- ### SIWE Message Example (Explicit Scheme) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt An example of a SIWE message with an explicit scheme, showing how a URI specifies the protocol for the sign-in request. ```Text https://example.com wants you to sign in with your Ethereum account: ``` -------------------------------- ### Sample Response for Get Following List Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the 'Get Following List' endpoint, showing a paginated list of followed addresses and their associated data. ```jsonc // sample response { "following": [ { "version": 1, "record_type": "address", "data": "0xc6ed8696c4885dcafdc73c5ef28511e02568b472", "tags": [] }, { "version": 1, "record_type": "address", "data": "0x1cbf9983e0d59276a58db8e8529706004fcb1837", "tags": [] }, { "version": 1, "record_type": "address", "data": "0x27d311b8958ca479615522304b442e530c8073fe", "tags": [] }, ... ] } ``` -------------------------------- ### SIWE Message Example (Implicit Scheme) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt An example of a SIWE message with an implicit scheme, demonstrating how a domain requests a user to sign in with their Ethereum account, including optional fields like statement and resources. ```Text example.com wants you to sign in with your Ethereum account: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 I accept the ExampleOrg Terms of Service: https://example.com/tos URI: https://example.com/login Version: 1 Chain ID: 1 Nonce: 32891756 Issued At: 2021-09-30T16:25:24Z - ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/ - https://example.com/my-web2-claim.json ``` -------------------------------- ### Install and Run ETHID MCP Locally Source: https://github.com/ethereumidentitykit/docs/blob/main/pages/docs/ai-tools/ethid-mcp.mdx Install the necessary dependencies and start the ETHID MCP server locally for development or testing purposes. Requires Node.js. ```bash npm install npm run dev ``` -------------------------------- ### Deploy with Docker Compose (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Command to start the services defined in the docker-compose.yml file in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### React SIWE Frontend Setup Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/complete/llms.txt Guide to building a React frontend for connecting Ethereum wallets and using SIWE for authentication user signatures. Covers frontend setup and message signing. ```JavaScript import React, { useState, useEffect } from 'react'; import { ethers } from 'ethers'; import { SIWEController } from '@web3-identity/core'; // Assuming a similar core library function SignInComponent() { const [address, setAddress] = useState(null); const [siweController, setSiweController] = useState(null); useEffect(() => { // Initialize SIWE controller when component mounts const controller = new SIWEController({ domain: window.location.host, uri: `https://${window.location.host}`, // ... other options }); setSiweController(controller); }, []); const connectWallet = async () => { if (!window.ethereum) { alert('Please install MetaMask!'); return; } try { const provider = new ethers.providers.Web3Provider(window.ethereum); await provider.send('eth_requestAccounts', []); const signer = provider.getSigner(); const userAddress = await signer.getAddress(); setAddress(userAddress); } catch (error) { console.error('Error connecting wallet:', error); } }; const handleSignIn = async () => { if (!address || !siweController) return; try { const message = await siweController.createMessage({ address: address, chainId: 1, // Example chain ID nonce: 'your-nonce', // Fetch nonce from backend issuedAt: new Date().toISOString(), }); const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); const signature = await signer.signMessage(message.toMessage()); // Or signMessage(message.toEIP191Message()) // Send message and signature to backend for verification const response = await fetch('/verify-siwe', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ message: message.toMessage(), signature }), }); const result = await response.json(); if (result.success) { alert('Sign-In successful!'); } else { alert('Sign-In failed.'); } } catch (error) { console.error('Error during sign-in:', error); } }; return (
{!address ? ( ) : ( <>

Connected: {address}

)}
); } export default SignInComponent; ``` -------------------------------- ### SIWE Message Example (Implicit Scheme with Port) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt An example of a SIWE message with an implicit scheme and an explicit port, indicating the specific network address for the sign-in request. ```Text example.com:3388 wants you to sign in with your Ethereum account: ``` -------------------------------- ### Example JSON Translation File (JSON) Source: https://github.com/ethereumidentitykit/docs/blob/main/pages/docs/components/translation-provider.mdx Provides a sample structure for a JSON translation file, demonstrating how key-value pairs are organized for different languages. This example shows common phrases used in the Ethereum Identity Kit. ```json { "signInWithEthereum": "Sign in with Ethereum", "signingMessage": "Signing Message...", "follow": "Follow", "unfollow": "Unfollow", "following": "Following", "loading": "Loading..." } ``` -------------------------------- ### TypeScript SIWE Library Integration Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms.txt Provides documentation and integration examples for the TypeScript library to implement Sign in with Ethereum (EIP-4361). Covers setup, usage, and migration to newer versions. ```TypeScript import { verifyMessage } from 'ethers'; import { SiweMessage } from 'siwe'; async function verifySiweSignature(message: string, signature: string, domain: string, address: string): Promise { try { const siweMessage = new SiweMessage(message); const fields = await siweMessage.verify({ signature, domain, address }); return fields.data.success; } catch (error) { console.error('SIWE verification failed:', error); return false; } } ``` ```TypeScript // Example of migrating from SIWE v1 to v2 // Refer to the official documentation for detailed steps and code examples. ``` -------------------------------- ### Elixir SIWE Library Installation Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Shows how to add the Elixir SIWE library to a project's dependencies by updating the mix.exs file. This is the first step to using the library for Sign in with Ethereum functionality in Elixir applications. ```elixir def deps do [ {:siwe, "~> 0.3"} ] end ``` -------------------------------- ### Go SIWE Library Usage Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/complete/llms.txt Guide to installing and using the Go library for Sign in with Ethereum authentication. Covers setup and basic usage patterns for Go developers. ```Go package main import ( "fmt" "log" "github.com/chainbound/siwe-go/pkg/siwe" ) func main() { // Example usage (conceptual) message := siwe.Message{ Domain: "example.com", Address: "0x123...", Statement: "Sign in with Ethereum to my service.", URI: "https://example.com", Version: "1", ChainID: 1, Nonce: "a-random-nonce", IssuedAt: "2023-10-27T10:00:00Z", } // Serialize the message to be signed by the user serializedMessage, err := message.ToMessage() // Or ToEIP191Message() if err != nil { log.Fatalf("Failed to serialize message: %v", err) } fmt.Println("Message to sign:", serializedMessage) // On the backend, you would verify the signature using the serialized message and the signature } ``` -------------------------------- ### TypeScript SIWE Library Integration Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/complete/llms.txt Provides documentation and integration examples for the TypeScript library for Sign in with Ethereum (EIP-4361) implementation. Includes guides for quickstart and migrating to v2. ```TypeScript import { SIWEController } from '@web3-identity/core'; // Example usage (conceptual) const controller = new SIWEController({ domain: window.location.host, uri: `https://${window.location.host}`, // Replace with your actual URI // ... other options }); async function signIn() { const message = await controller.createMessage({ address: '0x...', // User's Ethereum address chainId: 1, nonce: '...', // Generate a unique nonce issuedAt: new Date().toISOString(), }); // Prompt user to sign the message using their wallet const signature = await controller.signMessage(message); // Send message and signature to backend for verification } ``` -------------------------------- ### Copy Environment Example Source: https://github.com/ethereumidentitykit/docs/blob/main/README.md Copies the example environment file (.env.example) to a new file named .env. This is a common practice for setting up project-specific configurations. ```bash cp .env.example .env ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/ethereumidentitykit/docs/blob/main/README.md Clones the documentation repository from GitHub and navigates into the 'app' directory. This is the initial step for setting up the development environment. ```bash git clone https://github.com/ethereumidentitykit/docs.git && cd app ``` -------------------------------- ### Install express-session Dependency Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Installs the 'express-session' package using yarn, which is required for managing user sessions in the backend. ```bash yarn add express-session ``` -------------------------------- ### Install Ethereum Identity Kit Source: https://github.com/ethereumidentitykit/docs/blob/main/pages/docs/index.mdx Installs the Ethereum Identity Kit along with its dependencies: wagmi, viem, and @tanstack/react-query using npm. ```bash npm install ethereum-identity-kit wagmi viem@2.x @tanstack/react-query ``` -------------------------------- ### Development Commands Source: https://github.com/ethereumidentitykit/docs/blob/main/CLAUDE.md Commands to start the development server and build/run the project in production. ```bash # Development bun dev # Start development server (localhost:3000) # Build & Production bun build # Build for production bun start # Start production server ``` -------------------------------- ### Download and Execute Binary (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Downloads the latest SIWE OIDC Provider binary for Linux x86_64 and makes it executable. ```bash # Download latest release wget https://github.com/spruceid/siwe-oidc/releases/latest/download/siwe-oidc-linux-x86_64 chmod +x siwe-oidc-linux-x86_64 ``` -------------------------------- ### TypeScript SIWE Installation Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Instructions for installing the Sign in with Ethereum library for TypeScript projects via npm. The library offers comprehensive EIP-4361 support. ```npm npm install siwe ``` -------------------------------- ### Free ENS Subdomains and Starter Profiles Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/efp/llms-full.txt This proposal suggests providing new users with a free off-chain ENS subdomain and a starter ENS profile avatar during wallet creation. This utilizes CCIP-read for cross-chain information retrieval and aims to onboard users more smoothly. ```Solidity pragma solidity ^0.8.0; interface ENSManager { function createSubdomain(string memory name, address owner) external returns (address); function setProfileAvatar(address ensNode, address avatarAddress) external; } interface CCIPReadResolver { function resolve(bytes32 recordName, bytes32 recordNamespace) external view returns (bytes memory); } contract WalletOnboarding { ENSManager public ensManager; CCIPReadResolver public ccipResolver; address public ensRegistryAddress; constructor(address _ensManager, address _ccipResolver, address _ensRegistry) { ensManager = ENSManager(_ensManager); ccipResolver = CCIPReadResolver(_ccipResolver); ensRegistryAddress = _ensRegistry; } function onboardNewUser(address newUserAddress, string memory subdomainName) public { // 1. Create a free off-chain ENS subdomain (example) // Note: Actual subdomain creation might involve ENSIP-110 or similar mechanisms // and might not be directly callable like this without specific ENS contracts. // This is a conceptual representation. // ensManager.createSubdomain(subdomainName, newUserAddress); // 2. Set a starter ENS profile avatar (example) // Assuming a default avatar contract address exists address defaultAvatarContract = 0xDefaultAvatarAddress; // ensManager.setProfileAvatar(newUserAddress, defaultAvatarContract); // 3. Use CCIP-read to potentially fetch data or verify ownership if needed // Example: Fetching a record for the user // bytes32 recordName = keccak256(abi.encodePacked("user_data", newUserAddress)); // bytes memory recordData = ccipResolver.resolve(recordName, keccak256(abi.encodePacked("ens"))); // In a real implementation, the subdomain creation and profile setup would interact // with the actual ENS smart contracts and potentially off-chain services. // This code is illustrative. } } ``` -------------------------------- ### Rust SIWE Documentation and Resources Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms.txt Provides documentation and resources for using the Rust implementation of Sign in with Ethereum. Covers library usage and integration patterns. ```Rust /* // Add to your Cargo.toml: // siwe = "0.1.0" use siwe::Message; fn main() { let message_str = "example.com is requesting to sign in with your Ethereum account:\n\n0x...\n\nURI: https://example.com\nVersion: 1\nChain ID: 1\nIssued At: 2023-10-27T10:00:00Z"; let signature = "0x..."; match Message::parse(message_str) { Ok(message) => { match message.verify(signature) { Ok(_) => println!("Signature verified successfully!"), Err(e) => eprintln!("Signature verification failed: {}", e), } } Err(e) => eprintln!("Failed to parse message: {}", e), } } */ ``` -------------------------------- ### Sample Response: Recommended Users Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/efp/llms-full.txt Example JSON response for the /lists/:token_id/recommended endpoint, listing recommended users with their name, address, avatar, header, class, and creation timestamp. ```jsonc // sample response { "recommended": [ { "name": "swindler.eth", "address": "0xf972bf8592c3171b378e97bb869a980c3f476583", "avatar": "https://rainbow.mypinata.cloud/ipfs/QmcSAHrGGdXJRPmxYUk1R86Wqpfgg4TPMAXC6MfQHPugvF", "header": "https://rainbow.mypinata.cloud/ipfs/QmVDbkDutSk4phVohMs76jV4RgT3bpSdzHnesBHFxW6jRL", "class": "B", "created_at": "2025-03-07T15:53:58.797Z" }, { "name": "gratefulape.eth", "address": "0x52a4c418576dc46e4116ececc6f68d1c9b9636ed", "avatar": "https://euc.li/gratefulape.eth", "header": null, "class": "B", "created_at": "2025-03-07T15:53:58.797Z" }, { "name": "treeskulltown.eth", "address": "0x2dacc0b072146b40e60b8596b99756112d45c924", "avatar": "https://euc.li/treeskulltown.eth", "header": null, "class": "B", "created_at": "2025-03-07T15:53:58.797Z" }, ... ] } ``` -------------------------------- ### Sample Response for Get Button State Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the 'Get Button State' endpoint, indicating the follow, block, and mute status for a user within a list. ```jsonc // sample response { "token_id": "3", "address": "0x983110309620d911731ac0932219af06091b6744", "state": { "follow": true, "block": false, "mute": false, }, } ``` -------------------------------- ### Sample Response for Get List Tags Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the 'Get List Tags' endpoint, showing token ID, tags, tag counts, and tagged addresses. ```jsonc // sample response { "token_id": "41", "tags": ["top8", "block"], "tagCounts": [ { "tag": "top8", "count": 7, }, { "tag": "block", "count": 1, }, ], "taggedAddresses": [ { "address": "0xf9a24785cab3ed0921c41fb84dedfea935a4ad1b", "tag": "top8", }, { "address": "0x8eddf5431f5b31933bfbd8111d54fc6e9456e6c1", "tag": "top8", }, { "address": "0x8b24b1686832757e2f6d640e11e88e7f0064594a", "tag": "top8", }, { "address": "0x60377ec355857c2d06d1ce28555f624257344b0d", "tag": "top8", }, { "address": "0xfa1afc4534fc9f80a552e61dd04cd8a172c821a6", "tag": "top8", }, { "address": "0xc808ffa16d6773d6a9109b1ab92e839157eb0954", "tag": "block", }, { "address": "0x983110309620d911731ac0932219af06091b6744", "tag": "top8", }, { "address": "0x2a59071ff48936c6838dcac425fa0df6ea5979bf", "tag": "top8", }, ], } ``` ```jsonc // sample response { "token_id": "3", "tags": ["vogu", "top8"], "tagCounts": [ { "tag": "vogu", "count": 1, }, { "tag": "top8", "count": 8, }, ], "taggedAddresses": [ { "address": "0x0f2e3e67cb000993d07e60261748963d3f4bd6d9", "tag": "vogu", }, { "address": "0x71adb34117c9408e74ed112b327a0ec97cef8fa1", "tag": "top8", }, { "address": "0x8f5906963ae276e1631efa8ff1a9cae6499ec5e3", "tag": "top8", }, { "address": "0x983110309620d911731ac0932219af06091b6744", "tag": "top8", }, { "address": "0xbe4f0cdf3834bd876813a1037137dcfad79acd99", "tag": "top8", }, { "address": "0xc983ebc9db969782d994627bdffec0ae6efee1b3", "tag": "top8", }, { "address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", "tag": "top8", }, { "address": "0xe2cded674643743ec1316858dfd4fd2116932e63", "tag": "top8", }, { "address": "0xeb6b293e9bb1d71240953c8306ad2c8ac523516a", "tag": "top8", }, ], } ``` -------------------------------- ### Get Nonce Manager Statistics (Development) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt An Express.js GET route to retrieve statistics from the nonce manager. This route is restricted to non-production environments to avoid exposing sensitive information. ```javascript /** * GET /auth/stats * Get nonce manager statistics (development only) */ router.get('/stats', (req, res) => { if (process.env.NODE_ENV === 'production') { return res.status(404).json({ success: false, error: { message: 'Not found' }, }) } const stats = nonceManager.getStats() res.status(200).json({ success: true, stats, }) }) ``` -------------------------------- ### Python SIWE Library Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Information about the Python implementation of Sign in with Ethereum, available on GitHub and PyPI. Provides a link to the official repository. ```link https://github.com/signinwithethereum/siwe-py ``` -------------------------------- ### Setup Ethereum Identity Kit with Providers Source: https://github.com/ethereumidentitykit/docs/blob/main/pages/docs/index.mdx Sets up the Ethereum Identity Kit by integrating WagmiProvider, TransactionProvider, and QueryClientProvider for wallet connection, onchain transactions, and data fetching. ```tsx import { WagmiProvider } from 'wagmi' import { wagmiConfig } from '#/lib/wagmi' import { TransactionProvider } from 'ethereum-identity-kit' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' const queryClient = new QueryClient() export default function App({ Component, pageProps }: AppProps) { return ( ) } ``` -------------------------------- ### Install Ethereum Identity Kit Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Installs the Ethereum Identity Kit and its dependencies (wagmi, viem, @tanstack/react-query) using npm or yarn. ```sh npm install ethereum-identity-kit wagmi viem@2.x @tanstack/react-query ``` -------------------------------- ### Deploy to Cloudflare (Bash) Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Deploys the SIWE OIDC Provider to Cloudflare, either to the production environment or a preview environment. ```bash # Deploy to production wrangler publish # Deploy to preview environment wrangler publish --env preview ``` -------------------------------- ### Get User Tags Response Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the Get User Tags endpoint, showing the user's address, the tags they possess, the frequency of each tag, and specific addresses linked to those tags. ```jsonc // sample response { "address": "0x983110309620d911731ac0932219af06091b6744", "tags": [ "top8", "block", "degen" ], "tagCounts": [ { "tag": "top8", "count": 8 }, { "tag": "block", "count": 2 }, { "tag": "degen", "count": 4 } ], "taggedAddresses": [ { "address": "0x44a3a18df15ae79bbc6c660db59428fe9a181864", "tag": "top8" }, { "address": "0x4d982788c01402c4e0f657e1192d7736084ae5a8", "tag": "block" }, { "address": "0x4d982788c01402c4e0f657e1192d7736084ae5a8", "tag": "degen" }, { "address": "0x60377ec355857c2d06d1ce28555f624257344b0d", "tag": "top8" }, ... ] } ``` -------------------------------- ### Sample Response for User Lists Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/efp/llms-full.txt Example JSON response structure for the user lists endpoint, showing primary list and other associated lists. ```jsonc // sample response { "primary_list": "4", "lists": ["4", "107"] } ``` -------------------------------- ### Get User Following List Response Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the Get User Following List endpoint, showing an array of followed users, each with their version, record type, data (address), and associated tags. ```jsonc // sample response { "following": [ { "version": 1, "record_type": "address", "data": "0x983110309620d911731ac0932219af06091b6744", "tags": ["efp", "ens"], }, { "version": 1, "record_type": "address", "data": "0xbdb41bff7e828e2dc2d15eb67257455db818f1dc", "tags": ["efp", "ens"], }, { "version": 1, "record_type": "address", "data": "0xf4212614c7fe0b3feef75057e88b2e77a7e23e83", "tags": ["efp"], }, ], } ``` -------------------------------- ### Get User ENS Details Response Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the Get User ENS Details endpoint, showing the structure of user information including ENS name, address, avatar, and various records. ```jsonc // sample response { "ens": { "name": "brantly.eth", "address": "0x983110309620d911731ac0932219af06091b6744", "avatar": "https://euc.li/brantly.eth", "records": { "avatar": "https://euc.li/brantly.eth", "com.discord": "brantly.eth", "com.github": "brantlymillegan", "com.twitter": "brantlymillegan", "description": "Catholic, husband, father | building @efp.eth | ENS (DAO delegate, former core team) | Sign-in with Ethereum (creator)", "email": "me@brantly.xyz", "header": "https://i.imgur.com/Quo06x2.png", "location": "USA", "name": "Brantly Millegan", "org.telegram": "brantlymillegan", "url": "https://efp.app/", }, "updated_at": "2024-09-18T03:40:58.807Z", }, } ``` -------------------------------- ### Get Tags Applied to a User Response Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/eik/llms-full.txt Example JSON response for the Get Tags Applied to a User endpoint, detailing the user's address, the tags applied, counts for each tag, and a list of addresses associated with those tags. ```jsonc // sample response { "address": "0xc9c3a4337a1bba75d0860a1a81f7b990dc607334", "tags": ["top8"], "tagCounts": [ { "tag": "top8", "count": 5, }, ], "taggedAddresses": [ { "address": "0x5a3bf42028901447434d12c5459954e667e5c518", "tag": "top8", }, { "address": "0x71adb34117c9408e74ed112b327a0ec97cef8fa1", "tag": "top8", }, { "address": "0x8eddf5431f5b31933bfbd8111d54fc6e9456e6c1", "tag": "top8", }, { "address": "0xfa1afc4534fc9f80a552e61dd04cd8a172c821a6", "tag": "top8", }, { "address": "0xc983ebc9db969782d994627bdffec0ae6efee1b3", "tag": "top8", }, ], } ``` -------------------------------- ### API URL Example Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/efp/llms-full.txt Demonstrates how to replace the default EFP API URL with a generated public link from Railway. ```bash api.ethfollow.xyz/api/v1/stats -> my-generated-api-link.railway.app/api/v1/stats ``` -------------------------------- ### Sign SIWE Messages from Go Source: https://github.com/ethereumidentitykit/docs/blob/main/public/llms/siwe/llms-full.txt Illustrates the process of signing SIWE messages from Go code. It includes helper functions for hashing the message and applying the correct signature format. ```go func signHash(data []byte) common.Hash { msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data) return crypto.Keccak256Hash([]byte(msg)) } func signMessage(message string, privateKey *ecdsa.PrivateKey) ([]byte, error) { sign := signHash([]byte(message)) signature, err := crypto.Sign(sign.Bytes(), privateKey) if err != nil { return nil, err } signature[64] += 27 return signature, nil } ```