# Core Methods

## Authentication

| Method                            | Description                                           |
| --------------------------------- | ----------------------------------------------------- |
| `tiun.login()`                    | Open the login overlay.                               |
| `tiun.logout()`                   | Clear the user session.                               |
| `tiun.getUser()`                  | Get the current user state.                           |
| `tiun.getUserVerificationToken()` | Get a signed token for server-side user verification. |

***

## Checkout (Subscriptions)

| Method                         | Description                                        |
| ------------------------------ | -------------------------------------------------- |
| `tiun.checkout({ productId })` | Open the checkout flow for a subscription product. |

***

## Time-based

| Method         | Description                                      |
| -------------- | ------------------------------------------------ |
| `tiun.start()` | Open the connect overlay for time-based billing. |

***

## Content & Access

| Method                     | Description                         |
| -------------------------- | ----------------------------------- |
| `tiun.setContent(options)` | Update the current content context. |

***

## Lifecycle

| Method                       | Description                                                |
| ---------------------------- | ---------------------------------------------------------- |
| `tiun.init(config)`          | Initialize the SDK. Call once at startup.                  |
| `tiun.destroy()`             | Destroy the SDK instance and clean up all listeners.       |
| `tiun.waitForReady()`        | Returns a Promise that resolves when the snippet is ready. |
| `tiun.on(event, callback)`   | Subscribe to an event. Returns an unsubscribe function.    |
| `tiun.once(event, callback)` | Subscribe to an event once.                                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tiun.io/sdk/reference/core-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
