Skip to content

Commit a86977c

Browse files
authored
Add API reference for hasValidCredential (#1586)
1 parent 05ea569 commit a86977c

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

docs/reference/services/connect-service.md

+38
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,44 @@ A session cannot be canceled if it is in the {{ field_ref("CancelSessionResponse
125125

126126
---
127127

128+
## Invoke Headless Verification Flow
129+
130+
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.
131+
132+
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.
133+
134+
{{ proto_sample_start() }}
135+
136+
=== "TypeScript"
137+
```ts
138+
import { TrinsicService } from "@trinsic/trinsic";
139+
140+
const trinsic = new TrinsicService({ authToken: "<auth token>" });
141+
142+
const result = await trinsic.connect().hasValidCredential({
143+
identity: {
144+
identity: "<phone number>",
145+
provider: IdentityProvider.PHONE,
146+
},
147+
credentialRequestData: {
148+
type: VerificationType.GOVERNMENT_ID
149+
},
150+
});
151+
152+
console.log(result.hasValidCredential);
153+
```
154+
155+
=== "C#"
156+
<!--codeinclude-->
157+
```csharp
158+
[Has Valid Credential](../../../dotnet/Tests/Tests.cs) inside_block:hasValidCredential
159+
```
160+
<!--/codeinclude-->
161+
162+
{{ proto_method_tabs("services.connect.v1.Connect.HasValidCredential") }}
163+
164+
---
165+
128166
## Invoke Verification Flow on the Client
129167

130168
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.

dotnet/Tests/Tests.cs

+12
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,18 @@ await trinsic.Connect.CancelSessionAsync(new() {
337337
});
338338
// }
339339

340+
// hasValidCredential() {
341+
await trinsic.Connect.HasValidCredentialAsync(new() {
342+
Identity = new() {
343+
Identity = "<phone number>",
344+
Provider = IdentityProvider.Phone
345+
},
346+
CredentialRequestData = new() {
347+
Type = VerificationType.GovernmentId
348+
}
349+
});
350+
// }
351+
340352
} catch {
341353
// We expect the above calls to fail due to lack of privileges
342354
}

0 commit comments

Comments
 (0)