update exportKey return values

This commit is contained in:
Andrea Franz 2021-10-06 10:52:55 +02:00
parent 6885479b1d
commit e31ceead3c
2 changed files with 7 additions and 7 deletions

View File

@ -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) {

View File

@ -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