انتقل إلى المحتوى الرئيسي

Function: inboxPrefix()

inboxPrefix(principal): string

Defined in: packages/contracts/src/permissions/inbox.ts:23

The inbox prefix one principal receives its replies on: _INBOX.<principal>.

The generator grants each principal subscribe on this prefix and nothing wider, and connectNats sets the same value as the client's inboxPrefix. Both read it from here, so the broker's grant and the client's reply subjects cannot drift apart. The point is that one principal cannot read another's replies: the gateway's principal.resolve replies carry a person's grants, and under a shared _INBOX.> every principal on the broker could read them.

A principal name is a plain token (the registry check enforces it), so it never contains a dot or a wildcard and two principals' prefixes never overlap.

Parameters​

principal​

string

A broker principal, such as gateway or credential.

Returns​

string

The prefix, without a trailing wildcard.