eosio-swift icon indicating copy to clipboard operation
eosio-swift copied to clipboard

how to calculate signatures parameter in the `push_transaction` request ?

Open DamonHu opened this issue 3 years ago • 0 comments

Sorry to bother you, I would like to ask if the signatures parameter in the push_transaction request can be calculated locally through this library.

I referred to the writing in EosioSoftkeySignatureProvider, passed in the jsonData data of the request parameters, and then calculated it together with chainIdData and contextFreeDataHash, but there was an error: 3090003 unsatisfied_after the request was made Authorization, Provided keys, permissions, and delays do not satisfy declared authorizations.

I wanted to ask if it was a mistake in my understanding, If you want to calculate locally, what is the right thing to do?

this is my code

guard let chainIdData = Data.init(hexString: chainID) else {
            return nil
        }
        let contextFreeDataHash = Data(repeating: 0, count: 32)
        
        if let publicKey = self.getPublicKey(privateKey: nil), let publicData = try? Data(eosioPublicKey: publicKey)  {
            //let data
            return try? EosioEccSign.signWithK1(publicKey: key.uncompressedPublicKey, privateKey: privateData, data: chainIdData + jsonData + contextFreeDataHash).toEosioK1Signature
        } else {
            return nil
        }

DamonHu avatar Mar 06 '22 15:03 DamonHu