Web SDK
  • Home
  • Overview
  • Getting started
  • References
    • Authentication
    • Account
      • Users
    • Notifications
    • Bookmark
    • 2FA
    • Collection
    • Connection filters
    • Feed
    • File Upload
    • Invite
    • Messaging
    • Payment
    • Reviews
    • Search
    • Verification
      • Supported document type
      • List of expected ISO countries
    • Wallet
      • Withdrawal
  • Tutorial
  • Web API
Powered by GitBook
On this page
  • Get logged-in user information
  • IUser
  • Update user information
  • Change user password
  1. References

Account

With the Pakt SDK, Chainsite builders can establish user account features such as:

PreviousAuthenticationNextUsers

Last updated 5 months ago

Get logged-in user information

This feature allows you to fetch the authenticated user information. Pass the authorization token to retrieve the information for that user. This feature returns the IUser in its response.

IUser

The IUser object contains all the information about the user, see below the description of the fields.

Fields
Description
Type

_id

The identifier of the user

string

firstName

The user's first name, inclusive of the middle name(s) if added

string

lastName

The user's last name, inclusive of the middle name(s) if added

string

email

Verified email address of the user

string

status

Identifer to mark the user account status as blocked or active. status if true, means the user is active, blocked, if false

boolean

profileImage

Object containing information for the profile image of the user

Object

bgImage

Object containing information for the background image of the user

Object

emailVerified

Identifier that returns true if email is verified, false if it isn’t

boolean

type

The type of user, marked as a creator or recipient. This can be changed when updating the profile

string

profile

A response object that contains information about the user.

Record<string, any> | Object

profile.contact.city

Identifier for the city the user updated

string

profile.contact.state

Identifier for the state the user updated

string

profile.contact.phone

Identifier for the phone number the user updated

string

profile.contact.address

Identifier for the address the user updated

string

profile.contact.country

Identifer for the country the user updated

string

profile.bio.title

Simply the designation the user assigns self, for example Software developer

string

profile.bio.description

Detailed Summary explanation of the user's assigned bio

string

profile.talent.availability

Identifier to ascertain the user's access.

busy | available | working

profile.talent.tags

An array of labels that depicts what the user is best renowned for.

string[]

profile.talent.tagsIds

An array of tag objects that depicts what the user is best renowned for

Record<string, any>[]

profile.talent.tagsCategory

The classification of the tags

string

walletGenerated

Identifier to return if a wallet has been generated for this user

boolean

score

This field represents the accumulated points calculated and accrued when the user completes certain actions while using the chainsite, defaults to 0.

number

isPrivate

Identifier depiciting the user as private if true, public if false

boolean

meta

Identifier for information exclusive to the user. This object can be used to store any other additional information that might be exclusive to the user and/or the chainsite

Object

isBookmarked

When a logged in user fetches a list of users with the query , the list is returned with this field to determine that the user is bookmarked by the authenticated user fetching the list.

boolean

bookmarkId

Identifier of the bookmarked user

string

twoFa

Object that identifies the two factor properties of the user

Object

onboarded

Identifier returning the user onboarded status, defaults to false.

boolean

profileCompleteness

Identifier returning, in percentage, just how updated the user profile is completed.

number

achievements

An array list of the user accomplishments, this impacts the

Record<string, any>[]

socket

Object containing the user socket status, the socket status is used for messaging.

Record<string, any>

socket.status

Identifier returning the standing of the user, marked as either OFFLINE, ONLINE, AWAY

OFFLINE, ONLINE, AWAY

referralCode

Identifier returning the code associated with the user. This code can be used to refer others to the chainsite, to register

string

userName

Identifier returning the userName associated with the user

string

extra

Object containing about the user activities carried out in the chainsite

Record<string, any>

Here is an example showcasing how to get the logged-in user information.

//Setup user information model
export const getLoggedInUserInfo = async (authorizationToken: string) => {
 const get: ResponseDto<IUser> = await init.account.getUser(authToken);
};

Update user information

A user can update all and any part of their account information, barring the , userName, and score. However, information in the meta-object can be updated. It is recommended to include the previous fields in the meta-object when updating the meta-object.

The updateUserDto is the model used to update the account information. Note that ALL fields are optional.

updateUserDto

Fields
Description
Type

firstName

The user's first name, inclusive of the middle name(s) if added

string

lastName

The user's last name, inclusive of the middle name(s) if added

string

profileImage

The uploaded url of the image

string

bgImage

The uploaded url of the image

string

profile

A response object that contains information about the user.

Record<string, any> | Object

profile.contact.city

Identifier for the city the user updated

string

profile.contact.state

Identifier for the state the user updated

string

profile.contact.phone

Identifier for the phone number the user updated

string

profile.contact.address

Identifier for the address the user updated

string

profile.contact.country

Identifer for the country the user updated

string

profile.bio.title

Simply the designation the user assigns self, for example Software developer

string

profile.bio.description

Detailed Summary explanation of the user's assigned bio

string

profile.talent.availability

Identifier to ascertain the user's access.

busy | available | working

profile.talent.tags

An array of labels that depicts what the user is best renowned for.

string[]

profile.talent.tagsIds

An array of tag objects that depicts what the user is best renowned for

Record<string, any>[]

profile.talent.tagsCategory

The classification of the tags

string

socials

Object containing the entries for links to social media accounts that belongs to the user

Object

socials.github

Identifier for the user's github account

string

socials.twitter

Identifier for the user's twitter link

string

socials.linkedin

Identifier for the user's linkedin account

string

socials.webiste

Identifier for the user's website address

string

meta

Identifier for information exclusive to the user. This object can be used to store any other additional information that might be exclusive to the user and/or the chainsite

Object

//
export const updateUserInfo = async ({payload}:{payload: {userName: string;profileImage: string; socials: {github: string; twitter: string; linkedin: string; website: string;} }}) => {
  const latestUserInfo: UserAccountDto = await sdkInit.account.updateAccount(payload);
};

Change user password

Authenticated users can change the password of their account. The would request a change to the password.

ChangePasswordPayload

Fields
Description
Type

oldPassword

The previous password used to authenticate

string

newPassword

New and current password to be used for authentication

string

authToken

The authorization token from the login response, on how to login, see the Login feature in Authentication

string

The example code below shows how to implement the change password functionality:

export const changeUserPassword = async (oldPassword: string, newPassword: string, authToken: string) => {
  const userInfo: UserAccountDto = await sdkInit.account.changePassword(oldPassword, newPassword, authToken);
};

Do you need to store additional data to the user info? check out

Get logged-in user information
Update user information
Change user password
Meta