@appsensorlike/appsensorlike
Version:
A port of OWASP AppSensor reference implementation
33 lines (32 loc) • 1.06 kB
TypeScript
import { AppsensorEntity } from '../core.js';
/**
* General object representing geo-location.
*/
declare class GeoLocation extends AppsensorEntity {
protected latitude: number;
protected longitude: number;
constructor(latitude: number, longitude: number);
getLatitude(): number;
setLatitude(latitude: number): GeoLocation;
getLongitude(): number;
setLongitude(longitude: number): GeoLocation;
equals(obj: Object | null): boolean;
}
/**
* A geo-locator performs a lookup of an IP address and converts it to a {@link GeoLocation}.
*
* Different implementations will use different geo-location libraries.
*
* In contrast to the ORIGINAL code here methods are asynchronous returning Promise<T>.
*/
interface GeoLocator {
/**
* Perform a lookup of an IP address and return a {@link GeoLocation}.
*
* @param address IP address to geolocate
*
* @return populated {@link GeoLocation} object.
*/
readLocation(address: string): Promise<GeoLocation | null>;
}
export { GeoLocation, GeoLocator };