Skip to content

RStephanH/linkguard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkGuard

A QR code scanner with real-time security verification, built in Flutter.

What it does

LinkGuard scans a QR code or barcode using the camera, extracts the encoded URL, and checks it against the Google Safe Browsing API before showing a clear verdict: safe, threat detected, or network error.

Built as an academic demo project on integrating the Camera API with an external network API in mobile development.

Tech stack

  • Flutter / Dart
  • mobile_scanner — camera capture and decoding
  • http — network calls
  • Google Safe Browsing API v4 — URL reputation lookup

Architecture

lib/
├── models/scan_result.dart               # result data structure
├── services/safe_browsing_service.dart   # API call logic, testable independently of the UI
└── screens/scanner_screen.dart           # camera + state machine (idle/loading/safe/unsafe/error)

The service takes an injectable http.Client, which allows unit testing without any real network call (http.testing.MockClient).

Technical decision: why v4 instead of v5alpha1

Safe Browsing v5alpha1 (urls:search) was evaluated first but only returns protobuf, not JSON ("Unsupported Output Format" when requesting $alt=json). Decoding protobuf in Dart would require generating code from an official .proto file — disproportionate complexity for this project. The stable v4 API (native JSON) was used instead.

Known limitation

Google Safe Browsing alone only covers threats already listed in its databases — a very recent phishing URL may not be detected yet. A future version could aggregate multiple sources (e.g. VirusTotal) for a stronger consensus score.

Running the project

flutter pub get
flutter run --dart-define=SAFE_BROWSING_API_KEY=your_api_key

Get an API key via Google Cloud Console → APIs & Services → enable "Safe Browsing API" → Credentials → Create API key.

Tests

flutter test

4 mocked unit tests cover: safe URL, unsafe URL, HTTP error, network error — with no dependency on a real network call.

Manual network check

dart run bin/manual_safe_browsing_check.dart -DSAFE_BROWSING_API_KEY=your_api_key

Runs a single real call against Google's official test malware URL, useful for confirming the live API integration before a demo.

About

QR code scanner with real-time URL threat verification, built in Flutter using the Camera API and Google Safe Browsing API.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages