Created
May 4, 2020 23:09
-
-
Save JitendraZaa/44763fef2896e631a599d33cad33c652 to your computer and use it in GitHub Desktop.
Gravatar – Reusable Lightning Web Component Apex Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Author Jitendra Zaa | |
* @Date 1 May 2020 | |
* @Desc Server Side class for Gravatar LWC component to compute Md5 equivalent of email address | |
*/ | |
public with sharing class GravatarController { | |
@AuraEnabled(cacheable=true) | |
public static String getMD5Hash(String email){ | |
if(String.isEmpty(email)){ | |
email = '[email protected]'; | |
} | |
Blob emailBlob = Blob.valueOf(email); | |
Blob hash = Crypto.generateDigest('MD5', emailBlob); | |
return EncodingUtil.convertToHex(hash); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment