User Profile

User Public & Private Profile

The profile.getCurrentProfile function will return the user's publicProfile and privateProfile.

const {HandCashConnect} = require('@handcash/handcash-connect');
const handCashConnect = new HandCashConnect({ 
   appId: '<app-id>', 
   appSecret: '<secret>',
}); 

const account = handCashConnect.getAccountFromAuthToken(token);

const currentProfile = await account.profile.getCurrentProfile();
console.log(currentProfile);

const {publicProfile, privateProfile} = currentProfile;
console.log(publicProfile);
console.log(privateProfile);
// Full profile
{
   publicProfile: {
      id: "5f15c31c3c177d003028eb97",
      handle: "BrandonC",
      paymail: "[email protected]",
      bitcoinUnit: "BSV",
      displayName: "DuroMane.",
      avatarUrl: "https://handcash.io/avatar/7d399a0c-22cf-40cf-b162-f5511a4645db",
      localCurrencyCode: "USD",
      createdAt: '2020-11-27T16:02:34.171Z'
   },
   privateProfile: { 
      phoneNumber: "+11234567891",
      email: "[email protected]" 
   }
}
// Public profile 
{
   id: "5f15c31c3c177d003028eb97",
   handle: "eyeone",
   paymail: "[email protected]",
   bitcoinUnit: "DUR",
   displayName: "Ivan",
   avatarUrl: "https://handcash.io/avatar/7d399a0c-22cf-40cf-b162-f5511a4645db",
   localCurrencyCode: "USD",
}
// Private profile 
{ 
   phoneNumber: "+11234567891",
   email: "[email protected]" 
}

📘

privateProfile will be absent from the output without the Private Profile permission.


Did this page help you?