DIGIPIN - Your Digital Pincode 📍
DIGIPIN is a simple, client-side web application that helps you find your DIGIPIN based on your geographic location or decode a DIGIPIN to its precise coordinates. This project is a pilot initiative by India Post, designed to explore a new system for location identification. The web app is entirely self-contained; it runs directly in your browser without any backend server or database, ensuring your privacy as no data is stored or transmitted.
The core functionality of the DIGIPIN web app is built on a few key principles:
- Client-Side Processing: All calculations for encoding and decoding DIGIPINs are performed locally on your device within the browser. This means the app works offline after the initial load and doesn't require an active connection to a server for its primary functions.
- Privacy-Focused: Because there is no backend, your location data is never sent to a server. It is used only for the purpose of calculating your DIGIPIN and is stored in a temporary global object for session management.
- Location Detection: The app prioritizes accurate location data. It first prompts you to grant geolocation permission to use your device's GPS for the most precise coordinates. If you deny permission or your device doesn't support GPS, a fallback method is used to approximate your location via your IP address using the
https://ipinfo.io/jsonservice. This method may be less accurate but ensures the app remains functional.
- Find Your DIGIPIN: The app automatically detects your location when you first open the page.
- Interactive Map: You can manually get the DIGIPIN for any location by clicking or dragging the map to the desired spot. The DIGIPIN will be updated based on the coordinates of the selected point.
- DIGIPIN Search & Decoding: The search bar allows you to enter a DIGIPIN to see its corresponding location. Upon a successful search, the map will be centered on the coordinates associated with that DIGIPIN.
- Shareable URLs: When a DIGIPIN is successfully decoded via the search function, the app automatically appends the DIGIPIN to the URL as a hash (e.g.,
https://digipin.idkey.in/#digipin). This makes it easy to share a specific location with others. - Location Reset: The initial location (either from GPS or IP) is stored in a global object. This allows you to easily reset the map to your initial detected location at any point. If this global object is empty (e.g., after a page refresh), the app will re-fetch the location based on your permission settings.