Skip to content

bladeX iOS API list

eshangui edited this page Oct 23, 2018 · 6 revisions

bladeX iOS API list

All APIs will return ONLY PAEW_RET_SUCCESS on success.

Device defination ref

API static defination ref

Error code ref

0.Device Callback Functions

0.1 Enum callback

This callback will notify a new bladeX device is found during bluetooth scanning.

Definition:

typedef int(*tFunc_EnumCallback)(const char *szDevName, int nRSSI, int nState);

This callback should always return PAEW_RET_SUCCESS.

Parameters:

Name Type Introduce
szDevName const char * IN: the name of the device which had just been found
nRSSI int IN: the RSSI of the device
nState int IN: the state of the device, see CBPeripheralState for more details

0.2 Battery callback

This callback will notify battery source and battery state in every 6 seconds when bladeX is idle.

Definition:

typedef int(*tFunc_BatteryCallback)(const int nBatterySource, const int nBatteryState);

This function should always return PAEW_RET_SUCCESS.

Parameters:

Name Type Introduce
nBatterySource int IN: current battery source, 0 for external power source, 1 for battery
nBatteryState int IN: current balltery level of baldeX

0.3 Disconnected callback

Definition:

typedef int(*tFunc_DisconnectedCallback)(const int status, const char *description);

This function should always return PAEW_RET_SUCCESS.

Parameters:

Name Type Introduce
status int IN: error code
description const char * IN: error description

0.4 EnumContext struct

Additonal context for PAEW_GetDeviceListWithDevContext

Definition:

typedef struct _enumContext {
    int timeout;
    char searchName[100];
    tFunc_EnumCallback enumCallBack;
} EnumContext, *pEnumContext;

Parameters:

Name Type Introduce
timeout int bluetooth scan timeout, default value is 5 if it is set to 0
searchName char[100] partial or full name of target device, could be a empty string
enumCallBack tFunc_EnumCallback enum call back, will be called every time when a new device is found

0.5 ConnectContext struct

Additonal context for PAEW_InitContextWithDevNameAndDevContext

Definition:

typedef struct _connectContext{
    int timeout;
    tFunc_BatteryCallback batteryCallBack;
    tFunc_DisconnectedCallback disconnectedCallback;
} ConnectContext, *pConnectContext;

Parameters:

Name Type Introduce
timeout int bluetooth connect timeout, default value is 5 if it is set to 0
batteryCallBack tFunc_tFunc_BatteryCallbackGetPIN battery status call back, will be called every 6 seconds while device is idle
disconnectedCallback tFunc_DisconnectedCallback disconnectd call back, will be called when device is disconnected

1.Sign Callback Functions

1.1 GetAuthType

Definition:

typedef int(*tFunc_GetAuthType)(void * const pCallbackContext, unsigned char * const pnAuthType);

this function may returns one of two return values: PAEW_RET_SUCCESS and PAEW_RET_DEV_OP_CANCEL

Parameters:

Name Type Introduce
pCallbackContext void* const IN/OUT: callback parameter passed to callback function
pnAuthType unsigned char * const OUT: should be PAEW_SIGN_AUTH_TYPE_XXX when callback successfully returned

1.2 GetPIN

Definition:

typedef int(*tFunc_GetPIN)(void * const pCallbackContext, unsigned char * const pbPIN, size_t * const pnPINLen);

this function may returns one of two return values: PAEW_RET_SUCCESS and PAEW_RET_DEV_OP_CANCEL

Parameters:

Name Type Introduce
pCallbackContext void* const IN/OUT: callback parameter passed to callback function
pbPIN unsigned char * const OUT: PIN data should be passed to device later
pnPINLen size_t * const OUT: Length of PIN data

1.3 PutSignState

Definition:

typedef int(*tFunc_PutSignState)(void * const pCallbackContext, const int nSignState);

Parameters:

Name Type Introduce
pCallbackContext void* const IN/OUT: callback parameter passed to callback function
nSignState const int IN: current sign state when trying to get sign result, this value can be used to render UI

1.4 PutSignState

Definition:

typedef struct _signCallbacks {
  	tFunc_GetAuthType	getAuthType;
	tFunc_GetPIN		getPIN;
	tFunc_PutSignState	putSignState;
} signCallbacks;

