# Hawk Python Library
The Hawk Python Library offers an easy and efficient way to interact with the SwiftID KYC API. It includes methods for authentication, creating wallets, assigning IDs, uploading KYC documents, verifying identification documents, checking address documents, retrieving KYC entries by ID, and managing two-factor authentication (2FA).
To get started, download the library from the following link:
https://drive.google.com/file/d/1KdnrYnjPlSMm_-3MbeFGD13Mo3DPXIRo
Usage
Here is a comprehensive guide on how to use the Hawk library.
Initialization
First, you need to initialize the Hawk class with your credentials and the base URL.
from hawk import Hawk
hawk = Hawk(
base_url="https://cmorq-vanguard-ju4bg3xx5q-uc.a.run.app",
email="[email protected]",
password="Tester#1?",
device_id="11DF4FD7-5813-4CCB-BB5B-8677AADA2F7C"
)
Methods
Create Wallet
This method creates a non-custodial CMORQ EVM address for the user.
response = hawk.create_wallet()
print(response)
Assign ID (CPF)
This method assigns a Brazilian tax ID (CPF) to an existing CMORQ wallet.
response = hawk.assign_id(
address="0x56a809F68Afe5885f8f1D509421db2287291A129",
tax_id="33986798897",
cpf_hash="84e6f96a2335ebb0a351bafd42aa9fe2f14cc3adc70323c9b4dae44fe84a2864"
)
print(response)
Upload KYC Documents
This method uploads the user's KYC documents, such as ID front and back images, and a selfie.
files = [
{
"file_name": "front",
"file_content": "data:image/png;base64,..."
},
{
"file_name": "back",
"file_content": "data:image/png;base64,..."
},
{
"file_name": "selfie",
"file_content": "data:image/png;base64,..."
}
]
response = hawk.upload_kyc(
address="0x56a809F68Afe5885f8f1D509421db2287291A129",
tax_id="33986798897",
physical_address="RUA SAO PAULO, 38, LIBERDADE, 01513-000 - SAO PAULO - SP",
files=files
)
print(response)
ID Document Check
This method verifies the user's ID document and selfie.
response = hawk.id_document_check(
address="0x56a809F68Afe5885f8f1D509421db2287291A129",
tax_id="33986798897",
image_front="gs://cmorq-hawk/0x2fa84e96ea749a295fb5ce6a919c63c3819bf166-front-5",
image_back="gs://cmorq-hawk/0x2fa84e96ea749a295fb5ce6a919c63c3819bf166-back-5",
image_selfie="gs://cmorq-hawk/0x2fa84e96ea749a295fb5ce6a919c63c3819bf166-selfie-5"
)
print(response)
Address Document Check
This method verifies the user's proof of address document.
response = hawk.address_document_check(
document_image="gs://cmorq-hawk/0x83bbdcfc0394a1b747b156eb5c394ba8d04c52b6-back-1",
address="0x007accfa2f5b2b7cb0d13739b44c241a34a2c752",
physical_address="RUA SAO PAULO, 38, LIBERDADE, 01513-000 - SAO PAULO - SP"
)
print(response)
Get Entry by ID
This method retrieves the KYC entry by wallet address and CPF hash.
response = hawk.get_entry_by_id(
address="0x007accfa2f5b2b7cb0d13739b44c241a34a2c752",
cpf_hash="84e6f96a2335ebb0a351bafd42aa9fe2f14cc3adc70323c9b4dae44fe84a2864"
)
print(response)
Send MFA
This method sends a multi-factor authentication (MFA) code to the user's phone number.
response = hawk.send_mfa(
phone_number="16175995996",
address="0x22310219835070caC8347D90FF65c270eC2D6975"
)
print(response)
Verify MFA
This method verifies the MFA code sent to the user's phone number.
response = hawk.verify_mfa(
phone_number="16175995996",
address="0x22310219835070caC8347D90FF65c270eC2D6975",
token="680737"
)
print(response)
Contributing
We welcome contributions to improve the Hawk library.
License
This project is licensed under the MIT License.