
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
actgeowebsdk
Advanced tools
The **ActGeo Web SDK** is a library designed to handle location validation and session management for web and mobile applications. It allows you to request location permissions, generate session tokens with QR codes, send location data to a server, and va
The ActGeo Web SDK is a library designed to handle location validation and session management for web and mobile applications. It allows you to request location permissions, generate session tokens with QR codes, send location data to a server, and validate the user's location.
To use the SDK in your project, you need to install it locally via npm or yarn.
npm install actgeowebsdk
<script src="path/to/actgeowebsdk/actgeo-web-sdk.js"></script>
After installation, you can initialize and use the SDK in your application as follows:
The first step is to initialize the SDK with an API key and the base URL of your server. This step is mandatory before using any other methods.
ActGeo.InitSDKWithConfiguration(config);
InitSDKWithConfiguration(config)
This method initializes the SDK with the provided API key, base URL and accountId for making API calls.
apiKey
(string): Your API key. (Required)baseUrl
(string): The base URL for your API. (Required)accountId
(string): The base URL for your API. (Optional)location
(object): The base URL for your API. (Optional)
Latitude
(number): Latitude coordinate.Longitude
(number): Longitude coordinate.enableLogging
(bool): enable logging. default is false. (Optional)status
(number): Indicates the status api response. (0 for success).sessionId
(string): A unique identifier for the session.expiryTime
(number): The session expiry time in timestamp format.qrCode
(string): Base64 image data of qr code.const config = {
apiKey: "your_api_key", // Required
baseUrl: "https://your.server.base.url", // Required
accountId: "Acc0001", // Optional
location: { Latitude: 37.7749, Longitude: -122.4194 }, // Optional
enableLogging: true, // Optional, default is false
};
ActGeo.InitSDKWithConfiguration(config)
.then((data) => {
if (data) {
console.log("SDK Initialized With:", data);
} else {
console.log("SDK Initialized Failed");
}
})
.catch((error) => {
console.error("Error in sdk initialization:", error);
});
StartLocationValidation()
After successfully initializing the SDK with a QR Code, use this method to start a validation timer. This timer checks whether the user has validated their location by scanning the QR code using the ActVerify App within the server-specified timeout.
onSuccess
(Function): Callback function that is invoked when the location validation is successful. Receives the validated location data as an argument.onFailure
(Function): Callback function that is invoked when the validation fails or the timer reaches the timeout. Receives a string message as an argument.onSuccess
callback return a promise that resolves to an object containing session details if the validation is successful.status
(number): Indicates the status of the session. (1 for pending, 2 for success, 3 for failure, 4 for expired, 9 for missing session id parameter, 12 for backend error, 42 for missing session id).expiryTime
(number): The session expiry time in timestamp format.ActGeo.StartLocationValidation(
(data) => {
console.log("Validation successful!", data);
},
(error) => {
console.error("Validation failed:", error);
}
);
RequestSessionCheck()
The RequestSessionCheck
method is used to verify the current status of a user session with the server.
ActGeo.RequestSessionCheck()
.then((sessionDetails) => {
console.log("Session details:", sessionDetails);
})
.catch((error) => {
console.error("Failed to check session status:", error.message);
});
StopLocationValidation()
The StopLocationValidation
method is used to stop the validation timer if it is currently running. This is particularly useful when the user wants to forcefully stop the ongoing location validation process before the timer completes.
ActGeo.StopLocationValidation();
RequestForLocationPermission()
Requests location permission from the user’s browser. This method is optional and provided as a convenience for clients who prefer to use the library's built-in implementation. Clients can handle location permission in their own way if desired.
false
if permission is denied.ActGeo.RequestForLocationPermission()
.then((permissionGrantedWithCoordinate) => {
if (permissionGrantedWithCoordinate) {
console.log("Location permission granted");
} else {
console.log("Location permission denied");
}
})
.catch((error) => {
console.error("Error requesting location permission:", error);
});
The SDK uses Promises for asynchronous methods. If an error occurs during any operation, it is thrown and should be handled by the client. For example:
ActGeo.ValidateSessionStatus()
.then((validationStatus) => {
console.log("Location validated status:", validationStatus);
})
.catch((error) => {
console.error("Error validating location:", error);
});
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
The **ActGeo Web SDK** is a library designed to handle location validation and session management for web and mobile applications. It allows you to request location permissions, generate session tokens with QR codes, send location data to a server, and va
We found that actgeowebsdk 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.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.