Cotal TypeScript packages
    Preparing search index...

    Function deriveOwnerToken

    • Derive the opaque per-space owner token for an authenticated IdP subject.

      spaceSecret is the space's owner-derivation secret (≥32 bytes, operator-held, never on the wire); externalSubject is the IdP-authenticated stable subject (e.g. Better Auth sub) — ALREADY VERIFIED by the caller (this function derives, it does not authenticate). Truncation to 128 bits keeps the token subject-sized while leaving collision odds negligible for any realistic owner population (birthday bound 2^64). Fails loud on weak/empty inputs.

      Parameters

      • spaceSecret: string | Uint8Array<ArrayBufferLike>
      • externalSubject: string

      Returns string