Wepin Pin Pad library for iOS. This package is exclusively available for use in iOS environments.
After signing up for Wepin Workspace, go to the development tools menu and enter the information for each app platform to receive your App ID and App Key.
- iOS 13+
- Swift 5.x
WepinPin is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'WepinPin'
import WepinPin
Before using the created instance, initialize it using the App ID and App Key.
let appKey: String = "Wepin-App-Key"
let appId: String = "Wepin-App-ID"
var wepinPin: WepinPin? = nil
let initParam = WepinPinParams(appId: appId, appKey: appKey)
wepin = WepinPin(initParam)
await wepinPin?.initialize(attributes: attributes)
attributes
<WepinPinAttributes>defaultLanguage
<String> - The language to be displayed on the widget (default: 'en'). Currently, only 'ko', 'en', and 'ja' are supported.
- <Bool>
- Returns
true
if success
- Returns
let attributes = WepinPinAttributes(language: "en")
if let res = try await wepinPin?.initialize(attributes: attributes) {
print("Successed: \(res)")
} else {
print("Failed")
}
wepinPin!.isInitialized()
The isInitialized()
method checks if the Wepin PinPad Libarary is initialized.
- <Bool> - Returns
true
if Wepin PinPad Libarary is already initialized, otherwise false.
wepinPin!.changeLanguage(language: "ko")
The changeLanguage()
method changes the language of the widget.
language
<String> - The language to be displayed on the widget. Currently, only 'ko', 'en', and 'ja' are supported.
- <Void>
wepinPin!.changeLanguage(language: "ko")
Methods and Variables can be used after initialization of Wepin PIN Pad Library.
await wepinPin!.generateRegistrationPINBlock()
Generates a pin block for registration. This method should only be used when the loginStatus is pinRequired.
- void
- <RegistrationPinBlock>
- uvd: <EncUVD> - Encrypted PIN
- b64Data <String> - Data encrypted with the original key in b64SKey
- b64SKey <String> - A key that encrypts data encrypted with the Wepin's public key.
- seqNum <Int> - optional Values to check for when using PIN numbers to ensure they are used in order.
- hint: <EncPinHint> - Hints in the encrypted PIN.
- data <String> - Encrypted hint data.
- length <String> - The length of the hint
- version <Int> - The version of the hint
- uvd: <EncUVD> - Encrypted PIN
do{
let registrationPinBlock = try await wepinPin!.generateRegistrationPINBlock()
if let registerPinBlock = registrationPinBlock {
// You need to make a Wepin RESTful API request using the received data.
}
}catch(let error){
print(error)
}
await wepinPin!.generateAuthPINBlock(3)
Generates a pin block for authentication.
count
<Int> - optional If multiple PIN blocks are needed, please enter the number to generate. If the count value is not provided, it will default to 1.
- <AuthPinBlock>
- uvdList: <List> - Encypted pin list
- b64Data <String> - Data encrypted with the original key in b64SKey
- b64SKey <String> - A key that encrypts data encrypted with the wepin's public key.
- seqNum <Int> - optional Values to check for when using PIN numbers to ensure they are used in order
- otp <String> - optional If OTP authentication is required, include the OTP.
- uvdList: <List> - Encypted pin list
do{
let authPinBlock = try await wepinPin!.generateAuthPINBlock(3)
if let authPinBlock = authPinBlock {
// You need to make a Wepin RESTful API request using the received data.
}
}catch(let error){
print(error)
}
await wepinPin!.generateChangePINBlock()
Generate pin block for changing the PIN.
- <Void>
- <ChangePinBlock>
- uvd: <EncUVD> - Encrypted PIN
- b64Data <String> - Data encrypted with the original key in b64SKey
- b64SKey <String> - A key that encrypts data encrypted with the wepin's public key.
- seqNum <Int> - optional Values to check for when using PIN numbers to ensure they are used in order
- newUVD: <EncUVD> - New encrypted PIN
- b64Data <String> - Data encrypted with the original key in b64SKey
- b64SKey <String> - A key that encrypts data encrypted with the wepin's public key.
- seqNum <Int> - optional Values to check for when using PIN numbers to ensure they are used in order
- hint: <EncPinHint> - Hints in the encrypted PIN
- data <String> - Encrypted hint data
- length <String> - The length of the hint
- version <Int> - The version of the hint
- otp <String> - optional If OTP authentication is required, include the OTP.
- uvd: <EncUVD> - Encrypted PIN
do{
let changepPinBlock = try await wepinPin!.generateChangePINBlock()
if let changepPinBlock = changePinBlock {
// You need to make a Wepin RESTful API request using the received data.
}
}catch(let error){
print(error)
}
await wepinPin!.generateAuthOTPCode()
generate OTP.
- void
- <AuthOTP>
- code <String> - optional The OTP entered by the user.
do{
let authOTPCode = try await wepinPin!.generateAuthOTPCode()
if let authOTPCode = authOTPCode {
// You need to make a Wepin RESTful API request using the received data.
}
}catch(let error){
print(error)
}
wepinPin!.finalize()
The finalize()
method finalizes the Wepin PinPad Libarary.
- void
- void
wepinPin!.finalize()
To run the example project, clone the repo, and run pod install
from the Example directory first.