Parameters:

Name Type Introduce
getAuthType tFunc_GetAuthType tFunc_GetAuthType when sign function is invoked, getAuthType is called firstly, to get authenticate type which user chose or set by app, and should return PAEW_SIGN_AUTH_TYPE_XXX by pnAuthType
getPIN tFunc_GetPIN if pnAuthType is PAEW_SIGN_AUTH_TYPE_PIN, this function is called to let app inject PIN value to sign procedure
putSignState tFunc_PutSignState this function is called multiple times when waiting for sign procedure is completed, sign state can be one of the values of PAEW_RET_XXXX

1.5 The sequence of calling of callback functions:

  1. Call getAuthType, which returns PAEW_RET_SUCCESS or PAEW_RET_DEV_OP_CANCEL. If PAEW_RET_SUCCESS is returned, signature procedure goes on.
  2. If user selected PAEW_SIGN_AUTH_TYPE_PIN, then getPIN is called to get PIN code, which returns PAEW_RET_SUCCESS or PAEW_RET_DEV_OP_CANCEL. If PAEW_RET_SUCCESS is returned, signature procedure goes on.
  3. Do signature using user selected authenticate method.
  4. If signature procedure returns error code, and authenticate method is not PAEW_SIGN_AUTH_TYPE_PIN, then getPIN is called to get PIN code. Then, signature is invoked again using PAEW_SIGN_AUTH_TYPE_PIN authenticate.
if (PAEW_RET_SUCCESS != getAuthType (&nAuthType)) {
    return;
}

if (PAEW_SIGN_AUTH_TYPE_PIN == nAuthType) {
    if (PAEW_RET_SUCCESS != getPIN (szPIN)) {
        return;
    }
}

nResult = (do signature with user selected authenticate type (finger print or PIN))

if ((PAEW_RET_SUCCESS != nResult) && (PAEW_SIGN_AUTH_TYPE_PIN != nAuthType)) {
    if (PAEW_RET_SUCCESS != getPIN (szPIN)) {
        return;
    }
    (do signature with PIN authority)
}

2. Common functions

2.1 Get Library Version

Definition:

int EWALLET_API PAEW_GetLibraryVersion(unsigned char * const pbVersion, size_t * const pnVersionLen);

Parameters:

Name Type Introduce
pbVersion unsigned char * const OUT: buffer to store library version, defined as follows:
PA_VERSION_PRODUCT || PA_VERSION_RESERVED || PA_VERSION_MAJOR || PA_VERSION_MINOR
and value of PA_VERSION_PRODUCT could be:
PA_PRODUCT_WOOKONG 1
PA_PRODUCT_TIDE 2
pnVersionLen size_t * const OUT: length of version data

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.2 Get Device List (using device context and device type)

Definition:

int EWALLET_API PAEW_GetDeviceListWithDevContext(const unsigned char nDeviceType, char * const szDeviceNames, size_t * const pnDeviceNameLen, size_t * const pnDevCount, void * const pDevContext, const size_t nDevContextLen);

Parameters:

Name Type Introduce
nDeviceType unsigned char * const IN: Device Type, valid values are PAEW_DEV_TYPE_XXX
szDeviceNames char * const OUT: Buffer used to store device name list when this function succeeds. Format of name list is: devName1 + \0 + devName2 + \0 + ... + devNameN + \0\0
pnDeviceNameLen size_t * const IN/OUT: this value represents size of szDevNames when input, and represents valid length of name list when output, should not be NULL
pnDevCount size_t * const OUT: device count
pDevContext void * const IN/OUT: device context
nDevContextLen const size_t IN: device context length

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.3 Initialize context (using device name)

Definition:

int EWALLET_API PAEW_InitContextWithDevName(void ** const ppPAEWContext, const char * const szDeviceName, const unsigned char nDeviceType, const tFunc_Proc_Callback pProcCallback, callback_param * const pCallbackParam);

Parameters:

