@@ -35,11 +35,10 @@ export interface RelayConfig extends ConsoleConfig, StorageConfig {
3535 readonly name ?: SimpleName ;
3636
3737 /**
38- * Optional callback to check if an {@link OwnerId} is allowed to access the
39- * relay. If this callback is not provided, all owners are allowed.
38+ * Callback to check if an {@link OwnerId} is allowed to access the relay.
4039 *
41- * If provided, the callback receives the OwnerId and should return a
42- * { @link MaybeAsync} boolean: `true` to allow access, or `false` to deny.
40+ * The callback receives the OwnerId and returns a { @link MaybeAsync} boolean:
41+ * `true` to allow access, or `false` to deny.
4342 *
4443 * The callback can be synchronous (for SQLite or in-memory checks) or
4544 * asynchronous (for calling remote APIs).
@@ -76,7 +75,7 @@ export interface RelayConfig extends ConsoleConfig, StorageConfig {
7675 * Promise.resolve(ownerId === "6jy_2F4RT5qqeLgJ14_dnQ"),
7776 * ```
7877 */
79- readonly isOwnerAllowed ? : ( ownerId : OwnerId ) => MaybeAsync < boolean > ;
78+ readonly isOwnerAllowed : ( ownerId : OwnerId ) => MaybeAsync < boolean > ;
8079}
8180
8281/**
@@ -211,17 +210,15 @@ export const createRelaySqliteStorage =
211210 storedBytes + incomingBytes ,
212211 ) ;
213212
214- if ( config . isOwnerWithinQuota ) {
215- const withinQuotaResult = config . isOwnerWithinQuota (
216- ownerId ,
217- newStoredBytes ,
218- ) ;
219- const isWithinQuota = isAsync ( withinQuotaResult )
220- ? await withinQuotaResult
221- : withinQuotaResult ;
222- if ( ! isWithinQuota ) {
223- return err ( { type : "StorageQuotaError" , ownerId } ) ;
224- }
213+ const withinQuotaResult = config . isOwnerWithinQuota (
214+ ownerId ,
215+ newStoredBytes ,
216+ ) ;
217+ const isWithinQuota = isAsync ( withinQuotaResult )
218+ ? await withinQuotaResult
219+ : withinQuotaResult ;
220+ if ( ! isWithinQuota ) {
221+ return err ( { type : "StorageQuotaError" , ownerId } ) ;
225222 }
226223
227224 return deps . sqlite . transaction ( ( ) => {
0 commit comments