diff --git a/packages/filecoin-api/src/aggregator/service.js b/packages/filecoin-api/src/aggregator/service.js index f8fa04986..6f2298371 100644 --- a/packages/filecoin-api/src/aggregator/service.js +++ b/packages/filecoin-api/src/aggregator/service.js @@ -135,6 +135,7 @@ export const createServer = (context) => codec: context.codec || CAR.inbound, service: createService(context), catch: (error) => context.errorReporter.catch(error), + validateAuthorization: (auth) => context.validateAuthorization(auth), }) /** diff --git a/packages/filecoin-api/src/deal-tracker/service.js b/packages/filecoin-api/src/deal-tracker/service.js index 4507d2ad5..9d78ab351 100644 --- a/packages/filecoin-api/src/deal-tracker/service.js +++ b/packages/filecoin-api/src/deal-tracker/service.js @@ -61,6 +61,7 @@ export const createServer = (context) => codec: context.codec || CAR.inbound, service: createService(context), catch: (error) => context.errorReporter.catch(error), + validateAuthorization: (auth) => context.validateAuthorization(auth), }) /** diff --git a/packages/filecoin-api/src/dealer/service.js b/packages/filecoin-api/src/dealer/service.js index 56e4debc1..8dc05e8da 100644 --- a/packages/filecoin-api/src/dealer/service.js +++ b/packages/filecoin-api/src/dealer/service.js @@ -171,6 +171,7 @@ export const createServer = (context) => codec: context.codec || CAR.inbound, service: createService(context), catch: (error) => context.errorReporter.catch(error), + validateAuthorization: (auth) => context.validateAuthorization(auth), }) /** diff --git a/packages/filecoin-api/src/storefront/service.js b/packages/filecoin-api/src/storefront/service.js index 39f4dfaad..3dd1b9210 100644 --- a/packages/filecoin-api/src/storefront/service.js +++ b/packages/filecoin-api/src/storefront/service.js @@ -274,6 +274,7 @@ export const createServer = (context) => codec: context.codec || CAR.inbound, service: createService(context), catch: (error) => context.errorReporter.catch(error), + validateAuthorization: (auth) => context.validateAuthorization(auth), }) /** diff --git a/packages/filecoin-api/test/aggregator.spec.js b/packages/filecoin-api/test/aggregator.spec.js index 00db93a44..f0125c629 100644 --- a/packages/filecoin-api/test/aggregator.spec.js +++ b/packages/filecoin-api/test/aggregator.spec.js @@ -8,6 +8,7 @@ import * as AggregatorEvents from './events/aggregator.js' import { getStoreImplementations } from './context/store-implementations.js' import { Queue } from './context/queue.js' import { getMockService, getConnection } from './context/service.js' +import { validateAuthorization } from './utils.js' describe('Aggregator', () => { describe('piece/*', () => { @@ -63,6 +64,7 @@ describe('Aggregator', () => { pieceAcceptQueue, aggregateOfferQueue, queuedMessages, + validateAuthorization } ) }) @@ -145,6 +147,7 @@ describe('Aggregator', () => { minAggregateSize: 2 ** 34, minUtilizationFactor: 4, }, + validateAuthorization } ) }) diff --git a/packages/filecoin-api/test/context/service.js b/packages/filecoin-api/test/context/service.js index 2a61e0860..5888e0a66 100644 --- a/packages/filecoin-api/test/context/service.js +++ b/packages/filecoin-api/test/context/service.js @@ -10,6 +10,7 @@ import * as DealTrackerCaps from '@web3-storage/capabilities/filecoin/deal-track // eslint-disable-next-line no-unused-vars import * as API from '../../src/types.js' +import { validateAuthorization } from '../utils.js' import { mockService } from './mocks.js' export function getMockService() { @@ -220,6 +221,7 @@ export function getConnection(id, service) { id: id, service, codec: CAR.inbound, + validateAuthorization }) const connection = Client.connect({ id: id, diff --git a/packages/filecoin-api/test/deal-tracker.spec.js b/packages/filecoin-api/test/deal-tracker.spec.js index 57748c70d..13fec97bf 100644 --- a/packages/filecoin-api/test/deal-tracker.spec.js +++ b/packages/filecoin-api/test/deal-tracker.spec.js @@ -5,6 +5,7 @@ import * as Signer from '@ucanto/principal/ed25519' import * as DealTrackerService from './services/deal-tracker.js' import { getStoreImplementations } from './context/store-implementations.js' +import { validateAuthorization } from './utils.js' /** * @typedef {import('../src/deal-tracker/api.js').DealRecord} DealRecord @@ -43,6 +44,7 @@ describe('deal-tracker', () => { assert.fail(error) }, }, + validateAuthorization } ) }) diff --git a/packages/filecoin-api/test/dealer.spec.js b/packages/filecoin-api/test/dealer.spec.js index 66f2dc913..f40b93fc4 100644 --- a/packages/filecoin-api/test/dealer.spec.js +++ b/packages/filecoin-api/test/dealer.spec.js @@ -7,6 +7,7 @@ import * as DealerEvents from './events/dealer.js' import { getStoreImplementations } from './context/store-implementations.js' import { getMockService, getConnection } from './context/service.js' +import { validateAuthorization } from './utils.js' describe('Dealer', () => { describe('aggregate/*', () => { @@ -43,6 +44,7 @@ describe('Dealer', () => { aggregateStore, offerStore, queuedMessages, + validateAuthorization } ) }) @@ -107,6 +109,7 @@ describe('Dealer', () => { }, }, service, + validateAuthorization } ) }) diff --git a/packages/filecoin-api/test/storefront.spec.js b/packages/filecoin-api/test/storefront.spec.js index 64924e9d1..b5a29611b 100644 --- a/packages/filecoin-api/test/storefront.spec.js +++ b/packages/filecoin-api/test/storefront.spec.js @@ -8,6 +8,7 @@ import * as StorefrontEvents from './events/storefront.js' import { getStoreImplementations } from './context/store-implementations.js' import { Queue } from './context/queue.js' import { getMockService, getConnection } from './context/service.js' +import { validateAuthorization } from './utils.js' describe('storefront', () => { describe('filecoin/*', () => { @@ -65,6 +66,7 @@ describe('storefront', () => { taskStore, receiptStore, queuedMessages, + validateAuthorization } ) }) @@ -133,6 +135,7 @@ describe('storefront', () => { assert.fail(error) }, }, + validateAuthorization } ) }) diff --git a/packages/filecoin-api/test/utils.js b/packages/filecoin-api/test/utils.js index 577a7bb93..d1599b43f 100644 --- a/packages/filecoin-api/test/utils.js +++ b/packages/filecoin-api/test/utils.js @@ -89,3 +89,5 @@ export async function randomAggregate(length, size) { aggregate: aggregateBuild, } } + +export const validateAuthorization = () => ({ ok: {} })