Claim values encode


#1

In the getting started guide
"Faber prepares both raw and encoded values for each attribute in the Transcript Credential Schema. Faber creates the Transcript Claim for Alice."

transcript_claim_values = json.dumps({
‘first_name’: [‘Alice’, ‘1139481716457488690172217916278103335’], #
‘last_name’: [‘Garcia’, ‘5321642780241790123587902456789123452’],
‘degree’: [‘Bachelor of Science, Marketing’, ‘12434523576212321’],
‘status’: [‘graduated’, ‘2213454313412354’],
‘ssn’: [‘123-45-6789’, ‘3124141231422543541’],
‘year’: [‘2015’, ‘2015’],
‘average’: [‘5’, ‘5’]
})

How to encode the values? I checked the samples and tests, all of them are hard coded?

Thanks


#2

Since credentials can only contain integers, strings are converted by doing a SHA256. A type like date may be encoded as seconds/days since epoch which will be specified in the schema. Similarly other units are encoded as integers too. For more info have a look here


#3

Thank you.

I was looking for that for a few days.


#4

Hi,
I still do not see how is string ‘Alice’ encoded in 1139481716457488690172217916278103335? What I understood from above is that we convert Alice by SHA256 - which gives 3bc51062973c458d5a6f2d8d64a023246354ad7e064b1e4e009ec8a0699a3043. This converted in decimal gives 27034640024117331033063128044004318218486816931520886405535659934417438781507 which is in no way similar to 1139481716457488690172217916278103335.

Thanks in advance.


#5

The numbers are dummy values, so Alice would hash to 27034640024117331033063128044004318218486816931520886405535659934417438781507. That must have been done for readability, a note should have been left mentioning the redaction or maybe the redaction was not necessary at all.


#6

Thank you very much for the clarification! It is clear now.