Function: deriveKeyId()
function deriveKeyId(hexKey): Promise<string>;
Defined in: packages/client/src/core/crypto-engine/utils.ts:97
Derives the stable identifier of a document key.
A truncated SHA-256 of the key's bytes: deterministic, so two devices handed the same key arrive at the same identifier without talking to each other, and one-way, so publishing it in every stored payload discloses nothing about the key itself. Eight bytes is far more than needed to tell apart the handful of keys a database sees across its re-keyings, and short enough to sit on every encrypted field without weighing it down.
Parameters
| Parameter | Type | Description |
|---|---|---|
hexKey | string | The hex-encoded document key. |
Returns
Promise<string>
A 16-character hex identifier.
Example
const kid = await deriveKeyId(documentKey); // e.g. "9f2c1ab30e77d541"