UNPKG

@voidkey/broker-core

Version:

Core credential minting logic for the voidkey zero-trust credential broker

50 lines 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HelloWorldProvider = void 0; const base_1 = require("./base"); class HelloWorldProvider extends base_1.IdpProvider { constructor() { const config = { name: 'hello-world', issuer: 'hello-world-idp', audience: 'hello-world-audience', jwksUri: 'dummy://hello-world/jwks', algorithms: ['HS256'] }; super(config); } async validateToken(token) { // Hello World provider bypasses all external validation // It accepts any token and returns mock claims for testing console.log('🎭 Hello World IdP: Bypassing external validation'); console.log(`📝 Received token: ${token.substring(0, 20)}...`); // Check for the specific hello-world token format if (token === 'cli-hello-world-token') { console.log('✨ Recognized CLI hello-world token'); } else { console.log('✨ Processing custom token in hello-world mode'); } // Return mock claims without any validation const mockClaims = { sub: 'hello-world-user', iss: 'hello-world-idp', aud: 'hello-world-audience', exp: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now iat: Math.floor(Date.now() / 1000), email: 'hello@world.dev', name: 'Hello World User', preferred_username: 'hello-world', custom_claim: 'This is a test token from hello-world IdP' }; console.log('🎉 Hello World IdP validation successful'); return mockClaims; } async healthCheck() { // Hello World provider is always healthy since it doesn't depend on external services console.log('💚 Hello World IdP health check: Always healthy'); return true; } } exports.HelloWorldProvider = HelloWorldProvider; //# sourceMappingURL=hello-world.js.map