> ## Documentation Index
> Fetch the complete documentation index at: https://bkey.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Configure PIN length and the requirePin gate via BmoniEmbeddedSdk.initialize.

`BmoniEmbeddedSdk.initialize` accepts two optional parameters. You can call it as many times as needed — each call replaces the active configuration.

```dart theme={null}
BmoniEmbeddedSdk.initialize(
  pinLength: 6,     // default
  requirePin: true, // default
);
```

***

## Parameters

| Parameter    | Type   | Default | Description                                                                                                                                                     |
| ------------ | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pinLength`  | `int`  | `6`     | Number of characters required for a valid PIN. Enforced by `setPin` and `changePin`.                                                                            |
| `requirePin` | `bool` | `true`  | When `true`, `signMessage`, `signTransactionHash`, and `deleteWallet` verify the supplied PIN against the stored digest before forwarding to the native plugin. |

***

## Reading the active config

The current configuration is always accessible:

```dart theme={null}
final BmoniEmbeddedSdkConfig config = BmoniEmbeddedSdk.config;

// Convenience getters:
final int length  = BmoniEmbeddedSdk.pinLength;   // 6
final bool gated  = BmoniEmbeddedSdk.requirePin;  // true
```

Use these in your UI to render a PIN input of the right length or hide PIN flows entirely.

***

## `requirePin: false` — delegating auth elsewhere

When you manage authentication outside the SDK (biometrics, OS lockscreen, server-side challenge), set `requirePin: false`:

```dart theme={null}
BmoniEmbeddedSdk.initialize(requirePin: false);

await BmoniEmbeddedSdk.initWallet();
final sig = await BmoniEmbeddedSdk.signMessage('hi'); // no pin argument needed
```

<Warning>
  When `requirePin` is `false`, **any supplied `pin` argument is silently ignored** by `signMessage`, `signTransactionHash`, and `deleteWallet`. PIN management methods (`setPin`, `changePin`, etc.) still work — toggling `requirePin` only changes whether the stored PIN is used as a gate.
</Warning>

***

## Changing the PIN length at runtime

You can change `pinLength` after a PIN is already set. However, the stored digest was created with the old length — you will need to prompt the user to remove and re-create their PIN for verification to succeed.

```dart theme={null}
// Before:
BmoniEmbeddedSdk.initialize(pinLength: 6);
await BmoniEmbeddedSdk.setPin('123456');

// After changing length:
BmoniEmbeddedSdk.initialize(pinLength: 4);
// Old 6-digit PIN no longer matches the new length constraint.
// Prompt the user to removePin + setPin with a 4-digit value.
```
