Docs / built-apps / dmPairKey

dmPairKey

utilitysince 0.2.2

Pure helper: deterministic, order-independent thread key for a pair of user keys.

import { dmPairKey } from 'flowstack-sdk'

Computes the deterministic pair_key for two user keys by sorting them and joining with ::. Mirrors the backend's thread-key derivation, so dmPairKey(a, b) === dmPairKey(b, a). Pure — no credentials, no network. Useful for locally matching a thread to a counterpart.

Signature

dmPairKey(a: string, b: string): string

Parameters

ParamTypeNotesDescription
astringrequired, since 0.2.2One user key.
bstringrequired, since 0.2.2The other user key.

Returns

FieldTypeDescription
stringThe sorted, ::-joined pair key (order-independent).

Examples

Derive a thread key
dmPairKey('userA', 'userB'); // 'userA::userB'
dmPairKey('userB', 'userA'); // 'userA::userB' (same)

See also

openThread · useThreads · DmThread

Source: README.md#private-messaging-dms · Also available in llms-full.txt and registry.json.