SDK-2746: .NET - Add Enforce Handoff to SDKs for IDV Create Session - dotnet#544
Conversation
🤖 Claude Code ReviewCode Review FindingsSummaryThe branch adds an optional CriticalNone. Major1. Breaking change to public
2. Constructor parameter ordering breaks the natural grouping
Minor3. Server-side-only validation leaves the SDK silently producing invalid configs
4. Trailing newline removed at end of
5. Negative-assertion test uses
6. Missing test:
7. Inconsistent fluent-return assertion:
Nit8. XML doc wording could match the existing
9. Inline source comment duplicates the XML doc remark
10. JSON property attribute style is consistent with file conventions
|
There was a problem hiding this comment.
Pull request overview
Adds support for an enforce_handoff flag in the Doc Scan IDV Create Session SDK configuration so callers can require mobile handoff when uploading resources.
Changes:
- Added nullable
EnforceHandofftoSdkConfig, serialized asenforce_handoff. - Extended
SdkConfigBuilderwith_enforceHandoffand a fluentWithEnforceHandoff(bool)method. - Added/updated unit tests to cover
EnforceHandoffbehavior and JSON serialization/omission when unset.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Yoti.Auth/DocScan/Session/Create/SdkConfig.cs |
Adds EnforceHandoff property and updates the public constructor to accept it. |
src/Yoti.Auth/DocScan/Session/Create/SdkConfigBuilder.cs |
Adds backing field + builder method and wires value into SdkConfig construction. |
test/Yoti.Auth.Tests/DocScan/Session/Create/SdkConfigBuilderTests.cs |
Adds tests verifying EnforceHandoff values and JSON serialization behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Assert.IsTrue(sdkConfig.AllowHandoff); | ||
| Assert.IsTrue(sdkConfig.EnforceHandoff); |
| @@ -51,7 +56,8 @@ public SdkConfig(string allowedCaptureMethods, | |||
| string errorUrl, | |||
| string privacyPolicyUrl, | |||
| bool? allowHandoff = null, | |||
Summary
Adds support for the
enforce_handoffflag to the IDV Create Session SDK configuration. When enabled, the user is required to perform mobile handoff to upload their resources. The flag is wired throughSdkConfigand exposed via a newWithEnforceHandoff(bool)method onSdkConfigBuilder, with full unit-test coverage.Changes
src/Yoti.Auth/DocScan/Session/Create/SdkConfig.csEnforceHandoffproperty serialized asenforce_handoff.enforceHandoffparameter (defaults tonullfor backwards compatibility).src/Yoti.Auth/DocScan/Session/Create/SdkConfigBuilder.cs_enforceHandoffbacking field and a new fluentWithEnforceHandoff(bool)builder method, with XML docs noting the server-side rule thatenforce_handoffcannot betruewhileallow_handoffisfalse(DOCS-3523).Build()to pass the new value into theSdkConfigconstructor.test/Yoti.Auth.Tests/DocScan/Session/Create/SdkConfigBuilderTests.csEnforceHandoff = true,false, defaultnull, JSON omission when unset, and combined use withWithAllowHandoff.QA Test Steps
websdk-auto/SDK-2746-dotnet-net---add-enforce-handoff-to-sdks-for-idv-create-session.dotnet restore && dotnet build.dotnet testand confirm all tests pass, in particular the new tests inSdkConfigBuilderTests.cs:ShouldBuildWithEnforceHandoffTrueShouldBuildWithEnforceHandoffFalseEnforceHandoffShouldBeNullIfNotSetEnforceHandoffShouldBeOmittedFromJsonWhenNotSetShouldBuildWithBothAllowHandoffAndEnforceHandoff"allow_handoff":trueand"enforce_handoff":trueappear in the payload.SdkConfigwithout callingWithEnforceHandoff(...), serialize usingNullValueHandling.Ignore, and confirm the JSON does NOT contain theenforce_handoffkey..WithEnforceHandoff(false).Build()and confirm the JSON contains"enforce_handoff":false.allow_handoff=falseandenforce_handoff=trueand confirm the API rejects it (validation is server-side; the SDK does not pre-validate). See DOCS-3523.allow_handoff=true,enforce_handoff=true) and confirm the session is created and the user is forced into the mobile handoff flow.WithAllowHandofftests (ShouldBuildWithMobileHandoffTrue/False,MobileHandoffShouldBeNullIfNotSet) still pass.SdkConfigconsumers compile without changes (the new constructor parameter is optional and defaulted).WithEnforceHandoffproduce identical JSON to previous versions of the SDK.Notes
enforceHandoffis appended afteridDocumentTextDataExtractionRetriesConfigas an optional argument to preserve binary/source compatibility for existing callers.allow_handoff=false+enforce_handoff=trueinvalid combination; this is enforced by the IDV API server-side per DOCS-3523, matching the approach used by the other Yoti SDKs.enforce_handoffis serialized only when explicitly set, ensuring older backends that do not recognize the field continue to receive unchanged payloads when the feature is not used.Related Jira: SDK-2746
Auto-generated by n8n + Claude CLI