Ed25519 private key stays server-side
Developer Doc
Use optional signed context when an answer depends on a trusted plan, role, locale, or requester. Use external evidence links only for support-safe diagnostics you already control.
Ed25519 private key stays server-side
10 minutes maximum
3 links on exact allowed HTTPS hosts
Implementation notes
AnswerLattice developer docs focus on the v1 widget contract, dashboard-owned route settings, safe browser context, and verification.
Create the key in Widget > Access & Security. AnswerLattice stores the public verification record and shows the private PKCS8 key once.
Use EdDSA with the current key ID, the `answerlattice-widget` audience, and a lifetime no longer than 600 seconds.
import { createPrivateKey, sign } from 'node:crypto';
const encode = (value: unknown) =>
Buffer.from(JSON.stringify(value)).toString('base64url');
export function createAnswerlatticeVisitorToken({
privateKeyPkcs8,
keyId,
visitor,
}: {
privateKeyPkcs8: string;
keyId: string;
visitor: { id: string; name?: string; email?: string; plan?: string; role?: string; locale?: string };
}) {
const now = Math.floor(Date.now() / 1000);
const header = encode({ alg: 'EdDSA', typ: 'JWT', kid: keyId });
const payload = encode({
aud: 'answerlattice-widget',
iat: now,
exp: now + 300,
sub: visitor.id,
name: visitor.name,
email: visitor.email,
plan: visitor.plan,
role: visitor.role,
locale: visitor.locale,
});
const input = `${header}.${payload}`;
const key = createPrivateKey({
key: Buffer.from(privateKeyPkcs8, 'base64'),
format: 'der',
type: 'pkcs8',
});
const signature = sign(null, Buffer.from(input), key).toString('base64url');
return `${input}.${signature}`;
}Configure exact evidence hosts in Access & Security, then pass links only when they are useful for the current support question.
Signed identity is optional and must never become a support availability dependency.
const { token } = await fetch('/api/my-answerlattice-token', {
credentials: 'same-origin',
cache: 'no-store',
}).then((response) => response.json());
window.AnswerlatticeWidget?.identifySigned?.(token);
window.AnswerlatticeWidget?.setEvidenceLinks?.([
{ label: 'Error details', url: 'https://errors.example.com/event/abc123' },
]);
// Run when the host user signs out or changes account.
window.AnswerlatticeWidget?.clearIdentity?.();