Privacy-preserving location attestation
A non-transitory computer-readable medium stores instructions that implement an application programming interface (API). When invoked by a software entity executing on a computing device, the API is configured to receive, from the application, an indication of a geographic location ( 304 ); obtain, from an operating system of the computing device, an indication of a general geographic area associated with a home location of a user, wherein the operating system prevents the software entity from accessing the indication of the general geographic area ( 306 ); and provide, to the software entity, an indication of whether the geographic location is within the general geographic area ( 308 ).
1 . A non-transitory computer-readable medium storing thereon instructions that implement an application programming interface (API) on a portable device which, when invoked by a software application executing on the portable device, is configured to:
receive, from the software application, an indication of a current geographic location of the portable device;
obtain, from an operating system of the portable device, an indication of a general geographic area including a home location of the portable device, wherein the operating system prevents the software application from accessing the indication of the general geographic area; and
provide, to the software application, an indication of whether the current geographic location is within the general geographic area.
2 . The non-transitory computer-readable medium of claim 1 , wherein to obtain the indication of the general geographic area, the API is configured to access a privileged region of a memory of the portable device, wherein the privileged region of the memory is inaccessible to the software application.
3 . The non-transitory computer-readable medium of claim 1 , wherein the general geographic area is determined based on periodic readings of one or more sensors of the portable device.
4 . The non-transitory computer-readable medium of claim 1 , wherein the general geographic area is received from a user via a user interface of the portable device.
5 . The non-transitory computer-readable medium of claim 1 , wherein the API is further configured to:
receive, from the software application, a level of desired coarseness of the general geographic location,
and wherein the API compares the current geographic location to the general geographic area according to the level of coarseness.
6 . The non-transitory computer-readable medium of claim 5 , wherein the level of coarseness corresponds to one of country or continent.
7 . The non-transitory computer-readable medium of claim 1 , wherein the API is further configured:
determine an S2 cell based on the indication of the current geographic location; and
provide the indication that the current geographic location is within the general geographic area if the determined S2 cell is within, or coincides with, an S2 cell corresponding to the general geographic area including the home location of the portable device.
8 . The non-transitory computer-readable medium of claim 1 , wherein the API is further configured to:
return an error code in response to determining that the software application invoked the API more than N times during a predetermined period of time.
9 . The non-transitory computer-readable medium of claim 1 wherein the software application is a non-native software application configured to execute the operating system of the portable device.
10 . The non-transitory computer-readable medium of claim 1 , wherein the software application is a script configured to execute in a native browsing application on the portable device.
11 . A method implemented in an operating system of a portable device, the method comprising:
determining, by one or more processors, a general geographic area including a home location of the portable device;
storing, by the one or more processors, an indication of the general geographic area in a privileged region of a memory of the portable device; and
restricting, by the one or more processors, access to the indication, including:
preventing, by the one or more processors, software application executing on the portable device from accessing the indication of the general geographic area, and
granting, by the one or more processors, access to the indication to an API exposed to the software application and configured to operate on the indication without revealing the indication to the software application.
12 . The method of claim 11 , wherein determining the general geographic area includes performing periodic readings of one or more sensors of the portable device.
13 . The method of claim 11 , wherein determining the general geographic area includes performing receiving an indication of the general geographic area via a user interface of the portable device.
14 . A portable device comprising:
one or more processors;
a non-transitory computer-readable medium storing instructions which, when executed by the one or more processors, cause the portable device to:
determine a general geographic area including a home location of the portable device;
store an indication of the general geographic area in a privileged region of a memory of the portable device; and
restrict access to the indication, including:
preventing software application executing on the portable device from accessing the indication of the general geographic area, and
granting access to the indication to an API exposed to the software application and configured to operate on the indication without revealing the indication to the software application.
15 . The portable device of claim 14 , wherein determining the general geographic area includes performing periodic readings of one or more sensors of the portable device.
16 . The portable device of claim 14 , wherein determining the general geographic area includes performing receiving an indication of the general geographic area via a user interface of the portable device.