Conversation
Changed the default database path in both install.sh and config to use a shared location with the pinning service (../data/pinning.db). The install script now prompts for the shared database path, ensures the directory exists, and updates related output and environment variable handling to reflect the new shared setup.
Changed default install and data directories in install.sh and update.sh from /opt paths to /home/root/pinning-service paths. Updated prompts and documentation to reflect new defaults, and removed redundant data directory creation in update.sh.
Introduces a system key mechanism for authenticating requests from the x402 gateway by checking the 'X-System-Key' header. The manual credit adjustment endpoint now accepts either admin session or system key authentication, and audit logs reflect the caller type. Configuration and logging are updated to support the new system key.
| * Basic health check endpoint. | ||
| */ | ||
| healthRoutes.get('/', (c) => { | ||
| let dbStatus: 'connected' | 'disconnected' = 'disconnected'; |
| * Detailed health check with stats. | ||
| */ | ||
| healthRoutes.get('/detailed', (c) => { | ||
| let dbStatus: 'connected' | 'disconnected' = 'disconnected'; |
| import { adjustPinningCredits } from '../services/pinningIntegration.js'; | ||
| import { trackEphemeralObject } from '../database/repositories/ephemeralObjects.js'; | ||
| import { HttpError } from '../middleware/errorHandler.js'; | ||
| import { config } from '../config/index.js'; |
| const contentType = c.req.header('Content-Type') || 'application/octet-stream'; | ||
|
|
||
| const payment = getPaymentInfo(c); | ||
| const jwtUser = getJwtUser(c); |
| /** | ||
| * Decode base64 header to object | ||
| */ | ||
| function decodeHeader<T>(base64: string): T { |
| * Tests pricing calculations and USDC conversions. | ||
| */ | ||
|
|
||
| import { describe, it, expect, vi, beforeAll } from 'vitest'; |
Comment on lines
+14
to
+22
| import { | ||
| createMockPaymentHeader, | ||
| createMockVerifyResponse, | ||
| createMockSettleResponse, | ||
| createMockJwt, | ||
| DEFAULT_MOCK_PAYMENT, | ||
| encodeBase64, | ||
| decodeBase64, | ||
| } from '../mocks/facilitator.js'; |
Comment on lines
+13
to
+20
| import { | ||
| createMockPaymentHeader, | ||
| createMockVerifyResponse, | ||
| createMockSettleResponse, | ||
| DEFAULT_MOCK_PAYMENT, | ||
| encodeBase64, | ||
| decodeBase64, | ||
| } from '../mocks/facilitator.js'; |
| it('should detect X-PAYMENT header', () => { | ||
| // Note: This tests the helper function directly | ||
| // In real usage, it's called within middleware context | ||
| const mockContext = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added x402 endpoints