{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../../src/backup-and-sync/authentication/utils.ts"],"names":[],"mappings":";;;AAEA,6CAAmD;AAKnD;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,OAA6B,EAC7B,eAAwB,EACJ,EAAE;IACtB,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CACjD,4CAA4C,EAC5C,eAAe,CAChB,CAAC;QACF,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,4BAAmB,EAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB","sourcesContent":["import type { SDK } from '@metamask/profile-sync-controller';\n\nimport { backupAndSyncLogger } from '../../logger';\nimport type { BackupAndSyncContext } from '../types';\n\nexport type ProfileId = SDK.UserProfile['profileId'] | undefined;\n\n/**\n * Retrieves the profile ID from AuthenticationController.\n *\n * @param context - The backup and sync context.\n * @param entropySourceId - The optional entropy source ID.\n * @returns The profile ID associated with the session, if available.\n */\nexport const getProfileId = async (\n  context: BackupAndSyncContext,\n  entropySourceId?: string,\n): Promise<ProfileId> => {\n  try {\n    const sessionProfile = await context.messenger.call(\n      'AuthenticationController:getSessionProfile',\n      entropySourceId,\n    );\n    return sessionProfile.profileId;\n  } catch (error) {\n    backupAndSyncLogger(`Failed to retrieve profile ID:`, error);\n    return undefined;\n  }\n};\n"]}