{"version":3,"file":"consensus.cjs","sources":["../../../../../../src/mods/tor/consensus/consensus.ts"],"sourcesContent":["import { ASN1 } from \"@hazae41/asn1\"\nimport { Base16 } from \"@hazae41/base16\"\nimport { Base64 } from \"@hazae41/base64\"\nimport { Bytes } from \"@hazae41/bytes\"\nimport { fetch } from \"@hazae41/fleche\"\nimport { RsaWasm } from \"@hazae41/rsa.wasm\"\nimport { OIDs, X509 } from \"@hazae41/x509\"\nimport { Mutable } from \"libs/typescript/typescript.js\"\nimport { Circuit } from \"../circuit.js\"\n\nexport interface Consensus {\n  readonly type: string\n  readonly version: number\n  readonly status: string\n  readonly method: number\n  readonly validAfter: Date\n  readonly freshUntil: Date\n  readonly votingDelay: [number, number]\n  readonly clientVersions: string[]\n  readonly serverVersions: string[]\n  readonly knownFlags: string[]\n  readonly recommendedClientProtocols: Record<string, string>\n  readonly recommendedRelayProtocols: Record<string, string>\n  readonly requiredClientProtocols: Record<string, string>\n  readonly requiredRelayProtocols: Record<string, string>\n  readonly params: Record<string, string>\n  readonly sharedRandPreviousValue: Consensus.SharedRandom\n  readonly sharedRandCurrentValue: Consensus.SharedRandom\n  readonly authorities: Consensus.Authority[]\n  readonly microdescs: Consensus.Microdesc.Head[]\n  readonly bandwidthWeights: Record<string, string>\n\n  readonly preimage: string\n  readonly signatures: Consensus.Signature[]\n}\n\nexport namespace Consensus {\n\n  export interface SharedRandom {\n    readonly reveals: number\n    readonly random: string\n  }\n\n  export interface Authority {\n    readonly nickname: string\n    readonly identity: string\n    readonly hostname: string\n    readonly ipaddress: string\n    readonly dirport: number\n    readonly orport: number\n    readonly contact: string\n    readonly digest: string\n  }\n\n  export namespace Authority {\n\n    export const trusteds = new Set([\n      \"0232AF901C31A04EE9848595AF9BB7620D4C5B2E\",\n      \"14C131DFC5C6F93646BE72FA1401C02A8DF2E8B4\",\n      \"23D15D965BC35114467363C165C4F724B64B4F66\",\n      \"27102BC123E7AF1D4741AE047E160C91ADC76B21\",\n      \"49015F787433103580E3B66A1707A00E60F2D15B\",\n      \"E8A9C45EDE6D711294FADF8E7951F4DE6CA56B58\",\n      \"ED03BB616EB2F60BEC80151114BB25CEF515B226\",\n      \"F533C81CEF0BC0267857C99B2F471ADF249FA232\"\n    ])\n\n  }\n\n  export interface Signature {\n    readonly algorithm: string\n    readonly identity: string\n    readonly signingKeyDigest: string\n    readonly signature: string\n  }\n\n  export async function fetchOrThrow(circuit: Circuit, signal = new AbortController().signal) {\n    const stream = await circuit.openDirOrThrow({}, signal)\n    const response = await fetch(`http://localhost/tor/status-vote/current/consensus-microdesc.z`, { stream: stream.outer, signal })\n    const consensus = Consensus.parseOrThrow(await response.text())\n\n    if (await Consensus.verifyOrThrow(circuit, consensus, signal) !== true)\n      throw new Error(`Could not verify`)\n\n    return consensus\n  }\n\n  export function parseOrThrow(text: string) {\n    const lines = text.split(\"\\n\")\n\n    const consensus: Partial<Mutable<Consensus>> = {}\n\n    const authorities: Authority[] = []\n    const microdescs: Microdesc.Head[] = []\n    const signatures: Signature[] = []\n\n    for (const i = { x: 0 }; i.x < lines.length; i.x++) {\n\n      if (lines[i.x].startsWith(\"network-status-version \")) {\n        const [, version, type] = lines[i.x].split(\" \")\n        consensus.version = Number(version)\n        consensus.type = type\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"vote-status \")) {\n        const [, status] = lines[i.x].split(\" \")\n        consensus.status = status\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"consensus-method \")) {\n        const [, method] = lines[i.x].split(\" \")\n        consensus.method = Number(method)\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"valid-after \")) {\n        const validAfter = lines[i.x].split(\" \").slice(1).join(\" \")\n        consensus.validAfter = new Date(validAfter)\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"fresh-until \")) {\n        const freshUntil = lines[i.x].split(\" \").slice(1).join(\" \")\n        consensus.freshUntil = new Date(freshUntil)\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"voting-delay \")) {\n        const [, first, second] = lines[i.x].split(\" \")\n        consensus.votingDelay = [Number(first), Number(second)]\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"client-versions \")) {\n        const [, versions] = lines[i.x].split(\" \")\n        consensus.clientVersions = versions.split(\",\")\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"server-versions \")) {\n        const [, versions] = lines[i.x].split(\" \")\n        consensus.serverVersions = versions.split(\",\")\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"known-flags \")) {\n        const [, ...flags] = lines[i.x].split(\" \")\n        consensus.knownFlags = flags\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"recommended-client-protocols \")) {\n        const [, ...protocols] = lines[i.x].split(\" \")\n        consensus.recommendedClientProtocols = Object.fromEntries(protocols.map(entry => entry.split(\"=\")))\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"recommended-relay-protocols \")) {\n        const [, ...protocols] = lines[i.x].split(\" \")\n        consensus.recommendedRelayProtocols = Object.fromEntries(protocols.map(entry => entry.split(\"=\")))\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"required-client-protocols \")) {\n        const [, ...protocols] = lines[i.x].split(\" \")\n        consensus.requiredClientProtocols = Object.fromEntries(protocols.map(entry => entry.split(\"=\")))\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"required-relay-protocols \")) {\n        const [, ...protocols] = lines[i.x].split(\" \")\n        consensus.requiredRelayProtocols = Object.fromEntries(protocols.map(entry => entry.split(\"=\")))\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"params \")) {\n        const [, ...params] = lines[i.x].split(\" \")\n        consensus.params = Object.fromEntries(params.map(entry => entry.split(\"=\")))\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"shared-rand-previous-value \")) {\n        const [, reveals, random] = lines[i.x].split(\" \")\n        consensus.sharedRandPreviousValue = { reveals: Number(reveals), random }\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"shared-rand-current-value \")) {\n        const [, reveals, random] = lines[i.x].split(\" \")\n        consensus.sharedRandCurrentValue = { reveals: Number(reveals), random }\n        continue\n      }\n\n      if (lines[i.x] === \"directory-footer\") {\n        for (i.x++; i.x < lines.length; i.x++) {\n\n          if (lines[i.x].startsWith(\"bandwidth-weights \")) {\n            const [, ...weights] = lines[i.x].split(\" \")\n            consensus.bandwidthWeights = Object.fromEntries(weights.map(entry => entry.split(\"=\")))\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"directory-signature \")) {\n            consensus.preimage ??= `${lines.slice(0, i.x).join(\"\\n\")}\\ndirectory-signature `\n\n            const item: Partial<Mutable<Consensus.Signature>> = {}\n            const [, algorithm, identity, signingKeyDigest] = lines[i.x].split(\" \")\n            item.algorithm = algorithm\n            item.identity = identity\n            item.signingKeyDigest = signingKeyDigest\n\n            i.x++\n\n            item.signature = readSignatureOrThrow(lines, i)\n\n            if (item.algorithm == null)\n              throw new Error(\"Missing algorithm\")\n            if (item.identity == null)\n              throw new Error(\"Missing identity\")\n            if (item.signingKeyDigest == null)\n              throw new Error(\"Missing signingKeyDigest\")\n            if (item.signature == null)\n              throw new Error(\"Missing signature\")\n\n            const signature = item as Consensus.Signature\n            signatures.push(signature)\n            continue\n          }\n\n          continue\n        }\n\n        break\n      }\n\n      if (lines[i.x].startsWith(\"dir-source \")) {\n        const item: Partial<Mutable<Authority>> = {}\n        const [_, nickname, identity, hostname, ipaddress, dirport, orport] = lines[i.x].split(\" \")\n        item.nickname = nickname\n        item.identity = identity\n        item.hostname = hostname\n        item.ipaddress = ipaddress\n        item.dirport = Number(dirport)\n        item.orport = Number(orport)\n\n        for (i.x++; i.x < lines.length; i.x++) {\n          if (lines[i.x].startsWith(\"dir-source \")) {\n            i.x--\n            break\n          }\n\n          if (lines[i.x].startsWith(\"r \")) {\n            i.x--\n            break\n          }\n\n          if (lines[i.x] === \"directory-footer\") {\n            i.x--\n            break\n          }\n\n          if (lines[i.x].startsWith(\"contact \")) {\n            const contact = lines[i.x].split(\" \").slice(1).join(\" \")\n            item.contact = contact\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"vote-digest \")) {\n            const [_, digest] = lines[i.x].split(\" \")\n            item.digest = digest\n            continue\n          }\n\n          continue\n        }\n\n        if (item.nickname == null)\n          throw new Error(\"Missing nickname\")\n        if (item.identity == null)\n          throw new Error(\"Missing identity\")\n        if (item.hostname == null)\n          throw new Error(\"Missing hostname\")\n        if (item.ipaddress == null)\n          throw new Error(\"Missing ipaddress\")\n        if (item.dirport == null)\n          throw new Error(\"Missing dirport\")\n        if (item.orport == null)\n          throw new Error(\"Missing orport\")\n        if (item.contact == null)\n          throw new Error(\"Missing contact\")\n        if (item.digest == null)\n          throw new Error(\"Missing digest\")\n\n        const authority = item as Authority\n        authorities.push(authority)\n        continue\n      }\n\n      if (lines[i.x].startsWith(\"r \")) {\n        const item: Partial<Mutable<Microdesc.Head>> = {}\n\n        const [_, nickname, identity, date, hour, hostname, orport, dirport] = lines[i.x].split(\" \")\n        item.nickname = nickname\n        item.identity = identity\n        item.date = date\n        item.hour = hour\n        item.hostname = hostname\n        item.orport = Number(orport)\n        item.dirport = Number(dirport)\n\n        for (i.x++; i.x < lines.length; i.x++) {\n          if (lines[i.x].startsWith(\"dir-source \")) {\n            i.x--\n            break\n          }\n\n          if (lines[i.x].startsWith(\"r \")) {\n            i.x--\n            break\n          }\n\n          if (lines[i.x] === \"directory-footer\") {\n            i.x--\n            break\n          }\n\n          if (lines[i.x].startsWith(\"a \")) {\n            const [, ipv6] = lines[i.x].split(\" \")\n            item.ipv6 = ipv6\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"m \")) {\n            const [, digest] = lines[i.x].split(\" \")\n            item.microdesc = digest\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"s \")) {\n            const [, ...flags] = lines[i.x].split(\" \")\n            item.flags = flags\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"v \")) {\n            const version = lines[i.x].slice(\"v \".length)\n            item.version = version\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"pr \")) {\n            const [, ...entries] = lines[i.x].split(\" \")\n            item.entries = Object.fromEntries(entries.map(entry => entry.split(\"=\")))\n            continue\n          }\n\n          if (lines[i.x].startsWith(\"w \")) {\n            const [, ...entries] = lines[i.x].split(\" \")\n            item.bandwidth = Object.fromEntries(entries.map(entry => entry.split(\"=\")))\n            continue\n          }\n\n          continue\n        }\n\n        if (item.nickname == null)\n          throw new Error(\"Missing nickname\")\n        if (item.identity == null)\n          throw new Error(\"Missing identity\")\n        if (item.date == null)\n          throw new Error(\"Missing date\")\n        if (item.hour == null)\n          throw new Error(\"Missing hour\")\n        if (item.hostname == null)\n          throw new Error(\"Missing hostname\")\n        if (item.orport == null)\n          throw new Error(\"Missing orport\")\n        if (item.dirport == null)\n          throw new Error(\"Missing dirport\")\n        if (item.microdesc == null)\n          throw new Error(\"Missing microdesc\")\n        if (item.flags == null)\n          throw new Error(\"Missing flags\")\n        if (item.version == null)\n          throw new Error(\"Missing version\")\n        if (item.entries == null)\n          throw new Error(\"Missing entries\")\n        if (item.bandwidth == null)\n          throw new Error(\"Missing bandwidth\")\n\n        microdescs.push(item as Microdesc.Head)\n        continue\n      }\n\n      continue\n    }\n\n    consensus.authorities = authorities\n    consensus.microdescs = microdescs\n    consensus.signatures = signatures\n    return consensus as Consensus\n  }\n\n  export async function verifyOrThrow(circuit: Circuit, consensus: Consensus, signal = new AbortController().signal) {\n    let count = 0\n\n    for (const it of consensus.signatures) {\n      if (it.algorithm === \"sha256\") {\n        if (!Authority.trusteds.has(it.identity))\n          continue\n\n        const certificate = await Certificate.fetchOrThrow(circuit, it.identity, signal)\n\n        if (certificate == null)\n          throw new Error(`Missing certificate for ${it.identity}`)\n\n        const signed = Bytes.fromUtf8(consensus.preimage)\n        const hashed = new Uint8Array(await crypto.subtle.digest(\"SHA-256\", signed))\n\n        using signingKey = Base64.get().getOrThrow().decodePaddedOrThrow(certificate.signingKey)\n\n        const algorithmAsn1 = ASN1.ObjectIdentifier.create(undefined, OIDs.keys.rsaEncryption).toDER()\n        const algorithmId = new X509.AlgorithmIdentifier(algorithmAsn1, ASN1.Null.create().toDER())\n        const subjectPublicKey = ASN1.BitString.create(undefined, 0, signingKey.bytes).toDER()\n        const subjectPublicKeyInfo = new X509.SubjectPublicKeyInfo(algorithmId, subjectPublicKey)\n\n        const publicKey = X509.writeToBytesOrThrow(subjectPublicKeyInfo)\n\n        using signature = Base64.get().getOrThrow().decodePaddedOrThrow(it.signature)\n\n        using signatureM = new RsaWasm.Memory(signature.bytes)\n        using hashedM = new RsaWasm.Memory(hashed)\n        using publicKeyM = new RsaWasm.Memory(publicKey)\n\n        using publicKeyX = RsaWasm.RsaPublicKey.from_public_key_der(publicKeyM)\n        const verified = publicKeyX.verify_pkcs1v15_unprefixed(hashedM, signatureM)\n\n        if (verified !== true)\n          throw new Error(`Could not verify`)\n\n        count++\n\n        continue\n      }\n\n      continue\n    }\n\n    if (count < 3)\n      throw new Error(`Not enough signatures`)\n\n    return true\n  }\n\n  export interface Certificate {\n    readonly version: number\n    readonly fingerprint: string\n    readonly published: Date\n    readonly expires: Date\n    readonly identityKey: string\n    readonly signingKey: string\n    readonly crossCert: string\n\n    readonly preimage: string\n    readonly signature: string\n  }\n\n  export namespace Certificate {\n\n    export async function fetchAllOrThrow(circuit: Circuit, signal = new AbortController().signal) {\n      const stream = await circuit.openDirOrThrow({}, signal)\n      const response = await fetch(`http://localhost/tor/keys/fp/all.z`, { stream: stream.outer, signal })\n\n      if (!response.ok)\n        throw new Error(`Could not fetch`)\n\n      const certificates = parseOrThrow(await response.text())\n\n      const verifieds = await Promise.all(certificates.map(verifyOrThrow))\n\n      if (verifieds.some(result => result !== true))\n        throw new Error(`Could not verify`)\n\n      return certificates\n    }\n\n    export async function fetchOrThrow(circuit: Circuit, fingerprint: string, signal = new AbortController().signal) {\n      const stream = await circuit.openDirOrThrow(undefined, signal)\n      const response = await fetch(`http://localhost/tor/keys/fp/${fingerprint}.z`, { stream: stream.outer, signal })\n\n      if (!response.ok)\n        throw new Error(`Could not fetch`)\n\n      const [certificate] = parseOrThrow(await response.text())\n\n      if (certificate == null)\n        throw new Error(`Missing certificate`)\n\n      if (await verifyOrThrow(certificate) !== true)\n        throw new Error(`Could not verify`)\n\n      return certificate\n    }\n\n    export async function verifyOrThrow(cert: Certificate) {\n      using identityKey = Base64.get().getOrThrow().decodePaddedOrThrow(cert.identityKey)\n\n      const identity = new Uint8Array(await crypto.subtle.digest(\"SHA-1\", identityKey.bytes))\n      const fingerprint = Base16.get().getOrThrow().encodeOrThrow(identity)\n\n      if (fingerprint.toLowerCase() !== cert.fingerprint.toLowerCase())\n        throw new Error(`Fingerprint mismatch`)\n\n      const signed = Bytes.fromUtf8(cert.preimage)\n      const hashed = new Uint8Array(await crypto.subtle.digest(\"SHA-1\", signed))\n\n      const algorithmAsn1 = ASN1.ObjectIdentifier.create(undefined, OIDs.keys.rsaEncryption).toDER()\n      const algorithmId = new X509.AlgorithmIdentifier(algorithmAsn1, ASN1.Null.create().toDER())\n      const subjectPublicKey = ASN1.BitString.create(undefined, 0, identityKey.bytes).toDER()\n      const subjectPublicKeyInfo = new X509.SubjectPublicKeyInfo(algorithmId, subjectPublicKey)\n\n      const publicKey = X509.writeToBytesOrThrow(subjectPublicKeyInfo)\n\n      using signature = Base64.get().getOrThrow().decodePaddedOrThrow(cert.signature)\n\n      using hashedM = new RsaWasm.Memory(hashed)\n      using publicKeyM = new RsaWasm.Memory(publicKey)\n      using signatureM = new RsaWasm.Memory(signature.bytes)\n\n      using publicKeyX = RsaWasm.RsaPublicKey.from_public_key_der(publicKeyM)\n      const verified = publicKeyX.verify_pkcs1v15_unprefixed(hashedM, signatureM)\n\n      if (verified !== true)\n        throw new Error(`Could not verify`)\n\n      return true\n    }\n\n    export function parseOrThrow(text: string) {\n      const lines = text.split(\"\\n\")\n\n      const items: Certificate[] = []\n\n      for (const i = { x: 0 }; i.x < lines.length; i.x++) {\n        if (lines[i.x].startsWith(\"dir-key-certificate-version \")) {\n          const start = i.x\n\n          const cert: Partial<Mutable<Certificate>> = {}\n\n          const [, version] = lines[i.x].split(\" \")\n          cert.version = Number(version)\n\n          for (i.x++; i.x < lines.length; i.x++) {\n            if (lines[i.x].startsWith(\"dir-key-certificate-version \")) {\n              i.x--\n              break\n            }\n\n            if (lines[i.x].startsWith(\"fingerprint \")) {\n              const [, fingerprint] = lines[i.x].split(\" \")\n              cert.fingerprint = fingerprint\n              continue\n            }\n\n            if (lines[i.x].startsWith(\"dir-key-published \")) {\n              const published = lines[i.x].split(\" \").slice(1).join(\" \")\n              cert.published = new Date(published)\n              continue\n            }\n\n            if (lines[i.x].startsWith(\"dir-key-expires \")) {\n              const expires = lines[i.x].split(\" \").slice(1).join(\" \")\n              cert.expires = new Date(expires)\n              continue\n            }\n\n            if (lines[i.x] === \"dir-identity-key\") {\n              i.x++\n\n              cert.identityKey = readRsaPublicKeyOrThrow(lines, i)\n              continue\n            }\n\n            if (lines[i.x] === \"dir-signing-key\") {\n              i.x++\n\n              cert.signingKey = readRsaPublicKeyOrThrow(lines, i)\n              continue\n            }\n\n            if (lines[i.x] === \"dir-key-crosscert\") {\n              i.x++\n\n              cert.crossCert = readIdSignatureOrThrow(lines, i)\n              continue\n            }\n\n            if (lines[i.x] === \"dir-key-certification\") {\n              i.x++\n              cert.preimage = lines.slice(start, i.x).join(\"\\n\") + \"\\n\"\n              cert.signature = readSignatureOrThrow(lines, i)\n              continue\n            }\n\n            continue\n          }\n\n          if (cert.version == null)\n            throw new Error(\"Missing version\")\n          if (cert.fingerprint == null)\n            throw new Error(\"Missing fingerprint\")\n          if (cert.published == null)\n            throw new Error(\"Missing published\")\n          if (cert.expires == null)\n            throw new Error(\"Missing expires\")\n          if (cert.identityKey == null)\n            throw new Error(\"Missing identityKey\")\n          if (cert.signingKey == null)\n            throw new Error(\"Missing signingKey\")\n          if (cert.crossCert == null)\n            throw new Error(\"Missing crossCert\")\n          if (cert.signature == null)\n            throw new Error(\"Missing certification\")\n\n          items.push(cert as Certificate)\n          continue\n        }\n\n        continue\n      }\n\n      return items\n    }\n\n  }\n\n  export type Microdesc =\n    & Microdesc.Head\n    & Microdesc.Body\n\n  export namespace Microdesc {\n\n    export interface Head {\n      readonly nickname: string\n      readonly identity: string\n      readonly date: string\n      readonly hour: string\n      readonly hostname: string\n      readonly orport: number\n      readonly dirport: number\n      readonly ipv6?: string\n      readonly microdesc: string\n      readonly flags: string[]\n      readonly version: string\n      readonly entries: Record<string, string>\n      readonly bandwidth: Record<string, string>\n    }\n\n    export interface Body {\n      readonly onionKey: string\n      readonly ntorOnionKey: string\n      readonly idEd25519: string\n    }\n\n    export async function fetchOrThrow(circuit: Circuit, ref: Head, signal = new AbortController().signal) {\n      const stream = await circuit.openDirOrThrow({}, signal)\n      const response = await fetch(`http://localhost/tor/micro/d/${ref.microdesc}.z`, { stream: stream.outer, signal })\n\n      if (!response.ok)\n        throw new Error(`Could not fetch ${response.status} ${response.statusText}: ${await response.text()}`)\n\n      const buffer = await response.arrayBuffer()\n      const digest = new Uint8Array(await crypto.subtle.digest(\"SHA-256\", buffer))\n\n      const digest64 = Base64.get().getOrThrow().encodeUnpaddedOrThrow(digest)\n\n      if (digest64 !== ref.microdesc)\n        throw new Error(`Digest mismatch`)\n\n      const text = Bytes.toUtf8(new Uint8Array(buffer))\n      const [data] = parseOrThrow(text)\n\n      if (data == null)\n        throw new Error(`Empty microdescriptor`)\n\n      return { ...ref, ...data } as Microdesc\n    }\n\n    export function parseOrThrow(text: string) {\n      const lines = text.split(\"\\n\")\n\n      const items: Body[] = []\n\n      for (const i = { x: 0 }; i.x < lines.length; i.x++) {\n        if (lines[i.x] === \"onion-key\") {\n          i.x++\n\n          const item: Partial<Mutable<Body>> = {}\n          item.onionKey = readRsaPublicKeyOrThrow(lines, i)\n\n          for (i.x++; i.x < lines.length; i.x++) {\n            if (lines[i.x] === \"onion-key\") {\n              i.x--\n              break\n            }\n\n            if (lines[i.x].startsWith(\"ntor-onion-key \")) {\n              const [, ntorOnionKey] = lines[i.x].split(\" \")\n              item.ntorOnionKey = ntorOnionKey\n              continue\n            }\n\n            if (lines[i.x].startsWith(\"id ed25519 \")) {\n              const [, , idEd25519] = lines[i.x].split(\" \")\n              item.idEd25519 = idEd25519\n              continue\n            }\n\n            continue\n          }\n\n          if (item.onionKey == null)\n            throw new Error(\"Missing onion-key\")\n          if (item.ntorOnionKey == null)\n            throw new Error(\"Missing ntor-onion-key\")\n          if (item.idEd25519 == null)\n            throw new Error(\"Missing id ed25519\")\n\n          items.push(item as Body)\n          continue\n        }\n\n        continue\n      }\n\n      return items\n    }\n\n  }\n\n}\n\nfunction readRsaPublicKeyOrThrow(lines: string[], i: { x: number }) {\n  if (lines[i.x] !== \"-----BEGIN RSA PUBLIC KEY-----\")\n    throw new Error(\"Missing BEGIN RSA PUBLIC KEY\")\n\n  let text = \"\"\n\n  for (i.x++; i.x < lines.length; i.x++) {\n    if (lines[i.x] === \"-----END RSA PUBLIC KEY-----\")\n      return text\n    text += lines[i.x]\n  }\n\n  throw new Error(\"Missing END RSA PUBLIC KEY\")\n}\n\nfunction readSignatureOrThrow(lines: string[], i: { x: number }) {\n  if (lines[i.x] !== \"-----BEGIN SIGNATURE-----\")\n    throw new Error(\"Missing BEGIN SIGNATURE\")\n\n  let text = \"\"\n\n  for (i.x++; i.x < lines.length; i.x++) {\n    if (lines[i.x] === \"-----END SIGNATURE-----\")\n      return text\n    text += lines[i.x]\n  }\n\n  throw new Error(\"Missing END SIGNATURE\")\n}\n\nfunction readIdSignatureOrThrow(lines: string[], i: { x: number }) {\n  if (lines[i.x] !== \"-----BEGIN ID SIGNATURE-----\")\n    throw new Error(\"Missing BEGIN ID SIGNATURE\")\n\n  let text = \"\"\n\n  for (i.x++; i.x < lines.length; i.x++) {\n    if (lines[i.x] === \"-----END ID SIGNATURE-----\")\n      return text\n    text += lines[i.x]\n  }\n\n  throw new Error(\"Missing END ID SIGNATURE\")\n}"],"names":["Consensus","fetch","Bytes","__addDisposableResource","Base64","ASN1","OIDs","X509","RsaWasm","Base16"],"mappings":";;;;;;;;;;;AAo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