Skip to main content

Octet.start(...)

The single bring-up call. Verifies the license key locally, activates against the Octet backend if needed, brings up the proof pipeline, and returns a fully-usable OctetSdk handle.

Signature

public enum Octet {
public static let sdkVersion: String // "1.0.0-alpha"

public static func start(
config: OctetConfig,
startPosition: Position? = nil
) async throws -> OctetSdk
}

startPosition is an optional hint used internally during pipeline bring-up. Most integrators omit it.

What it does, in order

  1. Loads (or generates) a per-install UUID from secure storage (Keychain on iOS, EncryptedSharedPreferences on Android).
  2. Auto-detects the app id from the bundle (Bundle.main.bundleIdentifier / context.packageName).
  3. Verifies the license key's PASETO signature locally against the SDK's embedded public keys.
  4. Validates the cached activation token if present. Otherwise calls POST /v1/activate to acquire one.
  5. Brings up the internal proof pipeline.
  6. Attaches the resulting LicenseStatus to the returned OctetSdk.

OctetConfig

public struct OctetConfig: Sendable {
public let licenseKey: String
public var advanced: AdvancedConfig

public init(
licenseKey: String,
advanced: AdvancedConfig = AdvancedConfig()
)

public static let defaultActivationServerUrl: String // "https://api.octetproof.com"
}

licenseKey is the only required field. It is a PASETO v4.public token in the wire form octet_live_v4.public.… (prod) or octet_test_… (staging).

AdvancedConfig

Deliberately minimal at v1. Battery profile, sensor tuning, ML knobs, and attestation flags stay internal.

public struct AdvancedConfig: Sendable {
public var activationServerUrl: String // default: production
public var logLevel: LogLevel // default: .info

public init(
activationServerUrl: String = OctetConfig.defaultActivationServerUrl,
logLevel: LogLevel = .info
)
}

public enum LogLevel { case verbose, debug, info, warn, error }

Override activationServerUrl only when pointing at a staging or local backend.

Example

let config = OctetConfig(
licenseKey: "octet_live_v4.public.…"
// advanced left to defaults
)
let sdk = try await Octet.start(config: config)

Failure modes

Octet.start(...) throws a typed LicenseError for every license-related failure. Other failures propagate as their native error types. The SDK does not throw a raw Error / Exception for license reasons.

LicenseError caseMeaning
MalformedKeyThe key isn't a valid signed token.
NoActivationNo cached activation, offline.
ExpiredLicense past day 105, OR cached activation past 7-day offline grace.
ActivationWindowClosedFresh device trying to activate after day 90.
RevokedAdmin revoke.
Network(message) / Network(cause)Transient network failure during activation.
ServerRejected(httpStatus, reason)Backend rejected for another reason (e.g., app_blocked).

See also