import { MCPAuth } from 'mcp-auth';
import { config } from './src/config.js';

const serverConfig = {
  issuer: config.apiBaseUrl,
  authorization_endpoint: `${config.apiBaseUrl}/oauth/authorize`,
  token_endpoint: `${config.apiBaseUrl}/oauth/token`,
  jwks_uri: `${config.apiBaseUrl}/oauth/keys`,
  scopes_supported: ["openid", "profile", "proofs:create", "proofs:read", "proofs:share", "profile:read"],
  response_types_supported: ["code"],
  grant_types_supported: ["authorization_code", "refresh_token"],
  token_endpoint_auth_methods_supported: ["client_secret_basic", "client_secret_post"],
};

try {
  new MCPAuth({ server: serverConfig as any });
  console.log("Validation passed!");
} catch (error: any) {
  console.error("Validation failed!");
  if (error.cause && error.cause.errors) {
    console.dir(error.cause.errors, { depth: null });
  } else {
    console.error(error);
  }
}
