A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
refactor: verify domain connections in the unfurl service
Hampusa12b41bb614b
diff --git a/fluxer_api/src/api/connection/ConnectionService.ts b/fluxer_api/src/api/connection/ConnectionService.tsindex 44fbb2a04..97d8e879f 100644--- a/fluxer_api/src/api/connection/ConnectionService.ts+++ b/fluxer_api/src/api/connection/ConnectionService.ts@@ -17,9 +17,9 @@ import {ConnectionInvalidTypeError} from '@app/api/connection/errors/ConnectionIimport {ConnectionLimitReachedError} from '@app/api/connection/errors/ConnectionLimitReachedError';import {ConnectionNotFoundError} from '@app/api/connection/errors/ConnectionNotFoundError';import {ConnectionVerificationFailedError} from '@app/api/connection/errors/ConnectionVerificationFailedError';-import {DomainConnectionVerifier} from '@app/api/connection/verification/DomainConnectionVerifier';import type {RevisionedUserConnectionRow, UserConnectionRow} from '@app/api/database/types/ConnectionTypes';import type {IGatewayService} from '@app/api/infrastructure/IGatewayService';+import type {IUnfurlerService} from '@app/api/infrastructure/IUnfurlerService';import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';import {type ConnectionType,@@ -35,6 +35,7 @@ export class ConnectionService {constructor(private readonly repository: ConnectionRepository,private readonly gateway: IGatewayService,+ private readonly unfurler: IUnfurlerService,) {}async getConnectionsForUser(userId: UserID): Promise<Array<UserConnectionRow>> {@@ -135,7 +136,7 @@ export class ConnectionService {visibilityFlags: number,): Promise<UserConnectionRow> {await this.requireConnectionCreationAllowed(userId, type, identifier);- const isValid = await new DomainConnectionVerifier().verify({identifier, verification_token: verificationCode});+ const isValid = await this.unfurler.verifyDomain(identifier, verificationCode);if (!isValid) {throw new ConnectionVerificationFailedError();}diff --git a/fluxer_api/src/api/connection/tests/ConnectionLimit.test.ts b/fluxer_api/src/api/connection/tests/ConnectionLimit.test.tsindex c3c7eca5b..67ac33fba 100644--- a/fluxer_api/src/api/connection/tests/ConnectionLimit.test.ts+++ b/fluxer_api/src/api/connection/tests/ConnectionLimit.test.ts@@ -7,6 +7,7 @@ import {ConnectionLimitReachedError} from '@app/api/connection/errors/Connectionimport {setCassandraQueryExecutorForTesting} from '@app/api/database/CassandraQueryExecution';import type {UserConnectionRow} from '@app/api/database/types/ConnectionTypes';import {InMemoryCassandraQueryExecutor} from '@app/api/test/InMemoryCassandraQueryExecutor';+import {NoopUnfurlerService} from '@app/api/test/mocks/NoopUnfurlerService';import {NoopGatewayService} from '@app/api/test/NoopGatewayService';import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';import {@@ -53,7 +54,7 @@ describe('ConnectionService connection limit', () => {for (let index = 0; index < MAX_CONNECTIONS_PER_USER; index++) {await repository.create(connectionRow(userId, `connection-${index}`, index));}- const service = new ConnectionService(repository, new NoopGatewayService());+ const service = new ConnectionService(repository, new NoopGatewayService(), new NoopUnfurlerService());const error = await service.initiateConnection(userId, ConnectionTypes.DOMAIN, 'over-the-limit.example').then(() => null,@@ -73,7 +74,7 @@ describe('ConnectionService connection limit', () => {for (let index = 0; index < MAX_CONNECTIONS_PER_USER - 1; index++) {await repository.create(connectionRow(userId, `connection-${index}`, index));}- const service = new ConnectionService(repository, new NoopGatewayService());+ const service = new ConnectionService(repository, new NoopGatewayService(), new NoopUnfurlerService());await expect(service.initiateConnection(userId, ConnectionTypes.DOMAIN, 'under-the-limit.example'),diff --git a/fluxer_api/src/api/connection/verification/DomainConnectionVerifier.ts b/fluxer_api/src/api/connection/verification/DomainConnectionVerifier.tsdeleted file mode 100644index e6bc2ee97..000000000--- a/fluxer_api/src/api/connection/verification/DomainConnectionVerifier.ts+++ /dev/null@@ -1,132 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {Resolver} from 'node:dns/promises';-import type {- ConnectionVerificationParams,- IConnectionVerifier,-} from '@app/api/connection/verification/IConnectionVerifier';-import {Logger} from '@app/api/Logger';-import {EXTERNAL_RESPONSE_LIMITS} from '@app/api/utils/ExternalResponseLimits';-import * as FetchUtils from '@app/api/utils/FetchUtils';-import {isFqdnHostname} from '@fluxer/schema/src/primitives/UrlValidators';--const VERIFICATION_TIMEOUT_MS = 5000;-const DNS_VERIFICATION_TIMEOUT_MS = 2000;-const DOMAIN_VERIFICATION_DNS_SERVERS = [- '1.1.1.1',- '1.0.0.1',- '8.8.8.8',- '8.8.4.4',- '9.9.9.9',- '149.112.112.112',- '208.67.222.222',- '208.67.220.220',-];--interface TxtDnsResolver {- resolveTxt(domain: string): Promise<Array<Array<string>>>;- setServers(servers: Array<string>): void;-}--interface DomainConnectionVerifierOptions {- dnsServers?: Array<string>;- resolverFactory?: () => TxtDnsResolver;-}--export class DomainConnectionVerifier implements IConnectionVerifier {- private readonly dnsServers: Array<string>;- private readonly resolverFactory: () => TxtDnsResolver;-- constructor(options: DomainConnectionVerifierOptions = {}) {- this.dnsServers = options.dnsServers ?? DOMAIN_VERIFICATION_DNS_SERVERS;- this.resolverFactory =- options.resolverFactory ??- (() => new Resolver({timeout: DNS_VERIFICATION_TIMEOUT_MS, tries: 1, maxTimeout: DNS_VERIFICATION_TIMEOUT_MS}));- }-- async verify(params: ConnectionVerificationParams): Promise<boolean> {- const domain = params.identifier;- const token = params.verification_token;- const dnsResult = await this.checkDnsTxt(domain, token);- if (dnsResult) {- return true;- }- return this.checkWellKnown(domain, token);- }-- private async checkDnsTxt(domain: string, token: string): Promise<boolean> {- if (!isFqdnHostname(domain)) {- return false;- }- const recordDomain = `_fluxer.${domain}`;- const results = await Promise.allSettled(- this.dnsServers.map(async (dnsServer) => {- const resolver = this.resolverFactory();- resolver.setServers([dnsServer]);- return resolver.resolveTxt(recordDomain);- }),- );- for (const result of results) {- if (result.status === 'fulfilled' && this.recordsContainToken(result.value, token)) {- return true;- }- if (result.status === 'rejected') {- Logger.debug({domain, error: result.reason}, 'DNS TXT verification lookup failed');- }- }- return false;- }-- private recordsContainToken(records: Array<Array<string>>, token: string): boolean {- for (const record of records) {- const value = record.join('');- if (value === `fluxer-verification=${token}`) {- return true;- }- }- return false;- }-- private async checkWellKnown(domain: string, token: string): Promise<boolean> {- const verificationPath = '/.well-known/fluxer-verification';- let url: URL;- try {- url = new URL(verificationPath, `https://${domain}`);- } catch {- return false;- }- if (- url.host !== domain ||- url.username !== '' ||- url.password !== '' ||- url.port !== '' ||- url.pathname !== verificationPath ||- url.search !== '' ||- url.hash !== ''- ) {- return false;- }- try {- const response = await FetchUtils.sendRequest({- url: url.href,- method: 'GET',- timeout: VERIFICATION_TIMEOUT_MS,- serviceName: 'connection_verification',- });- if (response.status < 200 || response.status >= 300) {- FetchUtils.discardResponseBody(response.stream, response.status);- return false;- }- const body = await FetchUtils.streamToStringWithLimit(response.stream, {- maxBytes: EXTERNAL_RESPONSE_LIMITS.domainVerificationBytes,- headers: response.headers,- url: url.href,- description: 'Domain verification response',- });- return body.trim() === token;- } catch (error) {- Logger.debug({domain, error}, 'Well-known verification lookup failed');- return false;- }- }-}diff --git a/fluxer_api/src/api/connection/verification/IConnectionVerifier.ts b/fluxer_api/src/api/connection/verification/IConnectionVerifier.tsdeleted file mode 100644index bd8e76d3d..000000000--- a/fluxer_api/src/api/connection/verification/IConnectionVerifier.ts+++ /dev/null@@ -1,10 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--export interface ConnectionVerificationParams {- identifier: string;- verification_token: string;-}--export interface IConnectionVerifier {- verify(params: ConnectionVerificationParams): Promise<boolean>;-}diff --git a/fluxer_api/src/api/infrastructure/IUnfurlerService.ts b/fluxer_api/src/api/infrastructure/IUnfurlerService.tsindex ffc83ac3d..a42dd6dbd 100644--- a/fluxer_api/src/api/infrastructure/IUnfurlerService.ts+++ b/fluxer_api/src/api/infrastructure/IUnfurlerService.ts@@ -28,4 +28,6 @@ export abstract class IUnfurlerService {nsfwMode?: MediaProxyNsfwMode,options?: UnfurlOptions,): Promise<UnfurlResult>;++ abstract verifyDomain(domain: string, token: string): Promise<boolean>;}diff --git a/fluxer_api/src/api/infrastructure/NatsUnfurlerService.ts b/fluxer_api/src/api/infrastructure/NatsUnfurlerService.tsindex 75c40e6e6..1b8f2e33a 100644--- a/fluxer_api/src/api/infrastructure/NatsUnfurlerService.ts+++ b/fluxer_api/src/api/infrastructure/NatsUnfurlerService.ts@@ -16,6 +16,7 @@ import type {INatsConnectionManager} from '@pkgs/nats/src/INatsConnectionManagerconst NATS_UNFURL_SUBJECT = 'svc.unfurl';const NATS_UNFURL_TIMEOUT_MS = 12000;const NATS_UNFURL_CACHE_ONLY_TIMEOUT_MS = 1000;+const NATS_VERIFY_DOMAIN_TIMEOUT_MS = 8000;interface NatsUnfurlRequest {op: 'Unfurl';@@ -51,6 +52,26 @@ function isNatsUnfurlResponse(value: unknown): value is NatsUnfurlResponse {return false;}+interface NatsVerifyDomainRequest {+ op: 'VerifyDomain';+ domain: string;+ token: string;+}++type NatsVerifyDomainResponse = {Verified: boolean} | {Failed: {message: string}};++function isNatsVerifyDomainResponse(value: unknown): value is NatsVerifyDomainResponse {+ if (!isJsonRecord(value)) return false;+ if ('Verified' in value) {+ return typeof value.Verified === 'boolean';+ }+ if ('Failed' in value) {+ const failed = value.Failed;+ return isJsonRecord(failed) && typeof failed.message === 'string';+ }+ return false;+}+function mapUnfurlTransportError(error: unknown): Error {if (error instanceof FluxerError) {return error;@@ -116,4 +137,24 @@ export class NatsUnfurlerService extends IUnfurlerService {throw mapUnfurlTransportError(error);}}++ async verifyDomain(domain: string, token: string): Promise<boolean> {+ try {+ const request: NatsVerifyDomainRequest = {op: 'VerifyDomain', domain, token};+ const response = await requestSvcJson(this.connectionManager, NATS_UNFURL_SUBJECT, request, {+ timeoutMs: NATS_VERIFY_DOMAIN_TIMEOUT_MS,+ guard: isNatsVerifyDomainResponse,+ service: 'nats-unfurl',+ invalidPayloadError: () => new BadGatewayError({message: '[nats-unfurl] invalid response payload'}),+ });+ if ('Verified' in response) {+ return response.Verified;+ }+ Logger.warn({domain, message: response.Failed.message}, '[nats-unfurl] domain verification rejected');+ return false;+ } catch (error) {+ Logger.error({error, domain}, '[nats-unfurl] failed to verify domain');+ throw mapUnfurlTransportError(error);+ }+ }}diff --git a/fluxer_api/src/api/middleware/ServiceMiddleware.ts b/fluxer_api/src/api/middleware/ServiceMiddleware.tsindex 4a2afcf5c..6fab8166d 100644--- a/fluxer_api/src/api/middleware/ServiceMiddleware.ts+++ b/fluxer_api/src/api/middleware/ServiceMiddleware.ts@@ -636,7 +636,11 @@ class RequestServices implements RequestScopedServices {}get connectionService(): ConnectionService {- this.cachedConnectionService ??= new ConnectionService(getConnectionRepository(), this.gatewayService);+ this.cachedConnectionService ??= new ConnectionService(+ getConnectionRepository(),+ this.gatewayService,+ getUnfurlerService(),+ );return this.cachedConnectionService;}diff --git a/fluxer_api/src/api/test/mocks/NoopUnfurlerService.ts b/fluxer_api/src/api/test/mocks/NoopUnfurlerService.tsindex d5f5b7c51..c55df3504 100644--- a/fluxer_api/src/api/test/mocks/NoopUnfurlerService.ts+++ b/fluxer_api/src/api/test/mocks/NoopUnfurlerService.ts@@ -11,4 +11,8 @@ export class NoopUnfurlerService extends IUnfurlerService {): Promise<UnfurlResult> {return {embeds: [], cacheTtlSeconds: null};}++ override async verifyDomain(_domain: string, _token: string): Promise<boolean> {+ return false;+ }}diff --git a/fluxer_api/src/api/utils/ExternalResponseLimits.ts b/fluxer_api/src/api/utils/ExternalResponseLimits.tsindex 29ff6a329..14ebdc29b 100644--- a/fluxer_api/src/api/utils/ExternalResponseLimits.ts+++ b/fluxer_api/src/api/utils/ExternalResponseLimits.ts@@ -1,25 +1,11 @@// SPDX-License-Identifier: AGPL-3.0-or-laterexport const EXTERNAL_RESPONSE_LIMITS = {- unfurlDocumentBytes: 8 * 1024 * 1024,- unfurlResourceBytes: 500 * 1024 * 1024,ssoUserInfoBytes: 512 * 1024,ssoTokenBytes: 256 * 1024,ssoDiscoveryBytes: 256 * 1024,ssoJwksBytes: 256 * 1024,- domainVerificationBytes: 16 * 1024,- registrationWebhookBytes: 16 * 1024,- alertWebhookBytes: 16 * 1024,- youtubeApiBytes: 256 * 1024,- hackerNewsItemBytes: 128 * 1024,- blueskyResolveBytes: 128 * 1024,- blueskyDidBytes: 256 * 1024,- blueskyPostBytes: 512 * 1024,- blueskyProfileBytes: 256 * 1024,- wikipediaSummaryBytes: 256 * 1024,- oEmbedBytes: 256 * 1024,pwnedPasswordsBytes: 1024 * 1024,- externalTemplateBytes: 512 * 1024,fileBlocklistBytes: 25 * 1024 * 1024,urlBlocklistBytes: 25 * 1024 * 1024,} as const;diff --git a/fluxer_unfurl/Cargo.toml b/fluxer_unfurl/Cargo.tomlindex 30b609a4c..f0911663b 100644--- a/fluxer_unfurl/Cargo.toml+++ b/fluxer_unfurl/Cargo.toml@@ -13,6 +13,7 @@ chrono = { version = "0.4.45", default-features = false, features = ["std"] }encoding_rs = "0.8.41"entities = "1.0.1"fluxer-svc = { path = "../fluxer_svc", default-features = false }+hickory-resolver = { version = "0.26.3", default-features = false, features = ["tokio"] }infer = "0.22.0"moka = { version = "0.12.16", features = ["future", "sync"] }regex = "1.13"diff --git a/fluxer_unfurl/src/domain_verification.rs b/fluxer_unfurl/src/domain_verification.rsnew file mode 100644index 000000000..2801f3b8c--- /dev/null+++ b/fluxer_unfurl/src/domain_verification.rs@@ -0,0 +1,137 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++use crate::{http_fetch, network_policy};+use fluxer_common::public_ip::is_valid_public_hostname;+use hickory_resolver::TokioResolver;+use hickory_resolver::config::{NameServerConfig, ResolveHosts, ResolverConfig, ResolverOpts};+use hickory_resolver::net::runtime::TokioRuntimeProvider;+use hickory_resolver::proto::rr::{RData, RecordType};+use reqwest::header::{ACCEPT_ENCODING, CONTENT_ENCODING, HeaderValue};+use std::net::{IpAddr, Ipv4Addr};+use std::time::Duration;+use tokio::time::timeout;+use url::Url;++const WELL_KNOWN_TIMEOUT: Duration = Duration::from_millis(3000);+const WELL_KNOWN_MAX_BYTES: usize = 16 * 1024;+const WELL_KNOWN_PATH: &str = "/.well-known/fluxer-verification";+const MAX_TOKEN_BYTES: usize = 256;++pub async fn verify_domain(+ client: &reqwest::Client,+ domain: &str,+ token: &str,+) -> anyhow::Result<bool> {+ validate_domain(domain)?;+ if token.is_empty() || token.len() > MAX_TOKEN_BYTES {+ anyhow::bail!("invalid verification token");+ }+ if dns_txt_matches(domain, token).await {+ return Ok(true);+ }+ match timeout(+ WELL_KNOWN_TIMEOUT,+ well_known_matches(client, domain, token),+ )+ .await+ {+ Ok(Ok(matched)) => Ok(matched),+ Ok(Err(err)) => {+ tracing::debug!(error = %err, domain, "well-known verification lookup failed");+ Ok(false)+ }+ Err(_) => {+ tracing::debug!(domain, "well-known verification lookup timed out");+ Ok(false)+ }+ }+}++async fn dns_txt_matches(domain: &str, token: &str) -> bool {+ let expected = format!("fluxer-verification={token}");+ let mut lookups = JoinSet::new();+ for server in DNS_SERVERS {+ let record_name = record_name.clone();+ lookups.spawn(async move { lookup_txt(IpAddr::V4(server), &record_name).await });+ }+ while let Some(result) = lookups.join_next().await {+ match result {+ Ok(Ok(records)) if records.iter().any(|record| record == &expected) => {+ lookups.abort_all();+ return true;+ }+ Ok(Ok(_)) => {}+ Ok(Err(err)) => {+ tracing::debug!(error = %err, domain, "DNS TXT verification lookup failed");+ }+ Err(err) => {+ tracing::debug!(error = %err, domain, "DNS TXT verification task failed");+ }+ }+ }+ false+}++async fn well_known_matches(+ client: &reqwest::Client,+ domain: &str,+ token: &str,+) -> anyhow::Result<bool> {+ let url = Url::parse(&format!("https://{domain}{WELL_KNOWN_PATH}"))?;+ if url.host_str() != Some(domain) || url.port().is_some() || url.path() != WELL_KNOWN_PATH {+ anyhow::bail!("verification URL does not match the domain");+ }+ network_policy::validate_url(&url).await?;+ let response = client+ .get(url)+ .header(ACCEPT_ENCODING, HeaderValue::from_static("identity"))+ .send()+ .await?;+ if !response.status().is_success() {+ return Ok(false);+ }+ if let Some(encoding) = response.headers().get(CONTENT_ENCODING)+ && !encoding+ .to_str()+ .is_ok_and(|value| value.trim().eq_ignore_ascii_case("identity"))+ {+ return Ok(false);+ }+ if response+ .content_length()+ .is_some_and(|len| len > WELL_KNOWN_MAX_BYTES as u64)+ {+ return Ok(false);+ }+ let body = http_fetch::read_body(response, WELL_KNOWN_MAX_BYTES).await?;+ Ok(body_matches_token(&body, token))+}++fn body_matches_token(body: &[u8], token: &str) -> bool {+ let text = String::from_utf8_lossy(body);+ text.strip_prefix('\u{feff}').unwrap_or(&text).trim() == token+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn body_must_equal_token_after_trimming() {+ assert!(body_matches_token(b"abc123", "abc123"));+ assert!(body_matches_token(b" abc123\r\n", "abc123"));+ assert!(body_matches_token("\u{feff}abc123\n".as_bytes(), "abc123"));+ assert!(!body_matches_token(b"abc1234", "abc123"));+ assert!(!body_matches_token(b"fluxer-verification=abc123", "abc123"));+ assert!(!body_matches_token(b"", "abc123"));+ }++ #[test]+ fn joins_split_txt_strings() {+ let strings: Vec<Box<[u8]>> = vec![+ b"fluxer-verification=".to_vec().into_boxed_slice(),+ b"abc123".to_vec().into_boxed_slice(),+ ];+ assert_eq!(join_txt_strings(&strings), "fluxer-verification=abc123");+ }+}diff --git a/fluxer_unfurl/src/http_fetch.rs b/fluxer_unfurl/src/http_fetch.rsindex b7ac92929..6dc577d10 100644--- a/fluxer_unfurl/src/http_fetch.rs+++ b/fluxer_unfurl/src/http_fetch.rs@@ -175,7 +175,7 @@ whereErr(anyhow::anyhow!("too many redirects"))}-async fn read_body(resp: reqwest::Response, max_bytes: usize) -> anyhow::Result<Vec<u8>> {+pub async fn read_body(resp: reqwest::Response, max_bytes: usize) -> anyhow::Result<Vec<u8>> {let mut buf = Vec::with_capacity(max_bytes.min(64 * 1024));let mut stream = resp;diff --git a/fluxer_unfurl/src/main.rs b/fluxer_unfurl/src/main.rsindex 550470a1b..195ad760a 100644--- a/fluxer_unfurl/src/main.rs+++ b/fluxer_unfurl/src/main.rs@@ -4,6 +4,7 @@ mod activity_pub;mod cache_policy;mod charset;mod direct_media;+mod domain_verification;mod embed_normalizer;mod html_markdown;mod html_parser;diff --git a/fluxer_unfurl/src/router_impl.rs b/fluxer_unfurl/src/router_impl.rsindex dc5a9b988..e2080e9f2 100644--- a/fluxer_unfurl/src/router_impl.rs+++ b/fluxer_unfurl/src/router_impl.rs@@ -43,6 +43,7 @@ impl RouterService for UnfurlRouter {fn route_key(req: &UnfurlRequest) -> String {match req {UnfurlRequest::Unfurl { url, .. } => url.clone(),+ UnfurlRequest::VerifyDomain { domain, .. } => domain.clone(),}}@@ -69,6 +70,7 @@ impl RouterService for UnfurlRouter {)))}+ UnfurlRequest::VerifyDomain { .. } => None,}}@@ -93,6 +95,7 @@ impl RouterService for UnfurlRouter {self.l1.get(&key)}}+ UnfurlRequest::VerifyDomain { .. } => None,}}@@ -119,6 +122,7 @@ impl RouterService for UnfurlRouter {);}}+ UnfurlRequest::VerifyDomain { .. } => {}}}}diff --git a/fluxer_unfurl/src/shard_impl.rs b/fluxer_unfurl/src/shard_impl.rsindex 2b5b984de..54d753c13 100644--- a/fluxer_unfurl/src/shard_impl.rs+++ b/fluxer_unfurl/src/shard_impl.rs@@ -284,6 +284,16 @@ impl ShardService for UnfurlShard {self.cache.insert(cache_key, result.clone()).await;Ok(UnfurlResponse::Resolved(result))}+ UnfurlRequest::VerifyDomain { domain, token } => {+ match crate::domain_verification::verify_domain(&self.http_client, &domain, &token)+ .await+ {+ Ok(verified) => Ok(UnfurlResponse::Verified(verified)),+ Err(err) => Ok(UnfurlResponse::Failed {+ message: err.to_string(),+ }),+ }+ }}}}diff --git a/fluxer_unfurl/src/types.rs b/fluxer_unfurl/src/types.rsindex a7a81faf3..cd388eb65 100644--- a/fluxer_unfurl/src/types.rs+++ b/fluxer_unfurl/src/types.rs@@ -18,6 +18,10 @@ pub enum UnfurlRequest {#[serde(default)]klipy_api_key: Option<String>,},+ VerifyDomain {+ domain: String,+ token: String,+ },}#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]@@ -32,6 +36,7 @@ pub enum NsfwMode {#[derive(Debug, Clone, Serialize, Deserialize)]pub enum UnfurlResponse {Resolved(Arc<UnfurlResult>),+ Verified(bool),Failed { message: String },}@@ -204,6 +209,7 @@ mod tests {assert!(youtube_api_key.is_none());assert!(klipy_api_key.is_none());}+ UnfurlRequest::VerifyDomain { .. } => panic!("expected an unfurl request"),}}}