Skip to content

sumsub/agent-skills / skills/sumsub-integrate-dint-standalone

sumsub-integrate-dint-standalone

Verified

Add Sumsub Device Intelligence (the Fisherman JS module) to your own web pages where there is NO Sumsub verification widget — login, signup, password reset, 2FA, checkout, or any high-value action you want fraud-screened. TRIGGER when the user asks to "add device intelligence to login / signup", "fingerprint the device on a custom page", "use Fisherman standalone / self-hosted", "ongoing monitoring of platform events", "pre-KYC device check", "detect multi-accounting at signup", or "send a financial transaction with the captured device". Covers the whole loop — behavior access token, @sumsub/fisherman init + fingerprint, confirming the event (platform event / financial transaction / create-applicant), reading results, sandbox, go-live. SKIP when the page already embeds the Sumsub WebSDK — Device Intelligence rides along inside it, use `sumsub-integrate-dint-websdk`.

FileKindSize
README.mdmarkdown4.8 KB
SKILL.mdskill md16.6 KB
examples/behavior-token.shscript2.1 KB
examples/fisherman-react.tsxother2.6 KB
examples/fisherman-vanilla.htmlother2.4 KB
examples/submit-platform-event.shscript3.7 KB
references/standalone-flow.mdmarkdown3.9 KB
scripts/preflight.shexecutablescript7.0 KB

examples/fisherman-react.tsx

View on GitHub
/**
 * Standalone Device Intelligence as a React hook.
 *
 * Pattern mirrors a production self-hosted integration: init on mount, expose a
 * capture() the form calls on submit, destroy on unmount. DI is best-effort —
 * every path fails open so a Fisherman error never blocks the real action.
 */
import { useCallback, useEffect, useRef } from 'react'
import { init, destroy, type Fisherman } from '@sumsub/fisherman'

async function getBehaviorToken(): Promise<string> {
  const r = await fetch('/api/di/token', { method: 'POST' })
  if (!r.ok) throw new Error('token mint failed')
  // Your /api/di/token forwards Sumsub's behavior-token response, whose JWT is the
  // `token` field (see behavior-token.sh) — not `accessToken`.
  return (await r.json()).token
}

export function useDeviceIntelligence() {
  const fishermanRef = useRef<Fisherman | undefined>(undefined)

  useEffect(() => {
    let cancelled = false
    ;(async () => {
      try {
        const f = await init({
          token: await getBehaviorToken(),
          baseUrl: 'https://api.sumsub.com',
          accessTokenUpdateHandler: getBehaviorToken,
          // destroy() is module-global, not instance-scoped — without the
          // cancelled guard, a stale handler from an unmounted init (React
          // StrictMode double-mount) would kill the live session.
          onError: () => {
            if (!cancelled) destroy()
          },
        })
        if (!cancelled) {
          fishermanRef.current = f
        }
      } catch (e) {
        console.error('fisherman init failed (continuing without DI)', e)
      }
    })()

    return () => {
      cancelled = true
      destroy()
      fishermanRef.current = undefined
    }
  }, [])

  /** Call on the user action. Captures device signals; fails open. */
  const capture = useCallback(async (): Promise<void> => {
    const f = fishermanRef.current
    if (!f?.isDeviceIntelligenceEnabled) return
    try {
      await f.fingerprint({})
      // Migration path only: generate a deviceBindingId, pass it to
      // fingerprint({ deviceBindingId }), return it, and forward it to the
      // backend so the confirm call can echo it. Default flow: omit entirely —
      // the behavior token's sessionId handles correlation.
    } catch (e) {
      console.error('fingerprint failed (continuing)', e) // fail open
    }
  }, [])

  return { capture }
}

// Usage:
//   const { capture } = useDeviceIntelligence()
//   async function onSubmit() {
//     await capture()
//     await fetch('/api/login', { method: 'POST', body: JSON.stringify({ /* email, password */ }) })
//   }
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall