Skip to content

PortalTechnologiesInc/portal-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

629 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Portal App

Portal App

Portal is a mobile identity wallet for secure authentication and payments using the Nostr protocol. Built with React Native and Expo, it puts you in complete control of your digital identity and personal data with enterprise-grade security.

✨ Features

πŸ” Authentication & Identity

  • Nostr Authentication: Cryptographically secure authentication with websites and services
  • Biometric Security: Face ID, Touch ID, and fingerprint authentication
  • Secure Key Management: Private keys never leave your device
  • Identity Management: Complete control over your digital identity

πŸ’³ Payments & Subscriptions

  • Lightning Payments: One-time Bitcoin Lightning Network payments
  • Cashu/eCash Support: Native Cashu token support for eCash payments and transactions
  • Subscription Management: Monitor and control recurring payments
  • Payment Status Tracking: Real-time payment status with Revolut-style UI
  • Wallet Integration: Seamless NWC (Nostr Wallet Connect) integration

πŸ“± User Experience

  • Activity Dashboard: Comprehensive tracking of all authentications and payments
  • QR Code Scanner: Quick authentication and payment initiation
  • NFC Scanning: Contactless NFC tag scanning for authentication and ticket validation
  • Ticket Management: Digital ticket storage, validation, and recovery
  • Dark/Light Theme: Adaptive theme system with system preference support
  • Intuitive Navigation: Tab-based navigation with detailed activity views

πŸ”’ Security & Privacy

  • Local Storage: All sensitive data stored securely on device
  • Biometric Protection: Additional security layer for sensitive operations
  • No Data Sharing: Zero personal data shared without explicit consent
  • Cryptographic Verification: All operations cryptographically verified

πŸ›  Technology Stack

Core Technologies

  • React Native - Cross-platform mobile development (New Architecture enabled)
  • Expo SDK 53 - Development platform and SDK
  • TypeScript - Type-safe development with strict mode
  • Expo Router - File-based navigation with typed routes

Storage & Security

Nostr & Payments

  • Nostr Protocol - Decentralized identity and messaging
  • Custom Rust lib - Core Nostr logic and cryptography (via UniFFI bindings)
  • NWC Integration - Nostr Wallet Connect for Lightning payments
  • Breez SDK - Lightning Network payments

UI & Tooling

🧰 Development Environment

Nix DevShell

This project uses Nix flakes to provide a reproducible development environment. Running nix develop gives you:

  • Node.js - JavaScript runtime (required by Metro/Expo)
  • Bun - Package manager
  • OpenJDK 17 - For Android Gradle builds
  • Android SDK - Build tools, platform, NDK
  • Biome - Linting and formatting
  • Expo CLI - Expo development tools

Git Hooks

The project uses Husky for Git hooks, installed automatically on bun install:

  • pre-commit: Runs lint-staged which applies biome check --write on staged files (auto-fixes formatting and import sorting)
  • pre-push: Runs typecheck and check on the full project to ensure quality before pushing

These same checks run in CI, so if your push passes locally, it passes in CI.

πŸš€ Getting Started

Prerequisites

  • Nix with flakes enabled
  • iOS Simulator (Mac) or Android Studio (for emulators)

Installation

  1. Clone the repository:

    git clone https://github.com/PortalTechnologiesInc/Portal-App.git
    cd Portal-App
  2. Enter the Nix development shell:

    nix develop

    This provides Node.js, Bun, Android SDK, Java, and all required tooling.

  3. Install dependencies:

    bun install
  4. Start the development server:

    bun run start
  5. Run on device/simulator:

    # Android
    bun run android
    
    # iOS (macOS only)
    bun run ios

πŸ“± Usage Guide

First-Time Setup

  1. Generate Identity: Create a new Nostr private key or import existing seed phrase/nsec
  2. Set PIN: Configure a PIN for app lock
  3. Profile Configuration: Set up your identity information
  4. Wallet Connection: Connect your NWC-compatible Lightning wallet

Authentication Flow

  1. Scan QR Code or NFC Tag: Use built-in scanner or NFC reader from website or service
  2. Review Request: Examine authentication details and permissions
  3. Biometric Confirmation: Confirm with Face ID/Touch ID
  4. Approve/Deny: Complete the authentication process

Payment Management

  1. Payment Requests: Review incoming payment requests (Lightning or Cashu)
  2. Status Tracking: Monitor payment progress with real-time updates
  3. Subscription Control: Manage recurring payments and subscriptions
  4. Ticket Management: Store, validate, and recover digital tickets via NFC
  5. Activity History: View complete payment and authentication history

πŸ— Project Architecture

Directory Structure

