Moonlight-io / asteroid-sdk-js

5 stars 3 forks source link

Helper method to merge claim topic, claim, and attempt decryption/verification #61

Closed lllwvlvwlll closed 4 years ago

rockacola commented 4 years ago

Reference/guidance for its implementation:

lllwvlvwlll commented 4 years ago

I've added a NeoVivid class to the sdk which includes a high-level method to getting and decrypt claims using the smart contracts. Usecase notes:

example:



const claim = await sdk.Vivid.getDecryptedClaimByClaimID(this.neo_network, this.contracts.neo_cns, claim_id, this.contract_admin_wif)

console.log(claim) 
/*
{ claim_id: 'GBwRsliN49Bs7bPW',
  attestations:
   [ { remark: '',
       value:
        '6895edfb152af6e66e1a6f7e90b435976a1c312c7ccf96e0d2695b25cafd8163',
       encryption: 'symmetric_aes256',
       identifier: 'EMAIL',
       decrypted_value: 'clementine84@gmail.com' } ],
  signed_by:
   '02498c5c154df8a2b26047a9205d1329aa0d626a1ef9185a7e3ae4993290905afd',
  signature:
   '2f8e0fd946b26d683b2eab2badae8d2c390872b7838afaa1ae8e43102730473741c3fe65fa3127acaec205787bcc16c585a47eadbfb78c55c35730f1aad57a78',
  sub:
   '039bccbd5684038bd79fda6e30c64921f7b629eb2709d4f6a7e8f0ef9fb6a081f7',
  claim_topic: 'email',
  expires: undefined,
  verification_uri: 'http://localhost:8000' }
*/
lllwvlvwlll commented 4 years ago

@rockacola fyi

rockacola commented 4 years ago

Thanks for the update.

This unblocks https://github.com/Moonlight-io/vega/issues/524