Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions demo/api_demo/co_signer/co_signer_converter_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ def test_co_signer_converter(self):
config = read_yaml("./config.yaml")
converter = CoSignerConverter(config)
# The CoSignerCallBack received by the controller
# Visit the following link to view the request data specification:https://docs.safeheron.com/api/en.html#API%20Co-Signer%20Request%20Data
co_signer_call_back = {}
biz_content = converter.request_convert(co_signer_call_back)
biz_content = converter.request_v3_convert(co_signer_call_back)
# According to different types of CoSignerCallBack, the customer handles the corresponding type of business logic.
print(biz_content)

coSignerResponse = CoSignerResponse()
coSignerResponse.approve = True
coSignerResponse.txKey = "TxKey that needs to be approved"
encryptResponse = converter.response_converter_with_new_crypto_type(coSignerResponse)
# Visit the following link to view the response data specification.:https://docs.safeheron.com/api/en.html#Approval%20Callback%20Service%20Response%20Data
coSignerResponse = CoSignerResponseV3()
coSignerResponse.action = "<Replace with APPROVE or REJECT>"
coSignerResponse.approvalId = "<Replace with the approvalId data from the request>"
encryptResponse = converter.response_v3_converter(coSignerResponse)
# The customer returns encryptResponse after processing the business logic.
12 changes: 6 additions & 6 deletions demo/api_demo/co_signer/config.yaml.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RSA private key (biz_privkey) is configured in the audit service, as an alternative, you can use bizPrivKeyPemFile to config your bizPrivKey
bizPrivKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
# path to your private key file, pem encoded. BizPrivKeyPemFile priority is higher than bizPrivKey.
bizPrivKeyPemFile: './my_private.pem'
# RSA public key (api_pubkey) is used in the API Key configuration on Safeheron Web Console.
apiPubKey: MIICI****QuTOTECAwEAAQ==
# The private key used by the Approval Callback Service must be the private key that corresponds to the public key uploaded when creating the API Key.
approvalCallbackServicePrivateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
# path to your private key file, pem encoded. approvalCallbackServicePrivateKeyPemFile priority is higher than approvalCallbackServicePrivateKey.
approvalCallbackServicePrivateKeyPemFile: './my_private.pem'
# Use the export-public-key command of the API Co-Signer CLI to export the API Co-Signer's public key.
coSignerPubKey: MIICI****QuTOTECAwEAAQ==