mirror of
https://github.com/status-im/status-keycard-go.git
synced 2025-01-31 08:37:16 +00:00
update exportKey return values
This commit is contained in:
parent
6885479b1d
commit
e31ceead3c
@ -273,19 +273,19 @@ func (kc *keycardContext) signWithPath(data []byte, path string) (*types.Signatu
|
||||
return sig, nil
|
||||
}
|
||||
|
||||
func (kc *keycardContext) exportKey(derive bool, makeCurrent bool, onlyPublic bool, path string) ([]byte, error) {
|
||||
func (kc *keycardContext) exportKey(derive bool, makeCurrent bool, onlyPublic bool, path string) ([]byte, []byte, error) {
|
||||
<-kc.connected
|
||||
if kc.runErr != nil {
|
||||
return nil, kc.runErr
|
||||
return nil, nil, kc.runErr
|
||||
}
|
||||
|
||||
key, err := kc.cmdSet.ExportKey(derive, makeCurrent, onlyPublic, path)
|
||||
privKey, pubKey, err := kc.cmdSet.ExportKey(derive, makeCurrent, onlyPublic, path)
|
||||
if err != nil {
|
||||
l("exportKey failed %+v", err)
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return key, nil
|
||||
return privKey, pubKey, nil
|
||||
}
|
||||
|
||||
func (kc *keycardContext) loadSeed(seed []byte) ([]byte, error) {
|
||||
|
4
main.go
4
main.go
@ -260,12 +260,12 @@ func ExportKey(jsonParams *C.char) *C.char {
|
||||
return retValue("error", err.Error())
|
||||
}
|
||||
|
||||
key, err := kctx.exportKey(params.Derive, params.MakeCurrent, params.OnlyPublic, params.Path)
|
||||
privKey, pubKey, err := kctx.exportKey(params.Derive, params.MakeCurrent, params.OnlyPublic, params.Path)
|
||||
if err != nil {
|
||||
return retValue("error", err.Error())
|
||||
}
|
||||
|
||||
return retValue("ok", true, "key", hexString(key))
|
||||
return retValue("ok", true, "privateKey", hexString(privKey), "publicKey", hexString(pubKey))
|
||||
}
|
||||
|
||||
//export LoadSeed
|
||||
|
Loading…
x
Reference in New Issue
Block a user