Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
kit: ContractKit,
address: string,
data: IdentityMetadataWrapper
): Promise {
if (address.substr(0, 2) === '0x') {
address = address.substr(2)
}
const res = [address]
const accounts = await kit.contracts.getAccounts()
for (const claim of data.claims) {
switch (claim.type) {
case ClaimTypes.KEYBASE:
break
case ClaimTypes.ACCOUNT:
try {
const status = await verifyAccountClaim(claim, '0x' + address, accounts.getMetadataURL)
if (status) console.error('Cannot verify claim:', status)
else {
console.log('Claim success', address, claim.address)
res.push(claim.address)
}
} catch (err) {
console.error('Cannot fetch metadata', err)
}
default:
break
}
}
return dedup(res)
}