
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
@magmacomputing/tempo-plugin-geo
Advanced tools
Tempo community plugin for IP geolocation lookup, browser hardware location services, and coordinate resolution.
A Community plugin for the Tempo ecosystem that provides IP geolocation lookup, browser hardware location services, coordinate normalization, and 24-hour cached coordinate stashing.
By keeping geolocation logic in this plugin, core @magmacomputing/tempo remains zero-network and purely deterministic.
👉 View the full documentation on our GitHub Pages
npm install @magmacomputing/tempo-plugin-geo
Tempo.geoInstalling GeoPlugin mounts an immutable, locked-down Tempo.geo namespace onto the Tempo class:
import { Tempo } from '@magmacomputing/tempo';
import { GeoPlugin } from '@magmacomputing/tempo-plugin-geo';
Tempo.use(GeoPlugin);
// 1. Universal Geolocation Lookup (cached for 24h)
const lookupResult = await Tempo.geo.lookup();
console.log(lookupResult.lat, lookupResult.lng, lookupResult.city);
// 2. Inspect Current Ambient / Global Coordinates
console.log(Tempo.geo.current); // { latitude: ..., longitude: ..., city: ... }
// 3. Force Fresh Network Lookup (bypassing 24h cache)
const fresh = await Tempo.geo.lookup({ refresh: true });
// 4. Enrich a Tempo Instance Asynchronously
const t = new Tempo();
const localTime = await t.geoLocate();
console.log(localTime.geo?.latitude, localTime.geo?.longitude);
All underlying utilities can be imported as standalone tree-shakeable functions without augmenting Tempo:
import { Tempo } from '@magmacomputing/tempo';
import {
geoLookup,
resolveGeoCoordinates,
stashGeo,
clearStashedGeo,
getStashedGeo,
} from '@magmacomputing/tempo-plugin-geo';
// Standalone lookup & instance creation
const coords = await geoLookup();
const t = new Tempo('2026-06-21', { geo: coords });
Tempo.geo API Surface| Method / Property | Description |
|---|---|
Tempo.geo.lookup(opts?) | Universal geolocation lookup (browser hardware GPS or server IP lookup) cached for 24h. Supports { refresh: true }. |
Tempo.geo.resolve(input, opts?) | Asynchronously resolves coordinates from an instance, configuration, or ambient storage cache. |
Tempo.geo.coerce(input) | Pure function normalizing various coordinate formats (lat/lng, latitude/longitude, etc.) into a canonical GeoConfig. |
Tempo.geo.distance(from, to, unit?) | Calculates Great-Circle distance using Haversine formula ('km', 'miles', 'm'). |
Tempo.geo.isWithin(from, to, maxDist, unit?) | Radial proximity query testing if distance between coordinates is $\le$ maxDist. |
Tempo.geo.inBoundingBox(coords, bbox) | Spatial containment check inside rectangular bounding box (supports antimeridian crossing). |
Tempo.geo.bearing(from, to, opts?) | Calculates Great-Circle forward azimuth compass bearing in degrees ($0^\circ$ to $360^\circ$). |
Tempo.geo.midpoint(from, to) | Computes Great-Circle geographic midpoint with automatic hemisphere inference ({ latitude, longitude, sphere }). |
Tempo.geo.velocity(from, to, opts?) | Computes travel speed/velocity between two timestamped geographic instances in km/h, mph, or m/s. |
Tempo.geo.isImpossibleTravel(from, to, opts?) | Detects impossible travel anomalies (e.g. concurrent logins exceeding commercial flight speeds of 900 km/h). |
Tempo.geo.solarOffset(coords, opts?) | Calculates natural solar time offset between civil clock time and solar noon based on meridian drift. |
Tempo.geo.stash(coords, ttl?, keyOrOpts?) | Stashes coordinates in storage with an optional custom TTL (default: 24h) and multi-tenant partitioning. |
Tempo.geo.clear(keyOrOpts?) | Purges stashed coordinates from storage. |
Tempo.geo.get(keyOrOpts?) | Reads stashed coordinates for the specified tenant/IP or ambient default. |
Tempo.geo.current | Read-only getter returning the active global/ambient coordinates snapshot (getStashedGeo() ?? Tempo.config.geo). |
Tempo.geo.server(opts?) | Low-level server-side IP geolocation handler. |
Tempo.geo.browser(opts?) | Low-level browser Geolocation API handler. |
[!WARNING] Ambient IP lookup on a server resolves the SERVER's location, NOT the user's location.
Tempo.geo.lookup() without options will query the datacenter's public outbound IP address.us-east-1 (Virginia) and an Australian user hits your API, calling ambient Tempo.geo.lookup() will resolve to Virginia!X-Forwarded-For, CF-Connecting-IP) and pass it explicitly:
const userCoords = await Tempo.geo.lookup({ ip: clientIp });
const userTime = new Tempo(date, { geo: userCoords });
[!CAUTION] Unpartitioned ambient storage is shared. In multi-tenant environments, always use unique keys or instance-level options.
Ambient storage stores coordinates under _magma_geo_ by default.
In a shared process or server handling requests for multiple tenants or distinct users, calling stash() or ambient lookup() without a key will cause tenants to overwrite each other's cached coordinates!
Solution A: Multi-Tenant Key Scoping: Pass a tenant identifier or user ID as the key:
// Stash coordinates partitioned for tenant A:
Tempo.geo.stash(tenantACoords, undefined, 'tenant-alpha');
// Lookup / retrieve for a specific tenant:
const coords = Tempo.geo.get('tenant-alpha');
Tempo.geo.clear('tenant-alpha');
The cache automatically partitions keys under _magma_geo_:<tenant-id>, guaranteeing strict isolation.
Solution B: Instance-Level Configuration (Recommended):
Avoid ambient storage altogether by binding coordinates directly to Tempo instances:
const tenantTime = new Tempo(date, { geo: tenantCoords });
Instance-level coordinates are completely local, immutable, and never touch shared memory or ambient caches.
In keeping with Tempo's strict immutability principles, the Tempo.geo namespace is fully locked down:
Tempo.geo namespace and its attached utilities are recursively frozen.Tempo.geo or mutate its methods (e.g. Tempo.geo.lookup = ...) will throw a TypeError in strict mode.t.geoLocate() always return a new, enriched Tempo instance, preserving the immutability of the original instance.This is a Community plugin. It is completely free and open-source for personal and commercial use under the MIT license.
FAQs
Tempo community plugin for IP geolocation lookup, browser hardware location services, and coordinate resolution.
The npm package @magmacomputing/tempo-plugin-geo receives a total of 52 weekly downloads. As such, @magmacomputing/tempo-plugin-geo popularity was classified as not popular.
We found that @magmacomputing/tempo-plugin-geo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.