diff --git a/docs/reference/services/connect-service.md b/docs/reference/services/connect-service.md index 250691d81..8a4db2f54 100644 --- a/docs/reference/services/connect-service.md +++ b/docs/reference/services/connect-service.md @@ -125,6 +125,44 @@ A session cannot be canceled if it is in the {{ field_ref("CancelSessionResponse --- +## Invoke Headless Verification Flow + +In scenarios where a relying party (or attestation provider) wants to preemptively check whether or not a user has a reusable credential, the `HasValidCredential` method runs a headless verification flow with the provided identity. It returns a boolean value, `true` if the identity has a reusable credential `false` otherwise. + +No PII will be included in the response, if you are interested in obtaining results you will need to invoke a verification flow on the client. + +{{ proto_sample_start() }} + + === "TypeScript" + ```ts + import { TrinsicService } from "@trinsic/trinsic"; + + const trinsic = new TrinsicService({ authToken: "" }); + + const result = await trinsic.connect().hasValidCredential({ + identity: { + identity: "", + provider: IdentityProvider.PHONE, + }, + credentialRequestData: { + type: VerificationType.GOVERNMENT_ID + }, + }); + + console.log(result.hasValidCredential); + ``` + + === "C#" + + ```csharp + [Has Valid Credential](../../../dotnet/Tests/Tests.cs) inside_block:hasValidCredential + ``` + + +{{ proto_method_tabs("services.connect.v1.Connect.HasValidCredential") }} + +--- + ## Invoke Verification Flow on the Client Once a Session has been [created](#create-session), the verification flow must be run on your end-user's device, using the {{ field_ref("CreateSessionResponse", "session.client_token") }} returned during Session creation. diff --git a/dotnet/Tests/Tests.cs b/dotnet/Tests/Tests.cs index 49efe461f..35bcfc1bb 100644 --- a/dotnet/Tests/Tests.cs +++ b/dotnet/Tests/Tests.cs @@ -337,6 +337,18 @@ await trinsic.Connect.CancelSessionAsync(new() { }); // } + // hasValidCredential() { + await trinsic.Connect.HasValidCredentialAsync(new() { + Identity = new() { + Identity = "", + Provider = IdentityProvider.Phone + }, + CredentialRequestData = new() { + Type = VerificationType.GovernmentId + } + }); + // } + } catch { // We expect the above calls to fail due to lack of privileges }