portal-app/
β”œβ”€β”€ app/                       # Expo Router pages (file-based routing)
β”‚   β”œβ”€β”€ (tabs)/                # Tab navigation screens
β”‚   β”‚   β”œβ”€β”€ index.tsx          # Home screen
β”‚   β”‚   β”œβ”€β”€ Activities.tsx
β”‚   β”‚   β”œβ”€β”€ Subscriptions.tsx
β”‚   β”‚   β”œβ”€β”€ Tickets.tsx
β”‚   β”‚   β”œβ”€β”€ Wallet.tsx
β”‚   β”‚   └── Settings.tsx
β”‚   β”œβ”€β”€ (onboarding)/          # First-time setup flow
β”‚   β”‚   β”œβ”€β”€ generate/          # Key generation
β”‚   β”‚   └── import/            # Key import (mnemonic/nsec)
β”‚   β”œβ”€β”€ activity/[id]/         # Dynamic activity detail pages
β”‚   β”œβ”€β”€ subscription/[id]/     # Subscription management
β”‚   β”œβ”€β”€ breezwallet/           # Breez wallet pay/receive
β”‚   β”œβ”€β”€ nfc/                   # NFC scanner flow
β”‚   β”œβ”€β”€ qr/                    # QR scanner flow
β”‚   β”œβ”€β”€ wallet.tsx             # Wallet management
β”‚   β”œβ”€β”€ relays.tsx             # Nostr relay configuration
β”‚   β”œβ”€β”€ error.tsx              # Error boundary
β”‚   └── [...deeplink].tsx      # Deep link catch-all
β”œβ”€β”€ components/                # Reusable UI components
β”‚   β”œβ”€β”€ ActivityDetail/        # Activity-specific components
β”‚   β”œβ”€β”€ onboarding/            # Onboarding-specific components
β”‚   └── ui/                    # Base UI components
β”œβ”€β”€ context/                   # React Context providers
β”œβ”€β”€ services/                  # Core business logic
β”œβ”€β”€ hooks/                     # Custom React hooks
β”œβ”€β”€ models/                    # TypeScript interfaces
β”œβ”€β”€ constants/                 # App constants and configuration
β”œβ”€β”€ utils/                     # Helper functions and utilities
β”œβ”€β”€ migrations/                # SQLite database migrations
β”œβ”€β”€ plugins/                   # Custom Expo config plugins
β”œβ”€β”€ scripts/                   # Build and device management scripts
β”œβ”€β”€ debug-scripts/             # Database debugging tools
└── .github/workflows/         # CI/CD pipeline

State Management

  • Context-based Architecture: Multiple specialized contexts for different domains
  • SQLite Database: Persistent storage for activities, subscriptions, and user data
  • Secure Storage: Encrypted storage for sensitive keys and tokens

πŸ”§ Development

Available Scripts

# Development (runs typecheck + lint first)
bun run start
bun run android
bun run android-release
bun run ios

# Type checking
bun run typecheck

# Linting and formatting (Biome)
bun run lint                   # lint only
bun run check                  # lint + format
bun run check:strict           # lint + format, warnings as errors
bun run check:fix              # lint + format with auto-fix
bun run format                 # format with auto-write
bun run format:check           # format check only

# Testing
bun run test                   # Jest unit tests (watch mode)

Key Development Patterns

Theme-Aware Components

import { useThemeColor } from '@/hooks/useThemeColor';

const backgroundColor = useThemeColor({}, 'background');
const textColor = useThemeColor({}, 'textPrimary');

Database Operations

import { DatabaseService } from '@/services/DatabaseService';
import { useSQLiteContext } from 'expo-sqlite';

const db = useSQLiteContext();
const dbService = new DatabaseService(db);

Biometric Authentication

import { BiometricAuthService } from '@/services/BiometricAuthService';

const authResult = await BiometricAuthService.authenticate();

Adding New Features

  1. Create Components: Add to appropriate directory in components/
  2. Update Context: Extend existing or create new context providers
  3. Database Schema: Update database migrations in migrations/
  4. Type Definitions: Add interfaces to models/ directory
  5. Navigation: Add routes in app/ directory following Expo Router conventions

πŸ“¦ Building & Deployment

Local Builds

The project is fully self-managed β€” no cloud build services. Build scripts handle APK/IPA creation and device installation:

# Build Android APK (release)
bash scripts/build-android-apk.sh release

# Build and install on connected Android device/emulator
bash scripts/install-android-apk.sh

# Build iOS app (macOS only)
bash scripts/build-ios-ipa.sh

# Install on iOS Simulator
bash scripts/install-ios-ipa.sh

Reproducible Nix Build

For fully reproducible Android builds:

nix build .#android-bundle

This produces a signed AAB bundle using hermetic Nix derivations.

🀝 Contributing

  1. Fork the repository
  2. Enter Nix shell: nix develop
  3. Install dependencies: bun install
  4. Create a feature branch: git checkout -b feature/amazing-feature
  5. Make changes β€” Git hooks will auto-lint staged files on commit
  6. Push to branch: git push origin feature/amazing-feature (pre-push runs full typecheck + lint)
  7. Open a Pull Request

Development Guidelines

  • TypeScript: All new code must be written in TypeScript with strict mode
  • Theme Support: All components must support dark/light themes
  • Biome: Code must pass bun run check (enforced by Git hooks and CI)
  • Security First: Follow secure coding practices, especially for key management
  • Expo Router: Follow file-based routing conventions for new screens
  • Context Usage: Use appropriate context providers for state management

πŸ“„ License

This project is licensed under the MIT License with Common Clause - see the LICENSE file for details.

πŸ” Security

Portal prioritizes security and privacy:

  • πŸ”‘ Private Key Security: All private keys stored in device secure enclave
  • πŸ”’ Biometric Protection: Additional security layer for sensitive operations
  • πŸ›‘οΈ No Data Leakage: Zero telemetry or data collection
  • βœ… Cryptographic Verification: All operations cryptographically signed and verified
  • 🏠 Local-First: Everything runs locally on your device

πŸ“ž Support


Built with ❀️ by the Portal Team

About

Portal is your digital identity provider built on Nostr and Lightning

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors