(
domain: string,
agentUrl: string,
scope?: AuthorizationScope
)
| 38 | } |
| 39 | |
| 40 | async validate( |
| 41 | domain: string, |
| 42 | agentUrl: string, |
| 43 | scope?: AuthorizationScope |
| 44 | ): Promise<AuthorizationResult> { |
| 45 | const normalizedDomain = this.normalizeDomain(domain); |
| 46 | const normalizedAgentUrl = this.normalizeUrl(agentUrl); |
| 47 | const normalizedScope = this.normalizeScope(scope); |
| 48 | const cacheKey = JSON.stringify({ |
| 49 | domain: normalizedDomain, |
| 50 | agent_url: normalizedAgentUrl, |
| 51 | scope: normalizedScope, |
| 52 | }); |
| 53 | const cached = this.cache.get(cacheKey); |
| 54 | if (cached) { |
| 55 | return cached; |
| 56 | } |
| 57 | |
| 58 | const result = await this.fetchAndValidate( |
| 59 | normalizedDomain, |
| 60 | agentUrl, |
| 61 | normalizedAgentUrl, |
| 62 | normalizedScope |
| 63 | ); |
| 64 | this.cache.set(cacheKey, result); |
| 65 | return result; |
| 66 | } |
| 67 | |
| 68 | private async fetchAndValidate( |
| 69 | normalizedDomain: string, |
no test coverage detected