API reference / @evolu/common / Evolu/Internal / RelayConfig

Interface: RelayConfig

Defined in: packages/common/src/Evolu/Relay.ts:21

Extends

Extended by

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
authenticateOwner?readonly(ownerId) => Promise<boolean>Optional callback to authenticate an OwnerId with the relay. If this callback is not provided, all owners are allowed. If provided, the callback receives the OwnerId and should return a promise that resolves to true to allow access, or false to deny. The callback returns a boolean rather than an error type because error handling and logging are the responsibility of the callback implementation, not the relay. This prevents leaking authentication implementation details into the generic relay interface. OwnerId is used for authentication rather than short-lived tokens because this only controls relay access, not write permissions. Since all data is encrypted on the relay, OwnerId exposure is safe. Owners specify which relays to connect to via TransportConfig. In WebSocket-based implementations, this check occurs before accepting the connection, with the OwnerId typically extracted from the URL path (e.g., ws://localhost:4000/<ownerId>). ### Example const relay = await createNodeJsRelay(deps)({ authenticateOwner: async (ownerId) => { const isRegistered = await db.checkOwner(ownerId); if (!isRegistered) { logger.warn("Unauthorized access attempt", { ownerId }); } return isRegistered; }, });-packages/common/src/Evolu/Relay.ts:66
enableLogging?readonlybooleanEnable or disable console logging (default: false). When true, logs are output to the Console; when false, logging is disabled for all methods except error, which always outputs to ensure critical issues are not missed.ConsoleConfig.enableLoggingpackages/common/src/Console.ts:105
name?readonlystring & Brand<"UrlSafeString"> & Brand<"SimpleName">The relay name. Implementations can use this for identification purposes (e.g., database file name, logging).-packages/common/src/Evolu/Relay.ts:28

Was this page helpful?