Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
This TypeScript module provides an interface to interact with the LoginLlama API, which offers login status checks for users based on various parameters.
Install via NPM. Requires Node.js 18 or higher (as we use the Fetch API)
npm i -s loginllama
First, import the necessary classes and types:
import { LoginLlama } from "loginllama";
To initialize the LoginLlama
class, you can either provide an API token directly or set it in the environment variable LOGINLLAMA_API_KEY
.
const loginllama = new LoginLlama("YOUR_API_TOKEN");
Or, if using the environment variable of LOGINLLAMA_API_KEY
:
const loginllama = new LoginLlama();
// Pulls from the environment variable LOGINLLAMA_API_KEY
The primary function provided by this module is check_login
, which checks the login status of a user based on various parameters.
request
(optional): An Express request object. If provided, the IP address and user agent will be extracted from this object.ip_address
(optional): The IP address of the user. If not provided and the request
object is given, it will be extracted from the request.user_agent
(optional): The user agent string of the user. If not provided and the request
object is given, it will be extracted from the request.identity_key
: The unique identity key for the user. This is a required parameter.The function returns a promise that resolves to a LoginCheck
object. This object contains the result of the login check, including the status, a message, and any applicable codes indicating the reason for the status.
Using IP address and user agent directly:
const loginCheckResult = await loginLlama.check_login({
ip_address: "192.168.1.1",
user_agent: "Mozilla/5.0",
identity_key: "user123",
});
Using an Express request object:
const loginCheckResult = await loginLlama.check_login({
request: req,
identity_key: "user123",
});
The check_login
function will throw errors if any of the required parameters (ip_address
, user_agent
, or identity_key
) are missing (if request
is not provided).
The default API endpoint used by this module is https://loginllama.app/api/v1
.
The module provides an enumeration LoginCheckStatus
that lists various possible status codes returned by the LoginLlama API, such as VALID
, IP_ADDRESS_SUSPICIOUS
, KNOWN_BOT
, etc.
If you find any issues or have suggestions for improvements, please open an issue or submit a pull request. Your contributions are welcome!
This module is licensed under the GNU GPL V3 License.
FAQs
Loginllama API wrapper
The npm package loginllama receives a total of 11 weekly downloads. As such, loginllama popularity was classified as not popular.
We found that loginllama 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.