The PIN gates signMessage, signTransactionHash, and deleteWallet when requirePin is true. It is stored only as a salted PBKDF2-HMAC-SHA256 digest (100 000 iterations) in platform secure storage — the raw PIN never touches disk.
The derivation runs in native code, so the 100 000 iterations never block the JavaScript thread.
Set a PIN
Call setPin once after wallet provisioning. The PIN must be exactly BmoniEmbeddedSdk.pinLength characters (default 6).
Throws pinAlreadySet if a PIN already exists. Check first:
Check whether a PIN is set
Verify a PIN without throwing
Use matchPin to check a PIN without raising an error. This is useful for validating a user’s entry before attempting a gated operation.
matchPin returns false when no PIN is set, so use hasPin when you need to tell “no PIN” apart from “wrong PIN”.
Change a PIN
Requires the current PIN. Both values must be pinLength characters.
changePin takes an object rather than two positional strings, so you cannot accidentally swap the current and new PIN.
Remove a PIN
Removes the stored digest entirely. After removal, hasPin() returns false and PIN-gated operations are unavailable until a new PIN is set.
PIN length enforcement
All PIN operations enforce the pinLength set in BmoniEmbeddedSdk.initialize. Passing a PIN of the wrong length throws BmoniSignerError with errorCode: pinInvalid.
Read the required length at runtime to drive your UI:
Full example