@darkmeter/browser
v0.1.0
Published
Darkmeter browser SDK: collects device signals and returns a signed, single-use device token.
Maintainers
Readme
@darkmeter/browser
Collects browser signals with open-source FingerprintJS 5.3.0 (MIT, monitoring: false) and exchanges them for a signed, single-use device token (valid 10 minutes).
import { getDeviceToken } from '@darkmeter/browser'
const deviceToken = await getDeviceToken({
publishableKey: 'dm_pk_...', // safe in page code; restricted to your origins
apiUrl: 'https://api.darkmeter.in',
})
// Send deviceToken to your own backend with the signup/login request;
// your backend passes it to Darkmeter's POST /v1/check.Flow: POST /v1/collect/nonce (nonce bound to the key, 60 s, single use) and signal collection run in parallel, then POST /v1/collect returns the token. Requests never send cookies (credentials: 'omit'). Matching happens on Darkmeter's servers; the browser is treated as untrusted. Failures throw DarkmeterError (status, code; status 0, code network when no answer came). Docs: https://docs.darkmeter.in/sdks/browser
Layout
src/options.ts (settings) · src/signals.ts (FingerprintJS components) · src/transport.ts (JSON POST, errors) · src/device_token.ts (nonce → collect) · src/index.ts (exports)
Develop (PowerShell)
npm install; npm run typecheck; npm test; npm run build