---
title: TrustInsights
framework: trustinsights
role: collection
role_heading: Framework
path: trustinsights
---

# TrustInsights

Evaluate transactions for potential coercive activity while preserving people’s privacy.

## Overview

Overview The TrustInsights framework enables your app to request an evaluation, or insight, to help detect and respond to social engineering threats people may face. Social threats exploit human psychology rather than technical vulnerabilities such as software bugs to pressure or deceive people into performing legitimate actions, and your app can’t distinguish between a genuine or a coerced interaction. Learn about available action contexts There are five principal action areas — kinds of transactions people might engage in — that the Trust Insights framework can help evaluate: Enable your Xcode project to adopt the TrustInsights framework The TrustInsights framework requires that your app’s Xcode project enables the com.apple.developer.trustinsights.base entitlement. For information on how to add this entitlement to your Xcode project, see Trust Insights. Understand the components of trust evaluation request A trust insight is the result of two elements that combine to form a trust insight evaluation request. Create an evaluator and request an evaluation In order to request evaluations, you need to first request a person’s permission to use the TrustInsights framework. The following example demonstrates how to check your app’s authorization status and request a person’s authorization, provided a person hasn’t previously declined an authorization request.     /// Returns `true` if a person has authorized use of TrustInsights,  otherwise `false`.     func requestUserAuthorizationIfNeeded(context: InsightEvaluator.InsightContext) async -> Bool{         do {             let evaluator = InsightEvaluator()             switch try await evaluator.authorizationStatus(for: context) {             case .authorized:                 return true             case .notDetermined, .deniedRequestable:                 // Present a screen that explains the benefits of opting into trust insights                  // (called  `try presentAppInformationScreen()` in this example) that presents                  // an option to allow use of the framework.                 let updateAuthStatus = try await evaluator.requestAuthorization(for: context)                 return updateAuthStatus == .authorized             case .unavailable, .denied:                 return false             @unknown default:                 return false             }         } catch {             return false         }     } Act on the result of the evaluation The result of a TrustInsight evaluation can help you determine if you should perform further checks before finalizing a transaction. The following example shows a function that returns a Boolean value indicating whether the framework indicates there are no indications of coaching. func shouldBypassCheckX() async -> Bool {     do {         let requestedAssessment = IsLikelyBeingCoachedInsight.request(schema: .version1)         let context = InsightEvaluator.InsightContext(             operationCategory: .communication,             requestedEvaluations: requestedAssessment)         guard await requestUserAuthorizationIfNeeded(context: context) else { return false }         let evaluator = InsightEvaluator()         let evaluation = try await evaluator.requestEvaluation(context: context)         switch try evaluation.insight.outcome.get() {         case .unknown:             evaluation.reportConsumption(.usedReducedFriction)             return true         case .medium, .high:             evaluation.reportConsumption(.usedIncreasedFriction)             return false         default:             evaluation.reportConsumption(.notUsedError)             return false         }     } catch {         return false     } }

## Topics

### Obtaining permission or checking authorization to perform evaluations

- [requestAuthorization(for:)](trustinsights/insightevaluator/requestauthorization(for:).md)
- [authorizationStatus(for:)](trustinsights/insightevaluator/authorizationstatus(for:).md)
- [InsightEvaluator.AuthorizationStatus](trustinsights/insightevaluator/authorizationstatus.md)

### Creating an insight evaluation

- [init()](trustinsights/insightevaluator/init().md)

### Requesting an evaluation

- [InsightEvaluator](trustinsights/insightevaluator.md)
- [requestEvaluation(context:)](trustinsights/insightevaluator/requestevaluation(context:).md)
- [InsightEvaluation](trustinsights/insightevaluation.md)
- [TrustInsight](trustinsights/trustinsight.md)

### Evaluating insight signals

- [IsLikelyBeingCoachedInsight](trustinsights/islikelybeingcoachedinsight.md)

### Receiving evaluation notifications and handling errors

- [InsightEvaluationConsumptionStatus](trustinsights/insightevaluationconsumptionstatus.md)
- [InsightError](trustinsights/insighterror.md)

### Providing feedback

- [reportConsumption(_:insightIDsUsed:)](trustinsights/insightevaluation/reportconsumption(_:insightidsused:).md)
- [reportConsumption(_:insightsUsed:)](trustinsights/insightevaluation/reportconsumption(_:insightsused:).md)