Name Type Introduce
ppPAEWContext void ** const OUT: address used to store the value of address used to record initialized context, shouldn’t be NULL, and must be passed to PAEW_FreeContext to free memory when not used anymore
szDeviceName char * const IN: device name composed by 3 parts (could be found in node-usb usb detection procedure): “busNumber:deviceAddress:interfaceNumber”, formatted in “%04x:%04x:%02x” , or Bluetooth address in format of “xx:xx:xx:xx”
nDeviceType size_t * const IN: Device Type, valid values are: PAEW_DEV_TYPE_XXX
pProcCallback const tFunc_Proc IN: callback function used to watch on processes in functions
pCallbackParam size_t * const IN: callback parameter

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.4 Initialize context

Definition:

int EWALLET_API PAEW_InitContext(void ** const ppPAEWContext, size_t * const pnDevCount, const tFunc_Proc_Callback pProcCallback, callback_param * const pCallbackParam);

Parameters:

Name Type Introduce
ppPAEWContext void ** const OUT: address used to store the value of address used to record initialized context, shouldn’t be NULL, and must be passed to PAEW_FreeContext to free memory when not used anymore
pnDevCount size_t * const OUT: count of devices connected
pProcCallback const tFunc_Proc IN: callback function used to watch on processes in functions
pCallbackParam size_t * const IN: callback parameter

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.5 Set Device Context

Definition:

