htczion / zkma Goto Github PK
View Code? Open in Web Editor NEWZion Key Management Api
License: Other
Zion Key Management Api
License: Other
Doesn't look like I'm getting the same address derived from getReceivePublicKey(60, 0)
as is displayed in the Ethereum wallet of the Zion mobile app. Should apps built using ZKMA/ZKMS share the same keys as the Zion mobile app? Or does the unique ID/sha256 params given when registering change the derived private key used for that instance?
I think for my use case, I'd prefer to use the same account users already have (via the Zion mobile app) so the app doesn't have to deal with generating accounts and funding them to onboard users. Is that doable or not intended functionality? Any clarification on this would be appreciated.
I keep getting stuck in a weird state where neither my test app, nor the zion app will work properly. The Zion app will throw a -99999 error and my app will receive a version mismatch error -50002. Phone appears to be fully updated, Zion app (2.00.1117539), and I'm using the latest release of ZKMA(3.4.6). Here's some info I snagged from logcat:
When launching the Zion app:
.415 2606 2606 I ContextualWidget: click item=ShortcutInfo(title=Zion intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.htc.wallet/.EntryActivity bnds=[576,1988][864,2460] (has extras) } id=13 type=0 container=-100 appsContainer=<ALLAPPS> screen=1 cellX=2 cellY=4 cellZ=0 spanX=1 spanY=1 isGesture=false dropPos=null user=UserHandle{0} count=0 restored=0)
09-04 11:40:20.523 13247 13247 I ZionLog : com.htc.wallet.WalletApplication:WalletApplication bindService
09-04 11:40:20.527 13247 13247 I ZKMALog : HtcWalletSdkManager +++
09-04 11:40:20.528 13247 13247 I ZKMALog : HtcWalletSdkManager ---
09-04 11:40:20.528 13247 13247 I ZKMALog : ZionMessage +++
09-04 11:40:20.528 13247 13247 I ZKMALog : ZionMessage ---
09-04 11:40:20.536 13247 13282 I ZKMALog : init +++
09-04 11:40:20.537 13247 13282 I ZKMALog : isDeviceSupportHardwareWallet true , com.htc.hardware.wallet
09-04 11:40:20.538 13247 13282 E ZKMALog : HtcWalletSDK:3.6.6 bCA_support = false bTZ_support = true
09-04 11:40:20.538 13247 13282 I HtcWalletTZManager: HtcWalletTZManager()+
09-04 11:40:20.539 13247 13282 I HtcWalletTZManager: HtcWalletTZManager()-
09-04 11:40:20.540 13247 13282 I ZKMALog : isTempered +
09-04 11:40:20.540 1445 2053 D TEEK : isTampered()++
09-04 11:40:20.540 1445 2053 D TEEKM: : IsTampered: +++
09-04 11:40:20.540 1445 2053 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:40:20.540 1445 2053 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:40:20.551 13247 13284 I ZKMALog : init +++
09-04 11:40:20.552 13247 13284 I ZKMALog : isDeviceSupportHardwareWallet true , com.htc.hardware.wallet
09-04 11:40:20.552 13247 13284 E ZKMALog : HtcWalletSDK:3.6.6 bCA_support = false bTZ_support = true
09-04 11:40:20.552 13247 13284 I ZKMALog : isTempered +
09-04 11:40:20.625 13247 13292 W ZionLog : HTCKeyManager:Join init thread, might be stuck in SDK.
09-04 11:40:20.628 1445 2053 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:40:20.628 1445 2053 D TEEKM: : TEECmd: cmdId = 0x5
09-04 11:40:20.629 1445 2053 E TEEKM: : qsc_shutdown_app: start
09-04 11:40:20.630 1445 2053 E TEEKM: : shutdown app: pass
09-04 11:40:20.630 1445 2053 D TEEKM: : IsTampered: (0) ---
09-04 11:40:20.630 1445 2053 D TEEK : isTampered: OK ()
09-04 11:40:20.630 1445 6850 D TEEK : isTampered()++
09-04 11:40:20.630 1445 6850 D TEEKM: : IsTampered: +++
09-04 11:40:20.630 1445 6850 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:40:20.630 1445 6850 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:40:20.630 13247 13282 I ZKMALog : isTempered - 0
09-04 11:40:20.630 13247 13282 E ZKMALog : NOT_ROOTED
09-04 11:40:20.630 13247 13282 I ZKMALog : TzApiVersion +
09-04 11:40:20.644 13247 13295 I System : exec(logcat -v threadtime -f /data/user/0/com.htc.wallet/files/feedback/logs/zion.log -r 1024 -n 5 ZionLog:W *:S @ com.htc.wallet.tools.util.ZionLogService$a.run)
09-04 11:40:20.645 13247 13247 E ZionLog : com.htc.tools.manager.InternetManager:onReceive: core connecting
09-04 11:40:20.645 13247 13247 E ZionLog : com.htc.tools.manager.InternetManager:onReceive: true
09-04 11:40:20.722 1445 6850 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:40:20.722 1445 6850 D TEEKM: : TEECmd: cmdId = 0x5
09-04 11:40:20.723 1445 6850 E TEEKM: : qsc_shutdown_app: start
09-04 11:40:20.724 1445 6850 E TEEKM: : shutdown app: pass
09-04 11:40:20.724 1445 6850 D TEEKM: : IsTampered: (0) ---
09-04 11:40:20.724 1445 6850 D TEEK : isTampered: OK ()
09-04 11:40:20.724 1445 2053 D TEEK : ApiVersion(0)++
09-04 11:40:20.724 1445 2053 D TEEKM: : ApiVersion: +++
09-04 11:40:20.724 1445 2053 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:40:20.724 1445 2053 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:40:20.724 13247 13284 I ZKMALog : isTempered - 0
09-04 11:40:20.724 13247 13284 E ZKMALog : NOT_ROOTED
09-04 11:40:20.724 13247 13284 I ZKMALog : TzApiVersion +
09-04 11:40:20.807 1445 2053 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:40:20.807 1445 2053 D TEEKM: : TEECmd: cmdId = 0x0
09-04 11:40:20.808 1445 2053 D TEEKM: : TEECmd received 4 (4)
09-04 11:40:20.808 1445 2053 E TEEKM: : qsc_shutdown_app: start
09-04 11:40:20.809 1445 2053 E TEEKM: : shutdown app: pass
09-04 11:40:20.809 1445 2053 D TEEKM: : ApiVersion: (0) ---
09-04 11:40:20.809 1445 2053 D TEEK : ApiVersion: OK (1000000)
09-04 11:40:20.809 1445 6850 D TEEK : ApiVersion(0)++
09-04 11:40:20.809 1445 6850 D TEEKM: : ApiVersion: +++
09-04 11:40:20.809 1445 6850 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:40:20.809 1445 6850 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:40:20.809 13247 13282 I HtcWalletTZManager: apiVersion = 0x01000000
09-04 11:40:20.809 13247 13282 I ZKMALog : TzApiVersion - 0x01000000
09-04 11:40:20.809 13247 13282 I ZKMALog : getServiceVersion +
09-04 11:40:20.809 13247 13282 I ZKMALog : getServiceVersion - 0002
09-04 11:40:20.809 13247 13282 I ZKMALog : getHtcDeviceName
09-04 11:40:20.810 13247 13282 I ZKMALog : serviceVer=2 tzapiVer=16777216 minTzApiVer=536936449
09-04 11:40:20.810 13247 13282 E ZKMALog : ERROR! serviceVer=2 < minServiceVer=5
09-04 11:40:20.810 13247 13282 E ZKMALog : isTZsupport() failed! -50002
09-04 11:40:20.810 13247 13282 I ZKMALog : CaControl::init() +++
09-04 11:40:20.811 13247 13282 I ZKMALog : isServiceApkInstalled = 0
09-04 11:40:20.811 13247 13282 I ZKMALog : CaControl::connect() +++
09-04 11:40:20.811 13247 13282 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:20.812 1445 2053 W ActivityManager: Unable to start service Intent { cmp=com.htc.wallet/com.htc.service.wallettzservice.HtcWalletTZService } U=0: not found
09-04 11:40:20.812 13247 13282 I ZKMALog : Blocking for binding service count=1
09-04 11:40:20.894 1445 6850 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:40:20.894 1445 6850 D TEEKM: : TEECmd: cmdId = 0x0
09-04 11:40:20.895 1445 6850 D TEEKM: : TEECmd received 4 (4)
09-04 11:40:20.895 1445 6850 E TEEKM: : qsc_shutdown_app: start
09-04 11:40:20.896 1445 6850 E TEEKM: : shutdown app: pass
09-04 11:40:20.896 1445 6850 D TEEKM: : ApiVersion: (0) ---
09-04 11:40:20.896 1445 6850 D TEEK : ApiVersion: OK (1000000)
09-04 11:40:20.896 13247 13284 I HtcWalletTZManager: apiVersion = 0x01000000
09-04 11:40:20.896 13247 13284 I ZKMALog : TzApiVersion - 0x01000000
09-04 11:40:20.896 13247 13284 I ZKMALog : getServiceVersion +
09-04 11:40:20.896 13247 13284 I ZKMALog : getServiceVersion - 0002
09-04 11:40:20.896 13247 13284 I ZKMALog : getHtcDeviceName
09-04 11:40:20.896 13247 13284 I ZKMALog : serviceVer=2 tzapiVer=16777216 minTzApiVer=536936449
09-04 11:40:20.896 13247 13284 E ZKMALog : ERROR! serviceVer=2 < minServiceVer=5
09-04 11:40:20.896 13247 13284 E ZKMALog : isTZsupport() failed! -50002
09-04 11:40:20.896 13247 13284 I ZKMALog : CaControl::init() +++
09-04 11:40:20.912 13247 13282 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:20.912 1445 6850 W ActivityManager: Unable to start service Intent { cmp=com.htc.wallet/com.htc.service.wallettzservice.HtcWalletTZService } U=0: not found
09-04 11:40:20.913 13247 13282 I ZKMALog : Blocking for binding service count=2
09-04 11:40:21.013 13247 13282 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.013 13247 13282 I ZKMALog : Blocking for binding service count=3
09-04 11:40:21.114 13247 13282 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.114 13247 13282 I ZKMALog : Blocking for binding service count=4
09-04 11:40:21.214 13247 13282 I ZKMALog : CaControl::connect() --- bRet=false sBound=false
09-04 11:40:21.215 13247 13282 I ZKMALog : CaControl::init() --- -20008
09-04 11:40:21.215 13247 13282 E ZKMALog : isCAsupport() failed! -20008
09-04 11:40:21.215 13247 13282 I ZKMALog : init --- ret=0
09-04 11:40:21.215 13247 13282 W ZionLog : HTCKeyManager:initSdk() --- Ret: 0
09-04 11:40:21.216 13247 13282 I ZKMALog : setEnvironment +++
09-04 11:40:21.216 13247 13282 I ZKMALog : setEnvironment --- ret=0
09-04 11:40:21.216 13247 13282 W ZionLog : HTCKeyManager:setEnvironment() --- Ret: 0
09-04 11:40:21.217 13247 13282 I ZionLog : HTCKeyManager:Set SdkErrorHandler
09-04 11:40:21.217 13247 13282 I ZKMALog : setSdkProtectorListener +++
09-04 11:40:21.217 13247 13282 I ZKMALog : setSdkProtectorListener ---
09-04 11:40:21.217 13247 13282 I ZKMALog : register +++
09-04 11:40:21.217 13247 13282 I ZKMALog : register ---
09-04 11:40:21.217 13247 13282 W ZionLog : HTCKeyManager:Register Exit()...
09-04 11:40:21.217 13247 13284 I ZKMALog : isServiceApkInstalled = 0
09-04 11:40:21.217 13247 13284 I ZKMALog : CaControl::init() initialed!
09-04 11:40:21.217 13247 13284 I ZKMALog : CaControl::connect() +++
09-04 11:40:21.217 13247 13284 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.218 13247 13284 I ZKMALog : Blocking for binding service count=1
09-04 11:40:21.219 13247 13282 W ZionLog : HTCKeyManager:Check hash register pass.
09-04 11:40:21.219 13247 13292 W ZionLog : HTCKeyManager:Escape init thread. Spend: 594 ms
09-04 11:40:21.219 13247 13292 I ZKMALog : getApiVersion +++
09-04 11:40:21.219 13247 13292 I ZKMALog : getApiVersion --- vret=0.0000.0000000
09-04 11:40:21.219 13247 13292 W ZionLog : HTCKeyManager:getVersion() --- Ret: 0.0000.0000000
09-04 11:40:21.221 13247 13303 W ZionLog : HTCKeyManager:isSeedExistsTZ() +++
09-04 11:40:21.221 13247 13303 W ZionLog : HTCKeyManager:getUniqueID() +++
09-04 11:40:21.221 13247 13303 I ZKMALog : IsSeedExists +++
09-04 11:40:21.221 13247 13303 W ZKMALog : isSeedExists err=-99999 C1F8A95523
09-04 11:40:21.221 13247 13303 I ZKMALog : Diagnostic errcode=-99999
09-04 11:40:21.221 13247 13303 V ZKMALog : SetErrorCode=-99999
09-04 11:40:21.221 13247 13303 E ZKMALog : GenericErrorChecker Sdk is Handling errorcode=-99999
09-04 11:40:21.222 13247 13303 I ZKMALog : doShowUIActivity +++
09-04 11:40:21.218 1445 6850 W ActivityManager: Unable to start service Intent { cmp=com.htc.wallet/com.htc.service.wallettzservice.HtcWalletTZService } U=0: not found
09-04 11:40:21.229 13247 13303 I ZKMALog : before lock
09-04 11:40:21.229 13247 13303 I ZKMALog : wait ....
09-04 11:40:21.318 13247 13284 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.318 1445 1820 W ActivityManager: Unable to start service Intent { cmp=com.htc.wallet/com.htc.service.wallettzservice.HtcWalletTZService } U=0: not found
09-04 11:40:21.319 13247 13284 I ZKMALog : Blocking for binding service count=2
09-04 11:40:21.419 13247 13284 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.419 1445 1820 W ActivityManager: Unable to start service Intent { cmp=com.htc.wallet/com.htc.service.wallettzservice.HtcWalletTZService } U=0: not found
09-04 11:40:21.419 13247 13284 I ZKMALog : Blocking for binding service count=3
09-04 11:40:21.520 13247 13284 I ZKMALog : CaControl::connect() bindService bRet=false
09-04 11:40:21.521 13247 13284 I ZKMALog : Blocking for binding service count=4
09-04 11:40:21.621 13247 13284 I ZKMALog : CaControl::connect() --- bRet=false sBound=false
09-04 11:40:21.621 13247 13284 I ZKMALog : CaControl::init() --- -20008
09-04 11:40:21.621 13247 13284 E ZKMALog : isCAsupport() failed! -20008
09-04 11:40:21.621 13247 13284 I ZKMALog : init --- ret=0
09-04 11:40:21.621 13247 13284 I ZKMALog : getApiVersion +++
09-04 11:40:21.621 13247 13284 I ZKMALog : getApiVersion --- vret=0.0000.0000000
When launching my test app:
09-04 11:39:25.090 12502 12545 I ZKMALog : HtcWalletSdkManager +++
09-04 11:39:25.091 12502 12545 I ZKMALog : HtcWalletSdkManager ---
09-04 11:39:25.091 12502 12545 I ZKMALog : init +++
09-04 11:39:25.092 12502 12545 I ZKMALog : isDeviceSupportHardwareWallet true , com.htc.hardware.wallet
09-04 11:39:25.092 12502 12545 E ZKMALog : HtcWalletSDK:3.4.6 bTZ_support = true
09-04 11:39:25.093 12502 12545 I HtcWalletTZManager: HtcWalletTZManager()+
09-04 11:39:25.093 12502 12545 I HtcWalletTZManager: HtcWalletTZManager()-
09-04 11:39:25.095 12502 12545 I ZKMALog : isTempered +
09-04 11:39:25.095 1445 5409 D TEEK : isTampered()++
09-04 11:39:25.095 1445 5409 D TEEKM: : IsTampered: +++
09-04 11:39:25.095 1445 5409 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:39:25.095 1445 5409 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:39:25.195 1445 5409 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:39:25.195 1445 5409 D TEEKM: : TEECmd: cmdId = 0x5
09-04 11:39:25.195 1445 5409 E TEEKM: : qsc_shutdown_app: start
09-04 11:39:25.196 1445 5409 E TEEKM: : shutdown app: pass
09-04 11:39:25.196 1445 5409 D TEEKM: : IsTampered: (0) ---
09-04 11:39:25.196 1445 5409 D TEEK : isTampered: OK ()
09-04 11:39:25.197 12502 12545 I ZKMALog : isTempered - 0
09-04 11:39:25.197 12502 12545 E ZKMALog : NOT_ROOTED
09-04 11:39:25.197 12502 12545 I ZKMALog : TzApiVersion +
09-04 11:39:25.197 1445 5409 D TEEK : ApiVersion(0)++
09-04 11:39:25.197 1445 5409 D TEEKM: : ApiVersion: +++
09-04 11:39:25.197 1445 5409 E TEEKM: : Try to load /vendor/firmware/luck...
09-04 11:39:25.197 1445 5409 W TEEKM: : Succeed to open file /vendor/firmware/luck.mbn
09-04 11:39:25.283 1445 5409 E TEEKM: : start_app: Loading app -luck succeded
09-04 11:39:25.283 1445 5409 D TEEKM: : TEECmd: cmdId = 0x0
09-04 11:39:25.284 1445 5409 D TEEKM: : TEECmd received 4 (4)
09-04 11:39:25.284 1445 5409 E TEEKM: : qsc_shutdown_app: start
09-04 11:39:25.285 1445 5409 E TEEKM: : shutdown app: pass
09-04 11:39:25.285 1445 5409 D TEEKM: : ApiVersion: (0) ---
09-04 11:39:25.285 1445 5409 D TEEK : ApiVersion: OK (1000000)
09-04 11:39:25.285 12502 12545 I HtcWalletTZManager: apiVersion = 0x01000000
09-04 11:39:25.285 12502 12545 I ZKMALog : TzApiVersion - 0x01000000
09-04 11:39:25.285 12502 12545 I ZKMALog : getServiceVersion +
09-04 11:39:25.285 12502 12545 I ZKMALog : getServiceVersion - 0002
09-04 11:39:25.286 12502 12545 I ZKMALog : serviceVer=2 tzapiVer=16777216 minTzApiVer=16842828
09-04 11:39:25.286 12502 12545 E ZKMALog : ERROR! serviceVer=2 < minServiceVer=5
09-04 11:39:25.286 12502 12545 I ZKMALog : Diagnostic errcode=-50002
09-04 11:39:25.286 12502 12545 V ZKMALog : SetErrorCode=-50002
09-04 11:39:25.286 12502 12545 I ZKMALog : init --- ret=-50002
I'm not really sure how it gets into this state and recovery has so far been accidental, at best. A factory reset isn't even a 100% way to get things working again.
The general flow of my test app up to this error is pretty simple:
Would appreciate any insight.
Hi Zion dev team,
I use zkma.signMessage
(with Ethereum type) to sign the raw message and want to use a public key (e.g., from zkma.{getSendPublicKey, getReceivePublicKey}
) to verify the signature of the signed message [1, 2].
How can I do verification with Zion SDK?
The idea is to leverage Zion as a tool to generate secure HW signatures of any small data (texts, images, etc.), like using the traditional GPG tool with a higher security level.
Any suggestion is welcome!
References
The argument float rates
of the following function is not documented:
What is this supposed to be, exactly? It's not mentioned in the wiki at all and not documented in the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.