GeoClue2 D-Bus location proof plugin for Astral Protocol.
Queries the GeoClue2 daemon over D-Bus for location. GeoClue2 aggregates WiFi, cell tower, and IP signals on Linux.
- Node.js 18+
- Linux with
geoclue-2.0package installed - D-Bus system bus access
gdbusavailable on PATH
npm install @location-proofs/plugin-geoclue @decentralized-geo/astral-sdk ethersimport { AstralSDK } from '@decentralized-geo/astral-sdk';
import { GeocluePlugin } from '@location-proofs/plugin-geoclue';
const sdk = new AstralSDK({ chainId: 11155111 });
sdk.plugins.register(new GeocluePlugin({ privateKey: '0x...' }));
const signals = await sdk.stamps.collect({ plugins: ['geoclue'] });import { collectGeoclue, createStampFromSignals, signStamp, verifyGeoclueStamp } from '@location-proofs/plugin-geoclue';
import { ethers } from 'ethers';
const signals = await collectGeoclue(8000);
const unsigned = createStampFromSignals(signals, '0.1.0', 60);
const wallet = new ethers.Wallet('0x...');
const stamp = await signStamp(unsigned, wallet);
const result = await verifyGeoclueStamp(stamp);| Option | Default | Description |
|---|---|---|
privateKey |
random | Hex-encoded ECDSA private key for signing |
timeoutMs |
8000 | Per-step D-Bus timeout in milliseconds |
durationSeconds |
60 | Temporal footprint duration |
| Field | Description |
|---|---|
source |
Always 'geoclue2' |
accuracyMeters |
Reported accuracy from GeoClue2 |
altitudeMeters |
Altitude if available |
platform |
Always 'linux' |
The verify function checks:
- Structure — lpVersion
0.2, plugin name, required fields - Signatures — ECDSA recovery matches declared signer, using canonical (sorted-key) serialization
- Signals — coordinate bounds, accuracy > 0, platform is
linux