npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minfraud-node

v1.0.1

Published

MaxMind minFraud client for Node.js (With Types! 😍)

Downloads

4

Readme

minFraud Node Client

A Promise & TypeScript-ified Node client for minFraud fraud mitigation API.

Enables super handy auto-completion for minFraud input and response data in IDEs like VSCode and WebStorm. We're also using Promises allowing you take advantage of the the brand spanking new async/await syntax.

Downloads Version Node Version CircleCI

Installation

Takes a second to install using npm.

npm install minfraud-node 

Usage

Import and initialize the client.

import MinFraud from 'minfraud-node';

const client = new MinFraud({
    accountId: '123456',    // Your MaxMind Account ID
    license: 'yItotWnzWooT' // Your MaxMind License Key
}) 

Get Score

const score = await client.score({
    device: {
        ip_address: '127.0.0.1'
    }
});
{
    "id": "5bc5d6c2-b2c8-40af-87f4-6d61af86b6ae",
    "risk_score": 0.01,
    "funds_remaining": 25.00,
    "queries_remaining": 5000,
 
    "ip_address": {
        "risk": 0.01
    },
 
    "disposition": {
         "action": "accept",
         "reason": "default"
    },
 
    "warnings": [
        {
            "code": "INPUT_INVALID",
            "warning": "Encountered value at /shipping/city that does not meet the required constraints",
            "input_pointer": "/shipping/city"
        }
    ]
}

Get Insight

const insight = await client.insight({
    device: {
        ip_address: '127.0.0.1'
    }
});
{
    "id": "5bc5d6c2-b2c8-40af-87f4-6d61af86b6ae",
    "risk_score": 0.01,
    "funds_remaining": 25.00,
    "queries_remaining": 1666,
 
    "ip_address": {
        "risk": 0.01,
        "city":  {
            "confidence":  25,
            "geoname_id": 54321,
            "names":  {
                "de":    "Los Angeles",
                "en":    "Los Angeles",
                "es":    "Los Ángeles",
                "fr":    "Los Angeles",
                "ja":    "ロサンゼルス市",
                "pt-BR":  "Los Angeles",
                "ru":    "Лос-Анджелес",
                "zh-CN": "洛杉矶"
            }
        },
        "continent":  {
            "code":       "NA",
            "geoname_id": 123456,
            "names":  {
                "de":    "Nordamerika",
                "en":    "North America",
                "es":    "América del Norte",
                "fr":    "Amérique du Nord",
                "ja":    "北アメリカ",
                "pt-BR": "América do Norte",
                "ru":    "Северная Америка",
                "zh-CN": "北美洲"
 
            }
        },
        "country":  {
            "confidence":  75,
            "geoname_id":  6252001,
            "is_high_risk": true,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            }
        },
        "location":  {
            "accuracy_radius":   20,
            "average_income":    50321,
            "latitude":          37.6293,
            "local_time":        "2015-04-26T01:37:17-08:00",
            "longitude":         -122.1163,
            "metro_code":        807,
            "population_density":  7122,
            "time_zone":         "America/Los_Angeles"
        },
        "postal": {
            "code":       "90001",
            "confidence": 10
        },
        "registered_country":  {
            "geoname_id":  6252001,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            }
        },
        "represented_country":  {
            "geoname_id":  6252001,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            },
            "type": "military"
        },
        "subdivisions":  [
            {
                "confidence":  50,
                "geoname_id":  5332921,
                "iso_code":    "CA",
                "names":  {
                    "de":    "Kalifornien",
                    "en":    "California",
                    "es":    "California",
                    "fr":    "Californie",
                    "ja":    "カリフォルニア",
                    "ru":    "Калифорния",
                    "zh-CN": "加州"
                }
            }
        ],
        "traits": {
            "autonomous_system_number":      1239,
            "autonomous_system_organization": "Linkem IR WiMax Network",
            "domain":                        "example.com",
            "ip_address":                    "1.2.3.4",
            "is_anonymous":                  true,
            "is_anonymous_proxy":            true,
            "is_anonymous_vpn":              true,
            "is_hosting_provider":           true,
            "is_public_proxy":               true,
            "is_satellite_provider":         true,
            "is_tor_exit_node":              true,
            "isp":                           "Linkem spa",
            "organization":                  "Linkem IR WiMax Network",
            "user_type":                     "traveler"
        }
    },
 
    "credit_card": {
        "issuer": {
            "name": "Bank of America",
            "matches_provided_name": true,
            "phone_number": "800-732-9194",
            "matches_provided_phone_number": true
        },
        "brand": "Visa",
        "country": "US",
        "is_issued_in_billing_address_country": true,
        "is_prepaid": true,
        "is_virtual": true,
        "type": "credit"
    },
 
    "device": {
        "confidence": 99,
        "id": "7835b099-d385-4e5b-969e-7df26181d73b",
        "last_seen": "2016-06-08T14:16:38Z",
        "local_time": "2018-01-02T10:40:11-08:00"
    },
 
    "email": {
        "first_seen": "2016-02-03",
        "is_free": false,
        "is_high_risk": true
    },
 
    "shipping_address": {
        "is_high_risk": true,
        "is_postal_in_city": true,
        "latitude": 37.632,
        "longitude": -122.313,
        "distance_to_ip_location": 15,
        "distance_to_billing_address": 22,
        "is_in_ip_country": true
    },
 
    "billing_address": {
        "is_postal_in_city": true,
        "latitude": 37.545,
        "longitude": -122.421,
        "distance_to_ip_location": 100,
        "is_in_ip_country": true
    },
 
    "disposition": {
         "action": "accept",
         "reason": "default"
    },
 
    "warnings": [
        {
            "code": "INPUT_INVALID",
            "warning": "Encountered value at /shipping/city that does not meet the required constraints",
            "input_pointer": "/shipping/city"
        }
    ]
}

