> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arcane-powered.com/sdk/llms.txt
> Use this file to discover all available pages before exploring further.

# Rust API

> Public Arcane SDK functions and types for integrating with Arcane Powered from Rust.

Crate name: `arcane_sdk` (package `arcane-sdk`).

Pass your **portal public key** into APIs whose parameter is currently named `game_id`.

## Init (default launch path)

```rust theme={null}
pub fn arcane_init(game_id: &str) -> Result<OwnershipStatus, SdkError>;
```

| Function      | Description                                                              |
| ------------- | ------------------------------------------------------------------------ |
| `arcane_init` | Call at launch. Checks ownership unless cached `drm_enabled` is `false`. |

```rust theme={null}
const PUBLIC_KEY: &str = "pk_..."; // from Arcane portal

match arcane_init(PUBLIC_KEY)? {
    OwnershipStatus::Owned | OwnershipStatus::DrmDisabled => { /* continue */ }
}
```

## Advanced ownership helpers

Most games only need `arcane_init`. These are for custom flows:

```rust theme={null}
pub fn check_ownership_offline(game_id: &str) -> Result<OwnershipStatus, SdkError>;
pub fn verify_ticket(
    jwt: &str,
    expected_game: &str,
    expected_device_hash: &str,
) -> Result<OwnershipTicketClaims, SdkError>;
```

| Function                  | Description                                              |
| ------------------------- | -------------------------------------------------------- |
| `check_ownership_offline` | Force offline ticket verification                        |
| `verify_ticket`           | Verify a raw JWT against portal public key + device hash |

## Device and paths

```rust theme={null}
pub fn device_hash() -> Result<String, SdkError>;
pub fn machine_id() -> Result<String, SdkError>;
pub fn drm_data_root() -> Result<PathBuf, String>;
pub fn ticket_path(user_id: &str, game_id: &str) -> Result<PathBuf, String>;
pub fn load_ticket_file(game_id: &str) -> Result<CachedTicketFile, SdkError>;
pub fn load_cached_drm_flag(game_id: &str) -> Option<bool>;
```

## Types

```rust theme={null}
pub enum OwnershipStatus {
    Owned,
    DrmDisabled,
}

pub struct OwnershipTicketClaims {
    pub sub: String,
    pub gid: String, // portal public key
    pub own: bool,
    pub iat: i64,
    pub nbf: i64,
    pub exp: i64,
    pub jti: String,
    pub dev: String,
    pub ver: i64,
    // …
}
```

See [Errors](/sdk/sdk/concepts/errors) and [Ownership model](/sdk/sdk/concepts/ownership).

## Crate types

```toml theme={null}
crate-type = ["cdylib", "rlib", "staticlib"]
```

Use `rlib` from Rust games; link `cdylib` / `staticlib` for the [C ABI](/sdk/sdk/reference/c-abi).