int EWALLET_API PAEW_SetDevContext(void * const pPAEWContext, const size_t nDevIndex, void * const pDevContext, const size_t nDevContextLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pDevContext void * const IN/OUT: Device context
nDevContextLen const size_t IN: Device context length

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.6 Get Device Context

Definition:

int EWALLET_API PAEW_GetDevContext(void * const pPAEWContext, const size_t nDevIndex, void ** const ppDevContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, if range of value is [0, nDevCount-1], set target device context; and if value is INVALID_DEV_INDEX, set all device context
pDevContext void * const OUT: pointer pointed to address of device context

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.7 Free Context

Definition:

int EWALLET_API PAEW_FreeContext(void * const pPAEWContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.8 Get device info of specific device

Definition:

int EWALLET_API PAEW_GetDevInfo(void * const pPAEWContext, const size_t nDevIndex, const uint32_t nDevInfoType, PAEW_DevInfo * const pDevInfo);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nDevInfoType const uint32_t IN: device info types user want to get, valid values should be ORs of PAEW_DEV_INFOTYPE_XXX
pDevInfo PAEW_DevInfo * const OUT: device info returned when function success, shouldn’t be NULL

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.9 Generate seed to initialize device

NOT SUPPORTED ON bladeX

2.10 (Used only by personal device) Import mnemonics to generate seed and initialize device

NOT SUPPORTED ON bladeX

2.11 Get private key from seed and derive path (implemented by software)

Definition:

int EWALLET_API PAEW_GetTradeAddressFromSeed(const unsigned char * const pbSeed, const size_t nSeedLen, const uint32_t * const puiDerivePath, const size_t nDerivePathLen, unsigned char * const pbPrivateKey, size_t * const pnPrivateKeyLen, const unsigned char bTestNet, const unsigned char nCoinType, unsigned char * const pbTradeAddress, size_t * const pnTradeAddressLen);

Parameters:

Name Type Introduce
pbSeed const unsigned char * const IN: buffer contains seed
nSeedLen const size_t IN: length of seed contained in buffer
puiDerivePath const uint32_t * const IN: derive path, shouldn’t be NULL, and first element must be 0, indicating m (from seed to master private key)
pbPrivateKey unsigned char * const IN: count of derive path elements, no less than 1
pnPrivateKeyLen size_t * const IN/OUT: contains size of pbPrivateKey as input, and contains actual length of private key as output
bTestNet const unsigned char IN: if need address value, 0 means formal net, and other value means test net
nCoinType const unsigned char IN: if need address value, coin type must be PAEW_COIN_TYPE_XXX
pbTradeAddress unsigned char * const OUT: if need address value, this means coin address restored from seed and derive path, ; if don’t need address, must be NULL
pnTradeAddressLen size_t * const IN/OUT: contains size of pbTradeAddress as input, and contains actual length of address as output; if don’t need address, should be NULL

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.12 (Used only by personal device) Restore seed from mnemonics (implemented by software)

NOT SUPPORTED ON bladeX

2.13 (Used only by dragonball device) Restore mnemonic (same format with personal device) from mnemonics (implemented by software)

NOT SUPPORTED ON bladeX

2.14 Restore trade address from derive path

Definition:

int EWALLET_API PAEW_DeriveTradeAddress(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nCoinType, const uint32_t * const puiDerivePath, const size_t nDerivePathLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const OUT: address used to store the value of address used to record initialized context, shouldn’t be NULL, and must be passed to PAEW_FreeContext to free memory when not used anymore
nDevIndex const size_t IN: (used only by personal device) index of device, valid range of value is [0, nDevCount-1]
nCoinType const unsigned char IN: IN: coin type (PAEW_COIN_TYPE_XXX)
puiDerivePath const uint32_t * const IN: derive path, shouldn’t be NULL, and first element must be 0, indicating m (from seed to master private key)
nDerivePathLen const size_t IN: count of derive path elements, no less than 1

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.15 Get coin address (called after PAEW_DeriveTradeAddress)

Definition:

int EWALLET_API PAEW_GetTradeAddress(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nCoinType , const unsigned char nShowOnScreen, unsigned char * const pbTradeAddress, size_t * const pnTradeAddressLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nCoinType const unsigned char IN: coin type (PAEW_COIN_TYPE_XXX)
nShowOnScreen const unsigned char IN: if address be shown on screen, 0 means not to show, and non-zero value means show on screen
pbTradeAddress unsigned char * const OUT: buffer contains coin address, shouldn’t be NULL
pnTradeAddressLen size_t * const IN/OUT: contains size of pbTradeAddress as input, and contains actual length of address as output

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.16 BTC signature (called after PAEW_DeriveTradeAddress)

Definition:

int EWALLET_API PAEW_BTC_TXSign(void * const pPAEWContext, const size_t nDevIndex, const size_t nUTXOCount, const unsigned char * const * const ppbUTXO, const size_t * const pnUTXOLen, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const * const ppbTXSig, size_t * const pnTXSigLen);

int EWALLET_API PAEW_BTC_TXSign_Ex(void * const pPAEWContext, const size_t nDevIndex, const size_t nUTXOCount, const unsigned char * const * const ppbUTXO, const size_t * const pnUTXOLen, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const * const ppbTXSig, size_t * const pnTXSigLen, const signCallbacks * const pSignCallbacks, void * const pSignCallbackContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nUTXOCount const size_t IN: count of UTXOs, must equal to input number of transaction to be singed
ppbUTXO const unsigned char * const * const IN: each of which contains 1 UTXO data
pnUTXOLen const size_t * const IN: each of which contains length of UTXO data corresponding to the same position of ppbUTXO
pbCurrentTX const unsigned char * const IN: transaction data to be signed
nCurrentTXLen const size_t IN: length of transaction data to be signed
ppbTXSig unsigned char * const * const OUT: contains DER encoded signature data, each of which corresponds to one input of transaction data, and element count is the same to input count if shouldn’t be NULL
pnTXSigLen size_t * const IN/OUT: contains size of buffer corresponding to the same position of ppbTXSig as input, and contains actual lengths of signature data as output
pSignCallbacks const signCallbacks * const IN: callbacks called during sign procedure, getAuthType is called firstly, and getPIN is called if getAuthType returned PIN, and putSignState is called many times when middleware looping to get sign result
pSignCallbackContext void * const IN/OUT: context passed to sign callbacks when these callbacks are invoked

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.17 ETH signature (called after PAEW_DeriveTradeAddress)

Definition:

int EWALLET_API PAEW_ETH_TXSign(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen);

int EWALLET_API PAEW_ETH_TXSign_Ex(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen, const signCallbacks * const pSignCallbacks, void * const pSignCallbackContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbCurrentTX const unsigned char * const IN: transaction data to be signed
nCurrentTXLen const size_t IN: length of transaction data to be signed
ppbTXSig unsigned char * const * const OUT: contains DER encoded signature data, each of which corresponds to one input of transaction data, and element count is the same to input count if shouldn’t be NULL
pnTXSigLen size_t * const IN/OUT: contains size of buffer corresponding to the same position of ppbTXSig as input, and contains actual lengths of signature data as output
pSignCallbacks const signCallbacks * const IN: callbacks called during sign procedure, getAuthType is called firstly, and getPIN is called if getAuthType returned PIN, and putSignState is called many times when middleware looping to get sign result
pSignCallbackContext void * const IN/OUT: context passed to sign callbacks when these callbacks are invoked

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.18 ETC signature (called after PAEW_DeriveTradeAddress)

Will support on bladeX in the future

2.19 CYB signature (called after PAEW_DeriveTradeAddress)

Definition:

int EWALLET_API PAEW_CYB_TXSign(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen);

int EWALLET_API PAEW_CYB_TXSign_Ex(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen, const signCallbacks * const pSignCallbacks, void * const pSignCallbackContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbCurrentTX const unsigned char * const IN: transaction data to be signed
nCurrentTXLen const size_t IN: length of transaction data to be signed
ppbTXSig unsigned char * const * const OUT: contains signature data, R(32 byte) + S(32byte) + V(1 byte), shouldn’t be NULL
pnTXSigLen size_t * const IN/OUT: contains size of buffer corresponding to the same position of ppbTXSig as input, and contains actual lengths of signature data as output
pSignCallbacks const signCallbacks * const IN: callbacks called during sign procedure, getAuthType is called firstly, and getPIN is called if getAuthType returned PIN, and putSignState is called many times when middleware looping to get sign result
pSignCallbackContext void * const IN/OUT: context passed to sign callbacks when these callbacks are invoked

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.20 EOS signature (called after PAEW_DeriveTradeAddress)

Definition:

int EWALLET_API PAEW_EOS_TXSign(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen);

int EWALLET_API PAEW_EOS_TXSign_Ex(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbCurrentTX, const size_t nCurrentTXLen, unsigned char * const pbTXSig, size_t * const pnTXSigLen, const signCallbacks * const pSignCallbacks, void * const pSignCallbackContext);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbCurrentTX const unsigned char * const IN: transaction data to be signed
nCurrentTXLen const size_t IN: length of transaction data to be signed
ppbTXSig unsigned char * const * const OUT: contains signature data, already encoded by EOS encoder
pnTXSigLen size_t * const IN/OUT: contains size of buffer of pbTXSig as input, and contains actual length of signature data as output
pSignCallbacks const signCallbacks * const IN: callbacks called during sign procedure, getAuthType is called firstly, and getPIN is called if getAuthType returned PIN, and putSignState is called many times when middleware looping to get sign result
pSignCallbackContext void * const IN/OUT: context passed to sign callbacks when these callbacks are invoked

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.21 EOS transaction string (JSON) serialization (implemented by software)

Definition:

int EWALLET_API PAEW_EOS_TX_Serialize(const char * const szTransactionString, unsigned char * const pbTransactionData, size_t * pnTransactionLen);

Parameters:

Name Type Introduce
szTransactionString const char * const IN: transaction string, ref_block_prefix field must wrapped by “” (as a string)
pbTransactionData unsigned char * const OUT: contains serialized bin data
pnTransactionLen size_t * IN/OUT: contains size of buffer of pbTransactionData as input, and contains actual length of serialized bin data as output

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.22 EOS transaction string (Json) partially serialization (implemented by software)

Only for Sabre, NOT NEEDED on bladeX

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.23 LTC signature (called after PAEW_DeriveTradeAddress)

Will support on bladeX in the future

2.24 NEO signature (called after PAEW_DeriveTradeAddress)

Will support on bladeX in the future

2.25 Clear User COS

NOT SUPPORTED ON bladeX

2.26 Change PIN

NOT SUPPORTED ON bladeX

2.27 Format Device

Definition:

int EWALLET_API PAEW_ChangePIN(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.28 (Used only by personal device)Update User COS

NOT SUPPORTED ON bladeX

2.29 (Used only by bio device) Generate Seed

Definition:

int EWALLET_API PAEW_GenerateSeed_GetMnes(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nSeedLen, unsigned char * const pbMneWord, size_t * const pnMneWordLen, size_t * const pnCheckIndex, size_t * const pnCheckIndexCount);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nSeedLen const unsigned char const unsigned char IN: length of seed corresponding to mnemonics, valid range of values is [16, 32], and must be multiples of 4
pbMneWord unsigned char * const OUT: mnemonics generated by device
pnMneWordLen size_t * const OUT: length of mnemonics generated by device
pnCheckIndex size_t * const OUT: indexes of mnemonics which used to check user
pnCheckIndexCount size_t * const OUT: count of indexes

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.30 (Used only by bio device) Check Mnemonics

Definition:

int EWALLET_API PAEW_GenerateSeed_CheckMnes(void * const pPAEWContext, const size_t nDevIndex, const unsigned char * const pbMneWord, const size_t nMneWordLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbMneWord const unsigned char * const IN: mnemonics user input to pass the check
nMneWordLen const size_t IN: mnemonic length user passed to check

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.31 (Used only by bio device) Change PIN

Definition:

int EWALLET_API PAEW_ChangePIN_Input(void * const pPAEWContext, const size_t nDevIndex, const char * const szOldPIN, const char * const szNewPIN);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
szOldPIN const char * const IN: Old PIN which need to change
szNewPIN const char * const IN: New PIN want to change to

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.32 (Used only by bio device) Initialize PIN

Definition:

int EWALLET_API PAEW_InitPIN(void * const pPAEWContext, const size_t nDevIndex, const char * const szPIN);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
szPIN const char * const IN: initial PIN set to device

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.33 (Used only by bio device) Verify PIN

Definition:

int EWALLET_API PAEW_VerifyPIN(void * const pPAEWContext, const size_t nDevIndex, const char * const szPIN);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
szPIN const char * const IN: PIN passed to verify

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.34 (Used only by bio device) Get finger print list

Definition:

int EWALLET_API PAEW_GetFPList(void * const pPAEWContext, const size_t nDevIndex, FingerPrintID * const pFPList, size_t * const pnFPListCount);

Parameters:

Name Type Introduce
ppPAEWContext void ** const OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pFPList FingerPrintID * const OUT: finger print list which is stored in device
pnFPListCount size_t * const OUT: count of finger print stored in device

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.35 (Used only by bio device) Verify finger print

Definition:

int EWALLET_API PAEW_VerifyFP(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.36 (Used only by bio device) Get verified finger print list

Definition:

int EWALLET_API PAEW_GetVerifyFPList(void * const pPAEWContext, const size_t nDevIndex, FingerPrintID * const pFPList, size_t * const pnFPListCount);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pFPList FingerPrintID * const OUT: finger print ID of verified finger
pnFPListCount size_t * const OUT: count of finger print stored in device

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.37 (Used only by bio device) Enroll finger print

Definition:

int EWALLET_API PAEW_EnrollFP(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.38 (Used only by bio device) Get finger print state when enroll or verify finger print

Definition:

int EWALLET_API PAEW_GetFPState(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.39 (Used only by bio device) Abort enrollment or verify of finger print

Definition:

int EWALLET_API PAEW_AbortFP(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.40 (Used only by bio device) Delete finger print

Definition:

int EWALLET_API PAEW_DeleteFP(void * const pPAEWContext, const size_t nDevIndex, const FingerPrintID * const pFPID, const size_t nFPCount);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pFPList FingerPrintID * const IN: finger print ID of deleted finger, delete all finger prints when this variable is 0
pnFPListCount size_t * const OUT: count of finger print stored in device

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.41 (Used only by bio device) Calibrate finger print sensor

Definition:

int EWALLET_API PAEW_CalibrateFP(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.42 Initialize context (using device name and device context)

Definition:

int EWALLET_API PAEW_InitContextWithDevNameAndDevContext(void ** const ppPAEWContext, const char * const szDeviceName, const unsigned char nDeviceType, void * const pDevContext, const size_t nDevContextLen, const tFunc_Proc_Callback pProcCallback, callback_param * const pCallbackParam);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
szDeviceName const char * const IN: device name composed by 3 parts (could be found in node-usb usb detection procedure): “busNumber:deviceAddress:interfaceNumber”, formatted in “%04x:%04x:%02x”, or Bluetooth address in format of “xx:xx:xx:xx”
nDeviceType const unsigned char IN: Device Type, valid values are:
PAEW_DEV_TYPE_XXX
pDevContext void * const IN/OUT: Device context
nDevContextLen const size_t IN: Device context length
pProcCallback const tFunc_Proc_Callback IN: callback function used to watch on processes in functions
pCallbackParam callback_param * const IN: callback parameter

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.43 Get client config data

Only for Sabre, NOT NEEDED on bladeX

2.44 (Used only by bio device) Clear device screen

Definition:

int EWALLET_API PAEW_PowerOff(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.45 (Used only by bio device) Turn off power of the device

Definition:

int EWALLET_API PAEW_PowerOff(void * const pPAEWContext, const size_t nDevIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
Return Values:
Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.46 Get device check code

Definition:

int EWALLET_API PAEW_GetDeviceCheckCode(void * const pPAEWContext, const size_t nDevIndex, unsigned char * const pbCheckCode, size_t * const pnCheckCodeLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbCheckCode unsigned char * const OUT: buffer store check code returned from device, shouldn’t be NULL
pnCheckCodeLen size_t * const OUT: indicates byte length of pbCheckCode when input, and indicates actual length of check code returned from device

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.47 (Used only by bio device) Set Image Data

Definition:

int EWALLET_API PAEW_SetImageData(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nImageIndex, const unsigned char * const pbImageData, const size_t nImageDataLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nImageIndex const unsigned char IN: index of image, valid range of value is [0, nImageCount-1]
pbImageData const unsigned char * const IN: image data, processed by PAEW_ConvertBMP
nImageDataLen const size_t IN: length of pbImageData

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.48 (Used only by bio device) Show Image on Screen

Definition:

int EWALLET_API PAEW_ShowImage(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nImageIndex, const unsigned char nLCDMode);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
nImageIndex const unsigned char IN: index of image, valid range of value is [0, nImageCount-1]
nLCDMode const unsigned char IN: refresh mode of screen, vlid values are PAEW_LCD_XXX

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.49 (Used only by bio device) Set Image as Logo

Definition:

int EWALLET_API PAEW_SetLogoImage(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nImageIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pDevContext void * const IN/OUT: Device context
nImageIndex const unsigned char IN: index of image, valid range of value is [0, nImageCount-1]

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.50 (Used only by bio device) Get Image List

Definition:

int EWALLET_API PAEW_GetImageList(void * const pPAEWContext, const size_t nDevIndex, unsigned char * const pbImageIndex, size_t * const pnImageCount);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbImageIndex unsigned char * const OUT: buffer stores image list, currently must be NULL
pnImageCount size_t * const OUT: count of image that device could store

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.51 (Used only by bio device) Get Image Name

Definition:

int EWALLET_API PAEW_GetImageName(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nImageIndex, unsigned char * const pbImageName, size_t * const pnImageNameLen);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbImageName unsigned char * const OUT: buffer contains image name
pnImageNameLen size_t * const OUT: indicates size of pbImageName in byte when input, and indicates valid size of image name when output

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.52 (Used only by bio device) Set Image Name

Definition:

int EWALLET_API PAEW_SetLogoImage(void * const pPAEWContext, const size_t nDevIndex, const unsigned char nImageIndex);

Parameters:

Name Type Introduce
ppPAEWContext void ** const IN/OUT: context, shouldn’t be NULL
nDevIndex const size_t IN: index of device, valid range of value is [0, nDevCount-1]
pbImageName unsigned char * const IN: buffer contains image name
pnImageNameLen size_t * const IN: length of pbImageName, not larger than PAEW_IMAGE_NAME_MAX_LEN

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

2.53 (Used only by bio device) Convert Binary BMP data to device compatible image data

Definition:

int EWALLET_API PAEW_ConvertBMP(const unsigned char * const pbOrigImage, const size_t nOrigImageLen, const size_t nWidth, const size_t nHeight, unsigned char * const pbDestImage, size_t * const pnDestImageLen);

Parameters:

Name Type Introduce
pbOrigImage const unsigned char * const OUT: binary BMP data
nOrigImageLen const size_t OUT: length of binary BMP data
nWidth const size_t IN: width of BMP image
nHeight const size_t IN: height of BMP image
pbDestImage unsigned char * const OUT: output of conversion, and will get size of result by pnDestImageLen when NULL
pnDestImageLen size_t * const OUT: output size of pbDestImage

Return Values:

Name Introduce
PAEW_RET_SUCCESS Success
Other Refer to “Return Value”

Clone this wiki locally