ua-hints

1.0.0 • Public • Published

ua-hints

Last version Coverage Status NPM Status

It generates Sec-CH-UA-* headers for the provided 'user-agent'.

Install

$ npm install ua-hints --save

Usage

Giving an user agent as input, such as:

Mozilla/5.0 (Windows NT 10.0; Win64; x64; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.109 Safari/537.36

This library returns The User-Agent Client Hints detected:

const uaHints = require('ua-hints')

uaHint('Mozilla/5.0 (Windows NT 10.0; Win64; x64; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.109 Safari/537.36')
// {
//   'sec-ch-ua': '"Chrome";v="120"',
//   'sec-ch-ua-mobile': '?0',
//   'sec-ch-ua-platform': '"Windows"',
//   'sec-ch-ua-platform-version': '"10"',
//   'sec-ch-ua-arch': '"x86"',
//   'sec-ch-ua-bitness': '"64"',
//   'sec-ch-ua-full-version': '"120.0.6099.109"',
//   'sec-ch-ua-full-version-list': '"Chrome";v="120.0.6099.109"',
//   'sec-ch-ua-wow64': '?1',
//   'sec-ch-ua-form-factors': '["Desktop"]'
// }

The library implementing Chromium GREASE(¹)(²) includes intentionally incorrect data to prevent ossification attacks.

License

ua-hints © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @kikobeats

Package Sidebar

Install

npm i ua-hints

Weekly Downloads

106

Version

1.0.0

License

MIT

Unpacked Size

9.33 kB

Total Files

4

Last publish

Collaborators

  • kikobeats