[{"data":1,"prerenderedAt":116},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fidentity":3,"docs-navigation":75},{"id":4,"title":5,"body":6,"description":16,"extension":68,"meta":69,"navigation":70,"path":71,"seo":72,"stem":73,"__hash__":74},"docs\u002Fdocs\u002Fidentity.md","Verify user identity",{"type":7,"value":8,"toc":63},"minimark",[9,13,17,22,25,36,39,43,50,56],[10,11,5],"h1",{"id":12},"verify-user-identity",[14,15,16],"p",{},"Turn on Identity verification in an environment's settings when flags are targeted at signed-in users. In SDK keys, issue an identity secret for the browser client key. Copy it to your backend's secret store when the panel displays it.",[18,19,21],"h2",{"id":20},"sign-on-the-backend","Sign on the backend",[14,23,24],{},"Sign the user ID from the authenticated session. Return the ID and its signature to your frontend. The signing secret stays on the backend.",[26,27,33],"pre",{"className":28,"code":30,"language":31,"meta":32},[29],"language-ts","import { signIdentity } from '@dipswitch\u002Fsdk-node'\n\nexport function browserIdentity(authenticatedUserId: string) {\n  const secret = process.env.DIPSWITCH_IDENTITY_SECRET\n  if (!secret) throw new Error('Set DIPSWITCH_IDENTITY_SECRET')\n  return { id: authenticatedUserId, signature: signIdentity(authenticatedUserId, secret) }\n}\n","ts","",[34,35,30],"code",{"__ignoreMap":32},[14,37,38],{},"The signature is the hexadecimal HMAC-SHA256 of the UTF-8 user ID. Use the full identity secret as a UTF-8 string if your backend signs in another language.",[18,40,42],{"id":41},"pass-the-signature-to-the-browser-sdk","Pass the signature to the browser SDK",[14,44,45,46,49],{},"JavaScript, Vue and React take the proof in the ",[34,47,48],{},"signature"," option. Pass a fresh proof with each new signed-in user. Sign-out still reads anonymous flags.",[26,51,54],{"className":52,"code":53,"language":31,"meta":32},[29],"import { createClient } from '@dipswitch\u002Fsdk-js'\n\ntype Identity = { id: string; signature: string }\n\nexport function start(clientKey: string, first: Identity) {\n  const flags = createClient({ clientKey, user: { id: first.id }, signature: first.signature })\n  return {\n    flags,\n    identify: (next: Identity) => flags.identify({ id: next.id }, next.signature),\n    signOut: () => flags.identify(undefined),\n  }\n}\n",[34,55,53],{"__ignoreMap":32},[14,57,58,59,62],{},"Missing or rejected proofs use your flag defaults. When you replace an identity secret, issue new signatures from the backend for that key. Server keys and anonymous evaluations can continue without a signature. For OFREP, send the signature in ",[34,60,61],{},"X-Dipswitch-Signature"," with the public client key.",{"title":32,"searchDepth":64,"depth":64,"links":65},2,[66,67],{"id":20,"depth":64,"text":21},{"id":41,"depth":64,"text":42},"md",{},true,"\u002Fdocs\u002Fidentity",{"title":5,"description":16},"docs\u002Fidentity","LK2xVUz6CEPZUREFQ7TmrbkCdgSx5bgXWXXUGRuor6w",[76,79,82,83,86,89,92,95,98,101,104,107,110,113],{"path":77,"title":78},"\u002Fdocs","Dipswitch documentation",{"path":80,"title":81},"\u002Fdocs\u002Fdotnet",".NET quickstart",{"path":71,"title":5},{"path":84,"title":85},"\u002Fdocs\u002Fjava","Java quickstart",{"path":87,"title":88},"\u002Fdocs\u002Fjavascript","JavaScript quickstart",{"path":90,"title":91},"\u002Fdocs\u002Flaunchdarkly","Migrate from LaunchDarkly",{"path":93,"title":94},"\u002Fdocs\u002Fmanagement-api","Management API",{"path":96,"title":97},"\u002Fdocs\u002Fnode","Node.js quickstart",{"path":99,"title":100},"\u002Fdocs\u002Fopenfeature","OpenFeature and OFREP",{"path":102,"title":103},"\u002Fdocs\u002Fphp","PHP quickstart",{"path":105,"title":106},"\u002Fdocs\u002Fplans","Plans and limits",{"path":108,"title":109},"\u002Fdocs\u002Frate-limits","Rate limits",{"path":111,"title":112},"\u002Fdocs\u002Freact","React quickstart",{"path":114,"title":115},"\u002Fdocs\u002Fvue","Vue quickstart",1795767833782]