Attestation profiles / KYC
This guide explains how to request, validate, and use the attested data in your chat bot.
Users can have some of their data verified by a trusted third party (attestor). The attestor posts an attestation record to the Obyte DAG, this record serves as a proof for relying parties that a user was attested. The attested data itself can be either posted publicly by the attestor, or only a hash of this data is posted while the plain-text data is saved in the wallet of the attested user. In the latter case, the user can disclose the attested data to selected peers, for example to your bot.
This can be used to KYC your users prior to providing a service, see https://medium.com/byteball/bringing-identity-to-crypto-b35964feee8e. You may need it e.g. to comply with regulations or protect against fraud.
ICO bot https://github.com/byteball/ico-bot already uses the attested private profiles in order to allow only verified users to invest and to collect their personal data. You can use its code as reference.
Requesting private profile
You should point the user to your privacy policy before requesting sensitive personal data.
To request a private profile, you need to send profile-request message to the user. The message includes the list of fields you require the user to disclose. The message will be displayed in the user's chat window as a clickable link, which allows them to select one of the profiles stored in his wallet and send it over to the peer (your chat bot).
Real Name Attestation
This is a profile request message that asks the fields that all Real Name Attestation profiles have:
Here is the full list of available fields:
first_name
: first namelast_name
: last namedob
: date of birth in YYYY-MM-DD format_country
: the country that issued the ID (2-letter ISO code)us_state
: US state (only if country=US)personal_code
: government issued personal code (not all countries)id_number
: government issued document ID (not all documents)id_type
: ID typeid_subtype
: ID sub-type (not all attestations)id_expiry
: ID expires at (not all attestations)id_issued_at
: ID issued at (not all attestations)
Email Attestation
This is a profile request message that asks the email field that all Email Attestation profiles have:
Steem Attestation
This is a profile request message that asks the fields that all Steem Attestation profiles have:
Receiving private profile
When a user sends you his private profile (on profile request or by choosing "Insert private profile" from the menu), you receive it in a chat message that includes:
where privateProfileJsonBase64
is a base64-encoded JSON of the private profile object. You can easily find the profile in an incoming message using regular expression:
Then, decode the profile using private_profile.js
module in ocore
:
objPrivateProfile
object has 3 fields:
Next, you need to validate this object and extract information about the attested and attestor addresses:
This function verifies that the provided profile matches the hash stored on the DAG by the attestor. It also returns the user's address address
(hence you don't need to ask the user about his address, the profile is enough) and the attestor address attestor
(make sure it is on the list of attestors you trust for each type of attestations).
The src_profile
field of objPrivateProfile
contains an associative array of attested fields. But not all fields have to be disclosed by the user.
If a field is disclosed, the value of
objPrivateProfile[field]
is an array of two elements: the plain-text value of the field and blinding. Blinding is a random string generated by the attestor when creating the profile, it serves to protect the private data from brute force attacks (the profile data is too predictable and can be easily checked against known hashes).If the field is not disclosed, the value of
objPrivateProfile[field]
is a hash of plain-text value and blinding.
To extract just the disclosed data and remove all the bindings, use
You should double check if the user sent all the required fields because users can send private profiles on profile request (required fields in locked state) or by choosing "Insert private profile" from the menu (none of the fields in locked state).
To save the received private profile of previously mentioned Real Name Attestation profile request, use code like this:
It will save the profile in the tables private_profiles
and private_profile_fields
, which you can later query to read the data.
Sending private profile
If your bot is setting up prosaic contracts between 2 users then they need to get each others private profiles. All you need to do is first request the profiles from both users, then receive and save the profiles from both users and then send the first user and second user's profile and the second user a first user's profile.
Retrieving public attestation
Real Name Attestation profiles are all private, but Email Attestation and Steem Attestation bots let user to choose whether they like to publish the data publicly or privately and Username Attestation bot publishes attestations only publicly. So, if you are asking attested email address from the user, you should let them do it with public attestation too.
For full nodes that is easy, you ask user to sign some message, after which you get a wallet address that they own. Then you just query your full node database for that data:
On the light node, it is also possible, but more complicated. You need to ask the Hub for all the attestation for user address and then you would need to request proofs for those attestation units:
Creating attestation profiles
Above examples here show how to use different existing profiles from other attestation bots, but if you would like to create your own attestation bot, it is recommended to click on the links of these bots on this article and take a look how they have been done from the source code. There is also article "How to create private/public attestation profile" on Sending data to DAG page.
Last updated