← Files FingerprintARCHIVED FILE
skills/fingerprint-tagging/snippets/read-tag.js
888 Bytes · Oct 2, 2026 · 00:25 UTC
// Server — verify the event first, then read back the tag/linkedId you set on the client.
// Only trust the tag after the event itself verifies (see fingerprint-node verifyEvent).
const { fingerprint } = require('./client')
async function readTaggedEvent(eventId) {
const event = await fingerprint.getEvent(eventId)
if (!event.identification?.visitor_id) return { ok: false, reason: 'not_found' }
const tag = event.tags ?? {} // the JSON you passed to getData({ tag }) — server field is `tags`
const linkedId = event.linked_id ?? null // the string you passed to getData({ linkedId })
// Example: confirm the order the client claims matches the tagged order.
// if (tag.orderId !== expectedOrderId) return { ok: false, reason: 'order_mismatch' }
return { ok: true, visitorId: event.identification.visitor_id, tag, linkedId }
}
module.exports = { readTaggedEvent }
SHA-256: 81fab325afa37cb0d43086bdd90b334273b656584de3b21720476cad58767008