# @ovok/native/next

Canonical page: https://docs.ovok.com/native-sdk/reference/next

The native `Ovok` client built on `@ovok/core/next`, with secure-store token storage.

Import from `@ovok/native/next`.

## Classes [#classes]

### Ovok [#ovok]

The @ovok/core/next client with the session kept in the device's secure store.

#### Extends [#extends]

- `Ovok`

#### Constructors [#constructors]

##### Constructor [#constructor]

```ts
new Ovok(config): Ovok;
```

###### Parameters [#parameters]

| Parameter | Type |
| ------ | ------ |
| `config` | [`OvokNativeConfig`](#ovoknativeconfig) |

###### Returns [#returns]

[`Ovok`](#ovok)

###### Overrides [#overrides]

`CoreOvok.constructor`

#### Properties [#properties]

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="property-baseurl"></a> `baseUrl` | `readonly` | `string` | Base URL of the Ovok API, with a trailing slash. |
| <a id="property-storage"></a> `storage` | `readonly` | `OvokStorage` | Secure store backed session storage. |
| <a id="property-tenantcode"></a> `tenantCode` | `readonly` | `string` | Tenant code the client was configured with. |

***

### SecureStoreStorage [#securestorestorage]

Splits each value across numbered entries and keeps the count under the key itself.

#### Implements [#implements]

- `OvokStorage`

#### Constructors [#constructors-1]

##### Constructor [#constructor-1]

```ts
new SecureStoreStorage(store, options?): SecureStoreStorage;
```

###### Parameters [#parameters-1]

| Parameter | Type |
| ------ | ------ |
| `store` | [`OvokSecureStore`](#ovoksecurestore) |
| `options?` | `Record`\<`string`, `unknown`\> |

###### Returns [#returns-1]

[`SecureStoreStorage`](#securestorestorage)

#### Methods [#methods]

##### getItem() [#getitem]

```ts
getItem(key): Promise<string | null>;
```

Returns the stored value, or `null` when it is missing, incomplete or unreadable.

###### Parameters [#parameters-2]

| Parameter | Type |
| ------ | ------ |
| `key` | `string` |

###### Returns [#returns-2]

`Promise`\<`string` \| `null`\>

###### Implementation of [#implementation-of]

`OvokStorage.getItem`

##### removeItem() [#removeitem]

```ts
removeItem(key): Promise<void>;
```

Deletes the value and all of its chunks.

###### Parameters [#parameters-3]

| Parameter | Type |
| ------ | ------ |
| `key` | `string` |

###### Returns [#returns-3]

`Promise`\<`void`\>

###### Implementation of [#implementation-of-1]

`OvokStorage.removeItem`

##### setItem() [#setitem]

```ts
setItem(key, value): Promise<void>;
```

Stores the value in chunks and removes leftover chunks of the previous value.

###### Parameters [#parameters-4]

| Parameter | Type |
| ------ | ------ |
| `key` | `string` |
| `value` | `string` |

###### Returns [#returns-4]

`Promise`\<`void`\>

###### Implementation of [#implementation-of-2]

`OvokStorage.setItem`

## Interfaces [#interfaces]

### OvokSecureStore [#ovoksecurestore]

The part of expo-secure-store the storage needs; the host app passes the module in.

#### Properties [#properties-1]

| Property | Type | Description |
| ------ | ------ | ------ |
| <a id="property-deleteitemasync"></a> `deleteItemAsync` | (`key`, `options?`) => `Promise`\<`void`\> | Deletes the entry for a key. |
| <a id="property-getitemasync"></a> `getItemAsync` | (`key`, `options?`) => `Promise`\<`string` \| `null`\> | Reads the stored string for a key, or `null` when absent. |
| <a id="property-setitemasync"></a> `setItemAsync` | (`key`, `value`, `options?`) => `Promise`\<`void`\> | Stores a string under a key. |

## Type Aliases [#type-aliases]

### OvokNativeConfig [#ovoknativeconfig]

```ts
type OvokNativeConfig = Omit<UserClientConfig, "storage" | "clientSecret"> & object;
```

No clientSecret: anything shipped inside an app can be extracted from it.

#### Type Declaration [#type-declaration]

| Name | Type | Description |
| ------ | ------ | ------ |
| `getRandomValues?` | [`RandomValuesSource`](#randomvaluessource) | Fills a byte array with random values; used when the runtime has no `crypto.getRandomValues`. |
| `secureStore` | [`OvokSecureStore`](#ovoksecurestore) | The expo-secure-store module (or a compatible store) that holds the session. |
| `secureStoreOptions?` | `Record`\<`string`, `unknown`\> | Options passed to every secure store call, such as keychain accessibility. |

***

### RandomValuesSource [#randomvaluessource]

```ts
type RandomValuesSource = (array) => Uint8Array;
```

Fills the array with cryptographically secure random bytes and returns it.

#### Parameters [#parameters-5]

| Parameter | Type |
| ------ | ------ |
| `array` | `Uint8Array` |

#### Returns [#returns-5]

`Uint8Array`
