<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/AddOnionResponse",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor16AddOnionResponseV"
  },
  "title" : "AddOnionResponse"
}
-->

# AddOnionResponse

Decoded fields of an `ADD_ONION` success reply
(control-spec.txt §3.27).

```
struct AddOnionResponse
```

## Overview

Tor emits `ServiceID=<id>` on success, optionally followed by a
`PrivateKey=<type>:<blob>` line when the command was issued
**without** the `DiscardPK` flag. This struct carries just those
two fields; higher-level code wraps them into an [`OnionService`](/documentation/Tor/OnionService)
value along with a creation timestamp.

> Note: Conformance is `Sendable` + `Equatable`.

> Important: ``doc://Tor/documentation/Tor/AddOnionResponse/privateKey`` is secret material. Never log or
> serialise it unprotected — see ``doc://Tor/documentation/Tor/OnionService/privateKey`` for
> storage guidance.

## Topics

### Fields

[`serviceID`](/documentation/Tor/AddOnionResponse/serviceID)

The v3 service ID (56-char base32, no `.onion` suffix).

[`privateKey`](/documentation/Tor/AddOnionResponse/privateKey)

The private key blob, or `nil` when `DiscardPK` was set.

### Creating

[`init(serviceID:privateKey:)`](/documentation/Tor/AddOnionResponse/init(serviceID:privateKey:))

Memberwise initialiser. Typically invoked by
[`parseAddOnionResponse(_:)`](/documentation/Tor/ControlProtocolParser/parseAddOnionResponse(_:)-rg89).

