import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# `OctetSdk`

The handle returned by [`Octet.start(...)`](/docs/api-reference/octet-start/). Holds the predicate surface (`loc`) and a snapshot of license state (`licenseStatus`).

## Shape

<Tabs groupId="platform">
  <TabItem value="swift" label="Swift (iOS)">

```swift
public final class OctetSdk: @unchecked Sendable {
    public let loc: OctetLoc
    public internal(set) var licenseStatus: LicenseStatus?
}
```

  </TabItem>
  <TabItem value="kotlin" label="Kotlin (Android)">

```kotlin
class OctetSdk {
    val loc: OctetLoc
    var licenseStatus: LicenseStatus?
        internal set
}
```

  </TabItem>
</Tabs>

`licenseStatus` is optional in the type. Callers that obtained `sdk` via `Octet.start(...)` always see a non-nil value, since `start` attaches it before returning.

## `loc`. The predicate surface.

`OctetSdk.loc` is the only way to issue a predicate query. See [Predicates](/docs/api-reference/predicates/) for `isWithin`, `isOutside`, `contains`.

## `licenseStatus`. Current license snapshot.

Read synchronously at any time. See [License Types](/docs/api-reference/license-types/) for the field shape.

<Tabs groupId="platform">
  <TabItem value="swift" label="Swift (iOS)">

```swift
if let status = sdk.licenseStatus {
    print("\(status.state): \(status.daysUntilHardStop ?? -1) days left")
}
```

  </TabItem>
  <TabItem value="kotlin" label="Kotlin (Android)">

```kotlin
sdk.licenseStatus?.let { status ->
    println("${status.state}: ${status.daysUntilHardStop ?: -1} days left")
}
```

  </TabItem>
</Tabs>

## Lifecycle notes

- The SDK does not expose a `stop()` or `shutdown()` at v1. The proof pipeline runs for the lifetime of the process. The system shuts it down with the process.
- Calling `Octet.start(...)` a second time within the same process is not supported in v1. Hold the first `OctetSdk` for as long as you need predicates.
- `OctetSdk` is `Sendable` (Swift) and thread-safe to use from any coroutine context (Kotlin). The predicates serialize internally.

## See also

- [`Octet.start(...)`](/docs/api-reference/octet-start/). How to obtain an `OctetSdk`.
- [Predicates](/docs/api-reference/predicates/). The methods on `sdk.loc`.
- [`OctetVerdict`](/docs/api-reference/octet-verdict/). What predicates return.
