UNPKG

react-native-bynn-sdk

Version:

Bynn Mobile SDK for React Native - Identity verification and KYC

1 lines 11.6 kB
function _0x2610(_0x301bdf,_0x2f6a10){const _0x12d579=_0x12d5();return _0x2610=function(_0x2610b6,_0x526ba0){_0x2610b6=_0x2610b6-0xc3;let _0x14c296=_0x12d579[_0x2610b6];return _0x14c296;},_0x2610(_0x301bdf,_0x2f6a10);}(function(_0x17d543,_0x4ea114){const _0x570689=_0x2610,_0xe7a8eb=_0x17d543();while(!![]){try{const _0x31d9bb=parseInt(_0x570689(0xde))/0x1+parseInt(_0x570689(0xf4))/0x2*(-parseInt(_0x570689(0xf1))/0x3)+parseInt(_0x570689(0xec))/0x4*(parseInt(_0x570689(0xe3))/0x5)+-parseInt(_0x570689(0xdb))/0x6+parseInt(_0x570689(0xed))/0x7*(-parseInt(_0x570689(0xe8))/0x8)+-parseInt(_0x570689(0xea))/0x9+parseInt(_0x570689(0xc6))/0xa;if(_0x31d9bb===_0x4ea114)break;else _0xe7a8eb['push'](_0xe7a8eb['shift']());}catch(_0x341cde){_0xe7a8eb['push'](_0xe7a8eb['shift']());}}}(_0x12d5,0x6ad9f));export const createSession=async _0x54e733=>{const _0x564150=_0x2610;console[_0x564150(0xc3)]('Creating\x20session\x20with:',{'apiKey':_0x54e733[_0x564150(0xeb)],'body':{'kyc_level':_0x54e733['kycLevel'],'first_name':_0x54e733[_0x564150(0xc9)],'last_name':_0x54e733['lastName'],'unique_id':_0x54e733['uniqueId'],'phone_number':_0x54e733[_0x564150(0xee)],'email':_0x54e733[_0x564150(0xc4)]}});const _0x5122a1=await fetch(_0x564150(0xe0),{'method':_0x564150(0xe6),'headers':{'accept':'application/json','content-type':_0x564150(0xf2),'Authorization':_0x54e733[_0x564150(0xeb)]},'body':JSON[_0x564150(0xd9)]({'kyc_level':_0x54e733[_0x564150(0xc5)],'first_name':_0x54e733['firstName'],'last_name':_0x54e733[_0x564150(0xe5)],'unique_id':_0x54e733[_0x564150(0xf5)],'phone_number':_0x54e733['phoneNumber'],'email':_0x54e733['email']})});if(!_0x5122a1['ok'])throw new Error('Failed\x20to\x20create\x20session:\x20'+_0x5122a1[_0x564150(0xc7)]);const _0x5e4bbf=await _0x5122a1[_0x564150(0xce)]();return console['log'](_0x5e4bbf),_0x5e4bbf;};export const submitConsent=async(_0x4f029e,_0x5b4635)=>{const _0x2d61ba=_0x2610;console[_0x2d61ba(0xc3)]('CALL',_0x4f029e,_0x5b4635);const _0x44510b={'method':_0x2d61ba(0xd4),'headers':{'accept':'application/json','content-type':'application/json'},'body':JSON['stringify']({'gives_consent':!![]})};try{const _0x5e6e99=await fetch('https://api.bynn.com/v1/sessions/'+_0x4f029e+_0x2d61ba(0xda),_0x44510b);console['log']('response\x20is'+JSON[_0x2d61ba(0xd9)](_0x5e6e99));if(!_0x5e6e99['ok'])throw new Error(_0x2d61ba(0xd3)+_0x5e6e99[_0x2d61ba(0xc7)]);return _0x5e6e99['json']();}catch(_0xac64f2){console['error'](_0xac64f2);const _0x5102a0=typeof _0xac64f2===_0x2d61ba(0xd2)&&_0xac64f2!==null&&'message'in _0xac64f2?_0xac64f2[_0x2d61ba(0xdd)]:String(_0xac64f2);throw new Error(_0x2d61ba(0xca)+_0x5102a0);}};export const uploadMedia=async(_0x491525,_0x50dfae,_0x29d68c)=>{const _0x45951f=_0x2610,_0x57dca5={'method':_0x45951f(0xe6),'headers':{'accept':_0x45951f(0xf2),'content-type':'application/json'},'body':JSON[_0x45951f(0xd9)]({'app_screen':_0x29d68c,'media_base64_strict':_0x50dfae})};try{const _0x480d6a=await fetch(_0x45951f(0xdf)+_0x491525+_0x45951f(0xd6),_0x57dca5);if(!_0x480d6a['ok'])throw new Error(_0x45951f(0xef)+_0x480d6a[_0x45951f(0xc7)]);return _0x480d6a[_0x45951f(0xce)]();}catch(_0x39445b){console['error'](_0x39445b);throw new Error('Failed\x20to\x20upload\x20media:\x20'+_0x39445b?.[_0x45951f(0xdd)]);}};export const submitPhoneVerification=async(_0x16b682,_0xfdef65)=>{const _0xdb2f87=_0x2610,_0x2bf1f2={'method':'POST','headers':{'accept':'application/json','content-type':_0xdb2f87(0xf2)},'body':JSON[_0xdb2f87(0xd9)]({'phone_number':_0xfdef65})};console[_0xdb2f87(0xc3)](_0xfdef65,_0x16b682);try{const _0xd49021=await fetch(_0xdb2f87(0xdf)+_0x16b682+_0xdb2f87(0xe1),_0x2bf1f2);if(!_0xd49021['ok']){console['log'](_0xd49021);throw new Error(_0xdb2f87(0xd7)+_0xd49021['status']);}return _0xd49021['json']();}catch(_0x5d3207){console[_0xdb2f87(0xdc)](_0x5d3207);throw new Error('Failed\x20to\x20submit\x20phone\x20verification:\x20'+_0x5d3207?.['message']);}};function _0x12d5(){const _0x1702cd=['Phone\x20verification\x20failed:\x20','/email_verification','stringify','/consent','5082210qKdWat','error','message','83184VtFwRo','https://api.bynn.com/v1/sessions/','https://api.bynn.com/v1/sessions','/phone_verification','GET','3527480QrRHBb','Failed\x20to\x20verify\x20phone\x20code:\x20','lastName','POST','/complete','216560ATxjsV','Failed\x20to\x20complete\x20age\x20verification:\x20','6704379rqBTyt','apiKey','4zMxnzD','14QaNeoL','phoneNumber','Media\x20upload\x20failed:\x20','Failed\x20to\x20verify\x20age\x20with\x20liveness:\x20','15dOIqJb','application/json','Failed\x20to\x20submit\x20address\x20verification:\x20','92084BKcVrg','uniqueId','Phone\x20code\x20verification\x20failed:\x20','log','email','kycLevel','15252990gtuUYo','status','Failed\x20to\x20verify\x20email\x20code:\x20','firstName','Failed\x20to\x20submit\x20consent:\x20','https://api.bynn.com/v1/age_verification/liveness/','--->>','Failed\x20to\x20get\x20age\x20verification:\x20','json','https://api.bynn.com/v1/age_verification/liveness','===>','Age\x20verification\x20failed:\x20','object','Consent\x20failed:\x20','PATCH','/address_verification','/media'];_0x12d5=function(){return _0x1702cd;};return _0x12d5();}export const verifyPhoneCode=async(_0x435a21,_0x374915)=>{const _0x7b937e=_0x2610,_0x25e745={'method':_0x7b937e(0xd4),'headers':{'accept':'application/json','content-type':'application/json'},'body':JSON['stringify']({'code':_0x374915})};console['log'](_0x374915,_0x435a21);try{const _0x15943e=await fetch(_0x7b937e(0xdf)+_0x435a21+_0x7b937e(0xe1),_0x25e745);console[_0x7b937e(0xc3)](_0x15943e);if(!_0x15943e['ok'])throw new Error(_0x7b937e(0xf6)+_0x15943e[_0x7b937e(0xc7)]);return _0x15943e[_0x7b937e(0xce)]();}catch(_0x168852){console[_0x7b937e(0xdc)](_0x168852);throw new Error(_0x7b937e(0xe4)+_0x168852?.[_0x7b937e(0xdd)]);}};export const submitEmailVerification=async(_0x217f0c,_0x4df7c0)=>{const _0x578b3=_0x2610;console['log'](_0x217f0c,_0x4df7c0);const _0x3d9db7={'method':'POST','headers':{'accept':_0x578b3(0xf2),'content-type':'application/json'},'body':JSON[_0x578b3(0xd9)]({'email_address':_0x4df7c0})};try{const _0x127b29=await fetch(_0x578b3(0xdf)+_0x217f0c+'/email_verification',_0x3d9db7);if(!_0x127b29['ok'])throw new Error('Email\x20verification\x20failed:\x20'+_0x127b29['status']);return _0x127b29[_0x578b3(0xce)]();}catch(_0x53c184){console['error'](_0x53c184);throw new Error('Failed\x20to\x20submit\x20email\x20verification:\x20'+_0x53c184?.['message']);}};export const verifyEmailCode=async(_0x3b6a9b,_0xb1c590)=>{const _0xef93bd=_0x2610,_0xf11e3d={'method':_0xef93bd(0xd4),'headers':{'accept':_0xef93bd(0xf2),'content-type':'application/json'},'body':JSON[_0xef93bd(0xd9)]({'code':_0xb1c590})};try{const _0x4ef3bb=await fetch(_0xef93bd(0xdf)+_0x3b6a9b+_0xef93bd(0xd8),_0xf11e3d);if(!_0x4ef3bb['ok'])throw new Error('Email\x20code\x20verification\x20failed:\x20'+_0x4ef3bb['status']);return _0x4ef3bb[_0xef93bd(0xce)]();}catch(_0xcfe0a){console['error'](_0xcfe0a);throw new Error(_0xef93bd(0xc8)+_0xcfe0a?.['message']);}};export const submitAddressVerification=async(_0x100b6a,_0x314853,_0x7cef2a)=>{const _0x37bfc9=_0x2610;console['log']('--->>',_0x100b6a,_0x314853);const _0x5b40c1={'method':_0x37bfc9(0xe6),'headers':{'accept':_0x37bfc9(0xf2),'content-type':_0x37bfc9(0xf2)},'body':JSON[_0x37bfc9(0xd9)]({'document_base64_strict':_0x314853,'latitude':37.4316,'longitude':78.6569})};console[_0x37bfc9(0xc3)](_0x37bfc9(0xcc),_0x100b6a);try{const _0x2fb095=await fetch(_0x37bfc9(0xdf)+_0x100b6a+_0x37bfc9(0xd5),_0x5b40c1);if(!_0x2fb095['ok'])throw new Error('Address\x20verification\x20failed:\x20'+_0x2fb095[_0x37bfc9(0xc7)]);return _0x2fb095[_0x37bfc9(0xce)]();}catch(_0x56ed23){console['error'](_0x56ed23);throw new Error(_0x37bfc9(0xf3)+_0x56ed23?.[_0x37bfc9(0xdd)]);}};export const submitFundsVerification=async(_0x36ebde,_0x4c9d43,_0x5734fd)=>{const _0x4f9fc4=_0x2610,_0x5cc197={'method':'POST','headers':{'accept':'application/json','content-type':_0x4f9fc4(0xf2)},'body':JSON['stringify']({'document_base64_strict':_0x4c9d43})};console['log'](_0x4f9fc4(0xd0),_0x36ebde,_0x5734fd);try{const _0x5a0acf=await fetch(_0x4f9fc4(0xdf)+_0x36ebde+'/funds_verification',_0x5cc197);if(!_0x5a0acf['ok'])throw new Error('Funds\x20verification\x20failed:\x20'+_0x5a0acf[_0x4f9fc4(0xc7)]);return _0x5a0acf['json']();}catch(_0x5e522b){console[_0x4f9fc4(0xdc)](_0x5e522b);throw new Error('Failed\x20to\x20submit\x20funds\x20verification:\x20'+_0x5e522b?.[_0x4f9fc4(0xdd)]);}};export const startLivenessCheck=async _0x3c2273=>{const _0xd96052=_0x2610,_0x3b019c={'method':'POST','headers':{'accept':'application/json'}};try{const _0x3ac57e=await fetch('https://api.bynn.com/v1/sessions/'+_0x3c2273+'/liveness/start',_0x3b019c);if(!_0x3ac57e['ok'])throw new Error('Liveness\x20check\x20failed\x20to\x20start:\x20'+_0x3ac57e[_0xd96052(0xc7)]);return _0x3ac57e[_0xd96052(0xce)]();}catch(_0x4c9ef8){console['error'](_0x4c9ef8);throw new Error('Failed\x20to\x20start\x20liveness\x20check:\x20'+_0x4c9ef8?.['message']);}};export const completeLivenessCheck=async _0x2a309a=>{const _0x4d14be=_0x2610,_0xfaf048={'method':_0x4d14be(0xe6),'headers':{'accept':'application/json'}};try{const _0x56a2c4=await fetch('https://api.bynn.com/v1/sessions/'+_0x2a309a+'/liveness/complete',_0xfaf048);if(!_0x56a2c4['ok'])throw new Error('Liveness\x20check\x20failed\x20to\x20complete:\x20'+_0x56a2c4['status']);return _0x56a2c4['json']();}catch(_0x219b02){console['error'](_0x219b02);throw new Error('Failed\x20to\x20complete\x20liveness\x20check:\x20'+_0x219b02?.['message']);}};export const verifyAgeWithLiveness=async(_0x46c550,_0x8931af)=>{const _0x3f2d60=_0x2610,_0x1a606e={'method':_0x3f2d60(0xe6),'headers':{'accept':_0x3f2d60(0xf2),'content-type':'application/json','Authorization':_0x8931af},'body':JSON[_0x3f2d60(0xd9)]({'unique_id':_0x46c550})};try{const _0x9d6d5b=await fetch(_0x3f2d60(0xcf),_0x1a606e);if(!_0x9d6d5b['ok'])throw new Error(_0x3f2d60(0xd1)+_0x9d6d5b[_0x3f2d60(0xc7)]);return _0x9d6d5b[_0x3f2d60(0xce)]();}catch(_0x2fc36a){console['error'](_0x2fc36a);throw new Error(_0x3f2d60(0xf0)+_0x2fc36a?.['message']);}};export const updateAgeVerificationLiveness=async _0x263075=>{const _0x42ffe9=_0x2610,_0x12639c={'method':'PATCH','headers':{'accept':_0x42ffe9(0xf2)}};try{const _0x323312=await fetch('https://api.bynn.com/v1/age_verification/liveness/'+_0x263075,_0x12639c);if(!_0x323312['ok'])throw new Error('Age\x20verification\x20update\x20failed:\x20'+_0x323312[_0x42ffe9(0xc7)]);return _0x323312['json']();}catch(_0x51b148){console[_0x42ffe9(0xdc)](_0x51b148);throw new Error('Failed\x20to\x20update\x20age\x20verification:\x20'+_0x51b148?.['message']);}};export const completeAgeVerificationLiveness=async _0xa887d=>{const _0x352d27=_0x2610,_0x479404={'method':_0x352d27(0xe2),'headers':{'accept':'application/json'}};try{const _0x399d98=await fetch(_0x352d27(0xcb)+_0xa887d+_0x352d27(0xe7),_0x479404);if(!_0x399d98['ok'])throw new Error('Age\x20verification\x20completion\x20failed:\x20'+_0x399d98[_0x352d27(0xc7)]);return _0x399d98[_0x352d27(0xce)]();}catch(_0x5ef2f0){console[_0x352d27(0xdc)](_0x5ef2f0);throw new Error(_0x352d27(0xe9)+_0x5ef2f0?.[_0x352d27(0xdd)]);}};export const getAgeVerificationLiveness=async _0x30d095=>{const _0x1e00d3=_0x2610,_0x183042={'method':_0x1e00d3(0xe2),'headers':{'accept':'application/json'}};try{const _0x199a38=await fetch(_0x1e00d3(0xcb)+_0x30d095,_0x183042);if(!_0x199a38['ok'])throw new Error('Age\x20verification\x20retrieval\x20failed:\x20'+_0x199a38['status']);return _0x199a38[_0x1e00d3(0xce)]();}catch(_0x5d8905){console[_0x1e00d3(0xdc)](_0x5d8905);throw new Error(_0x1e00d3(0xcd)+_0x5d8905?.[_0x1e00d3(0xdd)]);}};