# Methods

This can be used after initializing the Wepin PIN Pad Library.

## generateRegistrationPINBlock

```dart
await generateRegistrationPINBlock(BuildContext context)
```

To display the PIN pad screen to receive the PIN required for wallet creation and user registration, process the entered PIN to create a PIN Block.

### **Parameters**

* `context` \<BuildContext>\
  The **BuildContext** parameter is essential in Flutter as it represents the location of a widget in the widget tree. This context is used by Flutter to locate the widget's position in the tree and to provide various functions like navigation, accessing theme data, and more. When you call **generateRegistrationPINBlock**, you pass the current context to ensure that the widget is displayed within the correct part of the UI hierarchy.

### **Return value**

* `Future` \<RegistrationPinBlock>
  * `uvd` \<EncUVD>

    * `b64Data` \<String> \
      Data encrypted with the original key of `b64SKey`.
    * `b64SKey` \<String> \
      The key used to generate `b64Data`.
    * `seqNum` \<int> **optional** \
      A value used to verify that PIN Blocks are used in sequential order.&#x20;

  * `hint` \<EncPinHint>

    * `data` \<String> \
      &#x20;The encrypted value of the PIN hint.
    * `length` \<String>\
      The length of the PIN hint.
    * `version` \<int>&#x20;

    &#x20;      The version of the PIN hint.

### **Example**

```dart
final res = await wepinPinPad!.generateRegistrationPINBlock(context);
//You need to make a Wepin RESTful API request using the received data.
```

## &#x20;generateAuthPINBlock

```dart
await generateAuthPINBlock(BuildContext context, int? count)
```

To display the PIN pad screen to receive the PIN required for user authentication and process the entered PIN to create a PIN Block. If the user has enabled 2FA (OTP), display a screen to receive the OTP code and process it as well.

### **Parameters**

* `context` \<BuildContext>\
  The **BuildContext** parameter is essential in Flutter as it represents the location of a widget in the widget tree. This context is used by Flutter to locate the widget's position in the tree and to provide various functions like navigation, accessing theme data, and more. When you call **generateAuthPINBlock**, you pass the current context to ensure that the widget is displayed within the correct part of the UI hierarchy.
* `count` \<int> **optional**&#x20;

  The number of PIN Blocks to be generated. The default value is 1.

### **Return value**

* `Future` \<AuthPinBlock>
  * `uvdList` \<List\<EncUVD>> \
    A list of encrypted PIN Blocks.
    * \<EncUVD>
      * `b64Data` \<String> \
        Data encrypted with the original key of `b64SKey`.
      * `b64SKey` \<String> \
        The key used to generate `b64Data`.
      * `seqNum` \<int> **optional** \
        A value used to verify that PIN Blocks are used in sequential order. In a Multi Tx request, PIN Blocks must be used strictly in the received order (1, 2, 3...).
  * `otp` \<String> **optional** \
    The OTP code entered by the user if they have enabled 2FA (OTP).

### **Example**

```dart
final res = await wepinPinPad!.generateAuthPINBlock(context, 1);
// You need to make a Wepin RESTful API request using the received data.
```

## generateChangePINBlock

```dart
await generateChangePINBlock(BuildContext context)
```

To display the PIN pad screen to receive the PIN required for the user to change their PIN and process the entered PIN to create a PIN Block. If the user has enabled 2FA (OTP), display a screen to receive the OTP code and process it as well.

### **Parameters**

* `context` \<BuildContext>\
  The **BuildContext** parameter is essential in Flutter as it represents the location of a widget in the widget tree. This context is used by Flutter to locate the widget's position in the tree and to provide various functions like navigation, accessing theme data, and more. When you call **generateChangePINBlock**, you pass the current context to ensure that the widget is displayed within the correct part of the UI hierarchy.

### **Return Value**

* `Future` \<ChangePinBlock>
  * `uvd` \<EncUVD>
    * `b64Data` \<String> \
      Data encrypted with the original key of `b64SKey`.
    * `b64SKey` \<String> \
      The key used to generate `b64Data`.
    * `seqNum` \<int> **optional** \
      A value used to verify that PIN Blocks are used in sequential order.&#x20;
  * `newUVD` \<EncUVD>
    * `b64Data` \<String> \
      Data encrypted with the original key of `b64SKey`.
    * `b64SKey` \<String> \
      The key used to generate `b64Data`.
    * `seqNum` \<int> **optional** \
      A value used to verify that PIN Blocks are used in sequential order.&#x20;
  * `hint` \<EncPinHint>
    * `data` \<String> \
      &#x20;The encrypted value of the PIN hint.
    * `length` \<String>\
      The length of the PIN hint.
    * `version` \<int> \
      The version of the PIN hint.
  * `otp` \<String> **optional** \
    The OTP code entered by the user if they have enabled 2FA (OTP).

### **Example**

```dart
await wepinPinPad.generateChangePINBlock(context);
// You need to make a Wepin RESTful API request using the received data.
```

## generateAuthOTP

```dart
await generateAuthOTP(BuildContext context)
```

Display a screen to receive the OTP code from the user and process it.

### **Parameters**

* `context` \<BuildContext>\
  The **BuildContext** parameter is essential in Flutter as it represents the location of a widget in the widget tree. This context is used by Flutter to locate the widget's position in the tree and to provide various functions like navigation, accessing theme data, and more. When you call **generateAuthOTP**, you pass the current context to ensure that the widget is displayed within the correct part of the UI hierarchy.

### **Return Value**

* `Future`\<AuthOTP>
  * `code` \<String>\
    The entered OTP code.

### **Example**

```dart
await wepinPinPad.generateAuthOTP(context);
// You need to make a Wepin RESTful API request using the received data.
```

## finalize

```dart
await wepinPinPad.finalize()
```

It terminates the use of the Wepin PIN Pad Library.

### **Parameters**

* \<void>

### **Return Value**

* `Future`\<void>

### **Example**

```dart
await wepinPinPad.finalize();
```