Get Factors

const factor = await client.factor({
    device: {
        ip_address: '127.0.0.1'
    }
});
{
    "id": "5bc5d6c2-b2c8-40af-87f4-6d61af86b6ae",
    "risk_score": 0.01,
    "funds_remaining": 25.00,
    "queries_remaining": 1666,
 
    "ip_address": {
        "risk": 0.01,
        "city":  {
            "confidence":  25,
            "geoname_id": 54321,
            "names":  {
                "de":    "Los Angeles",
                "en":    "Los Angeles",
                "es":    "Los Ángeles",
                "fr":    "Los Angeles",
                "ja":    "ロサンゼルス市",
                "pt-BR":  "Los Angeles",
                "ru":    "Лос-Анджелес",
                "zh-CN": "洛杉矶"
            }
        },
        "continent":  {
            "code":       "NA",
            "geoname_id": 123456,
            "names":  {
                "de":    "Nordamerika",
                "en":    "North America",
                "es":    "América del Norte",
                "fr":    "Amérique du Nord",
                "ja":    "北アメリカ",
                "pt-BR": "América do Norte",
                "ru":    "Северная Америка",
                "zh-CN": "北美洲"
 
            }
        },
        "country":  {
            "confidence":  75,
            "geoname_id":  6252001,
            "is_high_risk": true,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            }
        },
        "location":  {
            "accuracy_radius":   20,
            "average_income":    50321,
            "latitude":          37.6293,
            "local_time":        "2015-04-26T01:37:17-08:00",
            "longitude":         -122.1163,
            "metro_code":        807,
            "population_density":  7122,
            "time_zone":         "America/Los_Angeles"
        },
        "postal": {
            "code":       "90001",
            "confidence": 10
        },
        "registered_country":  {
            "geoname_id":  6252001,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            }
        },
        "represented_country":  {
            "geoname_id":  6252001,
            "is_in_european_union": true,
            "iso_code":    "US",
            "names":  {
                "de":     "USA",
                "en":     "United States",
                "es":     "Estados Unidos",
                "fr":     "États-Unis",
                "ja":     "アメリカ合衆国",
                "pt-BR":  "Estados Unidos",
                "ru":     "США",
                "zh-CN":  "美国"
            },
            "type": "military"
        },
        "subdivisions":  [
            {
                "confidence":  50,
                "geoname_id":  5332921,
                "iso_code":    "CA",
                "names":  {
                    "de":    "Kalifornien",
                    "en":    "California",
                    "es":    "California",
                    "fr":    "Californie",
                    "ja":    "カリフォルニア",
                    "ru":    "Калифорния",
                    "zh-CN": "加州"
                }
            }
        ],
        "traits": {
            "autonomous_system_number":      1239,
            "autonomous_system_organization": "Linkem IR WiMax Network",
            "domain":                        "example.com",
            "ip_address":                    "1.2.3.4",
            "is_anonymous":                  true,
            "is_anonymous_proxy":            true,
            "is_anonymous_vpn":              true,
            "is_hosting_provider":           true,
            "is_public_proxy":               true,
            "is_satellite_provider":         true,
            "is_tor_exit_node":              true,
            "isp":                           "Linkem spa",
            "organization":                  "Linkem IR WiMax Network",
            "user_type":                     "traveler"
        }
    },
 
    "credit_card": {
        "issuer": {
            "name": "Bank of America",
            "matches_provided_name": true,
            "phone_number": "800-732-9194",
            "matches_provided_phone_number": true
        },
        "brand": "Visa",
        "country": "US",
        "is_issued_in_billing_address_country": true,
        "is_prepaid": true,
        "is_virtual": true,
        "type": "credit"
    },
 
    "device": {
        "confidence": 99,
        "id": "7835b099-d385-4e5b-969e-7df26181d73b",
        "last_seen": "2016-06-08T14:16:38Z",
        "local_time": "2018-01-02T10:40:11-08:00"
    },
 
    "email": {
        "first_seen": "2016-02-03",
        "is_free": false,
        "is_high_risk": true
    },
 
    "shipping_address": {
        "is_high_risk": true,
        "is_postal_in_city": true,
        "latitude": 37.632,
        "longitude": -122.313,
        "distance_to_ip_location": 15,
        "distance_to_billing_address": 22,
        "is_in_ip_country": true
    },
 
    "billing_address": {
        "is_postal_in_city": true,
        "latitude": 37.545,
        "longitude": -122.421,
        "distance_to_ip_location": 100,
        "is_in_ip_country": true
    },
 
    "disposition": {
         "action": "accept",
         "reason": "default"
    },
 
    "subscores": {
        "avs_result": 0.01,
        "billing_address": 0.02,
        "billing_address_distance_to_ip_location": 0.03,
        "browser": 0.04,
        "chargeback": 0.05,
        "country": 0.06,
        "country_mismatch": 0.07,
        "cvv_result": 0.08,
        "email_address": 0.09,
        "email_domain": 0.10,
        "email_tenure": 0.11,
        "ip_tenure": 0.12,
        "issuer_id_number": 0.13,
        "order_amount": 0.14,
        "phone_number": 0.15,
        "shipping_address_distance_to_ip_location": 0.16,
        "time_of_day": 0.17
    },
 
    "warnings": [
        {
            "code": "INPUT_INVALID",
            "warning": "Encountered value at /shipping/city that does not meet the required constraints",
            "input_pointer": "/shipping/city"
        }
    ]
}

License

This repository is licensed under the ISC license.

Copyright (c) 2019, Jørgen Vatle.