chore: remove tor from startos core

Tor is being moved from a built-in OS feature to a service. This removes
the Arti-based Tor client, onion address management, hidden service
creation, and all related code from the core backend, frontend, and SDK.

- Delete core/src/net/tor/ module (~2060 lines)
- Remove OnionAddress, TorSecretKey, TorController from all consumers
- Remove HostnameInfo::Onion and HostAddress::Onion variants
- Remove onion CRUD RPC endpoints and tor subcommand
- Remove tor key handling from account and backup/restore
- Remove ~12 tor-related Cargo dependencies (arti-client, torut, etc.)
- Remove tor UI components, API methods, mock data, and routes
- Remove OnionHostname and tor patterns/regexes from SDK
- Add v0_4_0_alpha_20 database migration to strip onion data
- Bump version to 0.4.0-alpha.20
This commit is contained in:
Aiden McClelland
2026-02-10 13:28:24 -07:00
parent 1974dfd66f
commit 2ee403e7de
53 changed files with 3147 additions and 9306 deletions

View File

@@ -20,7 +20,6 @@ export const getHostname = (url: string): Hostname | null => {
}
type FilterKinds =
| 'onion'
| 'mdns'
| 'domain'
| 'ip'
@@ -42,27 +41,25 @@ type VisibilityFilter<V extends 'public' | 'private'> = V extends 'public'
| (HostnameInfo & { public: false })
| VisibilityFilter<Exclude<V, 'private'>>
: never
type KindFilter<K extends FilterKinds> = K extends 'onion'
? (HostnameInfo & { kind: 'onion' }) | KindFilter<Exclude<K, 'onion'>>
: K extends 'mdns'
type KindFilter<K extends FilterKinds> = K extends 'mdns'
?
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'local' } })
| KindFilter<Exclude<K, 'mdns'>>
: K extends 'domain'
?
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'local' } })
| KindFilter<Exclude<K, 'mdns'>>
: K extends 'domain'
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'domain' } })
| KindFilter<Exclude<K, 'domain'>>
: K extends 'ipv4'
?
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'domain' } })
| KindFilter<Exclude<K, 'domain'>>
: K extends 'ipv4'
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv4' } })
| KindFilter<Exclude<K, 'ipv4'>>
: K extends 'ipv6'
?
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv4' } })
| KindFilter<Exclude<K, 'ipv4'>>
: K extends 'ipv6'
?
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv6' } })
| KindFilter<Exclude<K, 'ipv6'>>
: K extends 'ip'
? KindFilter<Exclude<K, 'ip'> | 'ipv4' | 'ipv6'>
: never
| (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv6' } })
| KindFilter<Exclude<K, 'ipv6'>>
: K extends 'ip'
? KindFilter<Exclude<K, 'ip'> | 'ipv4' | 'ipv6'>
: never
type FilterReturnTy<F extends Filter> = F extends {
visibility: infer V extends 'public' | 'private'
@@ -90,10 +87,6 @@ const nonLocalFilter = {
const publicFilter = {
visibility: 'public',
} as const
const onionFilter = {
kind: 'onion',
} as const
type Formats = 'hostname-info' | 'urlstring' | 'url'
type FormatReturnTy<
F extends Filter,
@@ -124,7 +117,6 @@ export type Filled<F extends Filter = {}> = {
nonLocal: Filled<typeof nonLocalFilter & Filter>
public: Filled<typeof publicFilter & Filter>
onion: Filled<typeof onionFilter & Filter>
}
export type FilledAddressInfo = AddressInfo & Filled
export type ServiceInterfaceFilled = {
@@ -162,9 +154,7 @@ export const addressHostToUrl = (
scheme in knownProtocols &&
port === knownProtocols[scheme as keyof typeof knownProtocols].defaultPort
let hostname
if (host.kind === 'onion') {
hostname = host.hostname.value
} else if (host.kind === 'ip') {
if (host.kind === 'ip') {
if (host.hostname.kind === 'domain') {
hostname = host.hostname.value
} else if (host.hostname.kind === 'ipv6') {
@@ -201,13 +191,9 @@ function filterRec(
hostnames = hostnames.filter((h) => invert !== pred(h))
}
if (filter.visibility === 'public')
hostnames = hostnames.filter(
(h) => invert !== (h.kind === 'onion' || h.public),
)
hostnames = hostnames.filter((h) => invert !== h.public)
if (filter.visibility === 'private')
hostnames = hostnames.filter(
(h) => invert !== (h.kind !== 'onion' && !h.public),
)
hostnames = hostnames.filter((h) => invert !== !h.public)
if (filter.kind) {
const kind = new Set(
Array.isArray(filter.kind) ? filter.kind : [filter.kind],
@@ -219,10 +205,7 @@ function filterRec(
hostnames = hostnames.filter(
(h) =>
invert !==
((kind.has('onion') && h.kind === 'onion') ||
(kind.has('mdns') &&
h.kind === 'ip' &&
h.hostname.kind === 'local') ||
((kind.has('mdns') && h.kind === 'ip' && h.hostname.kind === 'local') ||
(kind.has('domain') &&
h.kind === 'ip' &&
h.hostname.kind === 'domain') ||
@@ -266,11 +249,6 @@ export const filledAddress = (
filterRec(hostnames, publicFilter, false),
),
)
const getOnion = once(() =>
filledAddressFromHostnames<typeof onionFilter & F>(
filterRec(hostnames, onionFilter, false),
),
)
return {
...addressInfo,
hostnames,
@@ -294,9 +272,6 @@ export const filledAddress = (
get public(): Filled<typeof publicFilter & F> {
return getPublic()
},
get onion(): Filled<typeof onionFilter & F> {
return getOnion()
},
}
}

View File

@@ -21,11 +21,6 @@ export const localHostname: Pattern = {
description: 'Must be a valid ".local" hostname',
}
export const torHostname: Pattern = {
regex: regexes.torHostname.matches(),
description: 'Must be a valid Tor (".onion") hostname',
}
export const url: Pattern = {
regex: regexes.url.matches(),
description: 'Must be a valid URL',
@@ -36,11 +31,6 @@ export const localUrl: Pattern = {
description: 'Must be a valid ".local" URL',
}
export const torUrl: Pattern = {
regex: regexes.torUrl.matches(),
description: 'Must be a valid Tor (".onion") URL',
}
export const ascii: Pattern = {
regex: regexes.ascii.matches(),
description:

View File

@@ -39,10 +39,6 @@ export const localHostname = new ComposableRegex(
/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.local/,
)
export const torHostname = new ComposableRegex(
/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion/,
)
// https://ihateregex.io/expr/url/
export const url = new ComposableRegex(
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,
@@ -52,10 +48,6 @@ export const localUrl = new ComposableRegex(
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.local\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,
)
export const torUrl = new ComposableRegex(
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,
)
// https://ihateregex.io/expr/ascii/
export const ascii = new ComposableRegex(/[ -~]*/)