Skip to content

Commit 1968f41

Browse files
authored
Merge pull request #18 from Safeheron/dev
add cosigner v3 demo
2 parents 71629b0 + 2b84664 commit 1968f41

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

demo/api_demo/co_signer/co_signer_converter_demo.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ def test_co_signer_converter(self):
1616
config = read_yaml("./config.yaml")
1717
converter = CoSignerConverter(config)
1818
# The CoSignerCallBack received by the controller
19+
# Visit the following link to view the request data specification:https://docs.safeheron.com/api/en.html#API%20Co-Signer%20Request%20Data
1920
co_signer_call_back = {}
20-
biz_content = converter.request_convert(co_signer_call_back)
21+
biz_content = converter.request_v3_convert(co_signer_call_back)
2122
# According to different types of CoSignerCallBack, the customer handles the corresponding type of business logic.
2223
print(biz_content)
2324

24-
coSignerResponse = CoSignerResponse()
25-
coSignerResponse.approve = True
26-
coSignerResponse.txKey = "TxKey that needs to be approved"
27-
encryptResponse = converter.response_converter_with_new_crypto_type(coSignerResponse)
25+
# Visit the following link to view the response data specification.:https://docs.safeheron.com/api/en.html#Approval%20Callback%20Service%20Response%20Data
26+
coSignerResponse = CoSignerResponseV3()
27+
coSignerResponse.action = "<Replace with APPROVE or REJECT>"
28+
coSignerResponse.approvalId = "<Replace with the approvalId data from the request>"
29+
encryptResponse = converter.response_v3_converter(coSignerResponse)
2830
# The customer returns encryptResponse after processing the business logic.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# RSA private key (biz_privkey) is configured in the audit service, as an alternative, you can use bizPrivKeyPemFile to config your bizPrivKey
2-
bizPrivKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
3-
# path to your private key file, pem encoded. BizPrivKeyPemFile priority is higher than bizPrivKey.
4-
bizPrivKeyPemFile: './my_private.pem'
5-
# RSA public key (api_pubkey) is used in the API Key configuration on Safeheron Web Console.
6-
apiPubKey: MIICI****QuTOTECAwEAAQ==
1+
# 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.
2+
approvalCallbackServicePrivateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
3+
# path to your private key file, pem encoded. approvalCallbackServicePrivateKeyPemFile priority is higher than approvalCallbackServicePrivateKey.
4+
approvalCallbackServicePrivateKeyPemFile: './my_private.pem'
5+
# Use the export-public-key command of the API Co-Signer CLI to export the API Co-Signer's public key.
6+
coSignerPubKey: MIICI****QuTOTECAwEAAQ==

0 commit comments

Comments
 (0)