com.samsung.android.sdk.coldwallet
Class ScwService
- java.lang.Object
-
- com.samsung.android.sdk.coldwallet.ScwService
-
public class ScwService extends java.lang.Object
Class for the proxy to use the Samsung Blockchain Keystore service.The Keystore's HD Wallet seed is BIP-39 compatible
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
ScwService.ScwCheckForMandatoryAppUpdateCallback
Callback forcheckForMandatoryAppUpdate
APIstatic class
ScwService.ScwGetAddressListCallback
Callback forgetAddressList
APIstatic class
ScwService.ScwGetExtendedPublicKeyListCallback
Callback forgetExtendedPublicKeyList
APIstatic class
ScwService.ScwSignBtcTransactionCallback
Callback forsignBtcTransaction
APIstatic class
ScwService.ScwSignEthPersonalMessageCallback
Callback forsignEthPersonalMessage
APIstatic class
ScwService.ScwSignEthTransactionCallback
Callback forsignEthTransaction
APIstatic class
ScwService.ScwSignKlayTransactionCallback
Callback forsignKlayTransaction
API
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
checkForMandatoryAppUpdate(ScwService.ScwCheckForMandatoryAppUpdateCallback callback)
Checks whether a mandatory update of Samsung Blockchain Keystore is needed or not.void
getAddressList(ScwService.ScwGetAddressListCallback callback, java.util.ArrayList<java.lang.String> hdPath)
Request to get a list of addresses that corresponds to a list of HD Pathsvoid
getExtendedPublicKeyList(ScwService.ScwGetExtendedPublicKeyListCallback callback, java.util.ArrayList<java.lang.String> hdPath)
Request to get a list of extended Public Keys that corresponds to a list of HD Pathsstatic ScwService
getInstance()
Return the instance of the Keystore proxy objectint
getKeystoreApiLevel()
Get API level which the Keystore in the device supportsjava.lang.String
getSeedHash()
Get the pseudo seed hash which is randomly generated when the HD wallet created Whenever the seed for the wallet is changed, this key shall be changed.int[]
getSupportedCoins()
Get coin types supported by Samsung Blockchain Keystorevoid
signBtcTransaction(ScwService.ScwSignBtcTransactionCallback callback, byte[] transaction, java.util.List<java.lang.String> hdPathList, java.util.List<byte[]> utxoTxList, java.lang.String changeHdPath)
Request to sign Bitcoin Transactionvoid
signEthPersonalMessage(ScwService.ScwSignEthPersonalMessageCallback callback, byte[] msg, java.lang.String hdPath)
Request to sign Ethereum typed structured datavoid
signEthTransaction(ScwService.ScwSignEthTransactionCallback callback, byte[] transaction, java.lang.String hdPath)
Request to sign Ethereum transactionvoid
signKlayTransaction(ScwService.ScwSignKlayTransactionCallback callback, byte[] transaction, java.lang.String hdPath, int networkId)
Request to sign Klay Transaction
-
-
-
Method Detail
-
getInstance
public static ScwService getInstance()
Return the instance of the Keystore proxy object- Returns:
- the instance, or null if Samsung Blockchain Keystore is not available on the device
-
getKeystoreApiLevel
public int getKeystoreApiLevel()
Get API level which the Keystore in the device supportsCaution : You should check the API level before invoking any APIs. Otherwise, it will return
ScwApiLevelException
. If Keystore API level is lower than the required level, update the Keystore app first viaScwDeepLink.GALAXY_STORE
- Returns:
- API level
- Since:
- API Level 1
-
getSeedHash
public java.lang.String getSeedHash()
Get the pseudo seed hash which is randomly generated when the HD wallet created Whenever the seed for the wallet is changed, this key shall be changed.- Returns:
- null if keystore does not support wallet key, zero-length string if the wallet is not created. Otherwise, wallet is created.
- Since:
- API Level 1
-
getSupportedCoins
public int[] getSupportedCoins()
Get coin types supported by Samsung Blockchain Keystore- Returns:
- Array of coin types,
ScwCoinType
- Throws:
ScwApiLevelException
- API Level Exception- Since:
- API Level 1
- See Also:
- https://github.com/satoshilabs/slips/blob/master/slip-0044.md
-
checkForMandatoryAppUpdate
public void checkForMandatoryAppUpdate(@NonNull ScwService.ScwCheckForMandatoryAppUpdateCallback callback)
Checks whether a mandatory update of Samsung Blockchain Keystore is needed or not. Do not call this method in the background thread. If there is a mandatory update, you need to open the app update link,ScwDeepLink.GALAXY_STORE
- Parameters:
callback
- Result callback- Since:
- API Level 1
-
getExtendedPublicKeyList
public void getExtendedPublicKeyList(@NonNull ScwService.ScwGetExtendedPublicKeyListCallback callback, @NonNull java.util.ArrayList<java.lang.String> hdPath)
Request to get a list of extended Public Keys that corresponds to a list of HD Paths- Parameters:
callback
- Result callbackhdPath
- The HD Path List to bring the public keys. The depth of a path should be between 3 and 6. For example, "m/44'/60'", "m/44'/60'/0'/0/0"- Since:
- API Level 1
- See Also:
- https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
-
getAddressList
public void getAddressList(@NonNull ScwService.ScwGetAddressListCallback callback, @NonNull java.util.ArrayList<java.lang.String> hdPath)
Request to get a list of addresses that corresponds to a list of HD Paths- Parameters:
callback
- Result callbackhdPath
- The HD Path list to bring the addresses. The depth of a path should be between 3 and 6. For example, "m/44'/60'", "m/44'/60'/0'/0/0"- Since:
- API Level 1
- See Also:
- https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
-
signEthTransaction
public void signEthTransaction(@NonNull ScwService.ScwSignEthTransactionCallback callback, @NonNull byte[] transaction, @NonNull java.lang.String hdPath)
Request to sign Ethereum transaction- Parameters:
callback
- Result callbacktransaction
- A byte array of a RLP-encoded unsigned Ethereum transactionhdPath
- HD Path that corresponds to public key needed for signing- Since:
- API Level 1
-
signEthPersonalMessage
public void signEthPersonalMessage(@NonNull ScwService.ScwSignEthPersonalMessageCallback callback, @NonNull byte[] msg, @NonNull java.lang.String hdPath)
Request to sign Ethereum typed structured data- Parameters:
callback
- Result callbackmsg
- A byte array of raw message to be signed. The Keystore will add "Ethereum Signed Message:\n" prefix, so it should not be included in msg.hdPath
- HD Path that corresponds to public key needed for signing- Since:
- API Level 1
- See Also:
- https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md
-
signKlayTransaction
public void signKlayTransaction(@NonNull ScwService.ScwSignKlayTransactionCallback callback, @NonNull byte[] transaction, @NonNull java.lang.String hdPath, @NonNull int networkId)
Request to sign Klay Transaction- Parameters:
callback
- Result callbacktransaction
- A byte array of a raw transaction to be signed by Samsung Blockchain Keystore. The transaction is same as the sigRLP value mentioned in Klaytn's official document.hdPath
- HD Path that corresponds to public key needed for signingnetworkId
- the Klaytn network ID, or the integer to identify the network. "8217" is Klaytn Cypress Mainnet and "1001" is Klaytn Baobab Testnet.- Since:
- API Level 2
- See Also:
- https://docs.klaytn.com/node/en/installation/config
-
signBtcTransaction
public void signBtcTransaction(@NonNull ScwService.ScwSignBtcTransactionCallback callback, @NonNull byte[] transaction, @NonNull java.util.List<java.lang.String> hdPathList, @NonNull java.util.List<byte[]> utxoTxList, @NonNull java.lang.String changeHdPath)
Request to sign Bitcoin Transaction- Parameters:
callback
- Result callbacktransaction
- A byte array of a serialized unsigned Bitcoin transaction to be signed by Samsung Blockchain KeystorehdPathList
- A list of HD Paths that corresponds to UTXO's public keyutxoTxList
- A list of byte array of the serialized transaction which contain the UTXO used in this transactionchangeHdPath
- HD path that corresponds to the change address- Since:
- API Level 2
- See Also:
- https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki, https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki, https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki
-
-