const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Btejc5g3.cjs');
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CElYpi97.cjs');

//#region src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts
/** @notInstrumented */
const consumeMfaTokenIfRequiredForAction = async ({ mfaAction }, client) => {
	if (!await require_isMfaRequiredForAction.isMfaRequiredForAction({ mfaAction }, client)) return;
	return require_isMfaRequiredForAction.__consumeMfaToken_wrapped(client);
};

//#endregion
//#region src/modules/sessionKeys/generateNonceSignature/generateNonceSignature.ts
/** @notInstrumented */
const generateNonceSignature = async ({ nonce }, client) => {
	const core = require_updateAuthFromVerifyResponse.getCore(client);
	require_updateAuthFromVerifyResponse.assertDefined(core.keychain, "Keychain service not available");
	return { signature: await core.keychain.sign("session", nonce) };
};

//#endregion
//#region src/modules/sessionKeys/generateSessionSignature/generateSessionSignature.ts
/** @notInstrumented */
const generateSessionSignature = async ({ sessionId }, client) => {
	return { signature: await require_updateAuthFromVerifyResponse.getCore(client).keychain.sign("session", sessionId) };
};

//#endregion
//#region src/modules/sessionKeys/getSignedSessionId/getSignedSessionId.ts
/** @notInstrumented */
const getSignedSessionId = async (client) => {
	const sessionId = require_updateAuthFromVerifyResponse.getCore(client).state.get().user?.sessionId;
	require_updateAuthFromVerifyResponse.assertDefined(sessionId, "Session ID is required");
	const { signature: signedSessionId } = await generateSessionSignature({ sessionId }, client);
	require_updateAuthFromVerifyResponse.assertDefined(signedSessionId, "Signed session ID is required");
	const nonce = await require_updateAuthFromVerifyResponse.getNonce(client);
	const { signature: nonceSignature } = await generateNonceSignature({ nonce }, client);
	require_updateAuthFromVerifyResponse.assertDefined(nonceSignature, "Nonce signature is required");
	return { signature: `${signedSessionId}/${nonceSignature}/${nonce}` };
};

//#endregion
Object.defineProperty(exports, 'consumeMfaTokenIfRequiredForAction', {
  enumerable: true,
  get: function () {
    return consumeMfaTokenIfRequiredForAction;
  }
});
Object.defineProperty(exports, 'getSignedSessionId', {
  enumerable: true,
  get: function () {
    return getSignedSessionId;
  }
});
//# sourceMappingURL=getSignedSessionId-cMGkmojJ.cjs.map