-
Notifications
You must be signed in to change notification settings - Fork 3
feat(davinci-client): add fido2 collectors #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@forgerock/davinci-client': minor | ||
| --- | ||
|
|
||
| Added WebAuthn/FIDO2 collectors |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,7 +202,7 @@ export interface MultiValueCollectorWithValue<T extends MultiValueCollectorTypes | |
| key: string; | ||
| value: string[]; | ||
| type: string; | ||
| validation?: ValidationRequired[]; | ||
| validation: ValidationRequired[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -223,7 +223,7 @@ export interface MultiValueCollectorNoValue<T extends MultiValueCollectorTypes> | |
| key: string; | ||
| value: string[]; | ||
| type: string; | ||
| validation?: ValidationRequired[]; | ||
| validation: ValidationRequired[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -302,6 +302,14 @@ export interface PhoneNumberOutputValue { | |
| phoneNumber?: string; | ||
| } | ||
|
|
||
| export interface FidoRegistrationInputValue { | ||
| attestationValue?: PublicKeyCredential; | ||
| } | ||
|
|
||
| export interface FidoAuthenticationInputValue { | ||
| assertionValue?: PublicKeyCredential; | ||
| } | ||
|
|
||
| export interface ObjectOptionsCollectorWithStringValue< | ||
| T extends ObjectValueCollectorTypes, | ||
| V = string, | ||
|
|
@@ -315,7 +323,7 @@ export interface ObjectOptionsCollectorWithStringValue< | |
| key: string; | ||
| value: V; | ||
| type: string; | ||
| validation?: ValidationRequired[]; | ||
| validation: ValidationRequired[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -339,7 +347,7 @@ export interface ObjectOptionsCollectorWithObjectValue< | |
| key: string; | ||
| value: V; | ||
| type: string; | ||
| validation?: ValidationRequired[]; | ||
| validation: ValidationRequired[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -364,7 +372,7 @@ export interface ObjectValueCollectorWithObjectValue< | |
| key: string; | ||
| value: IV; | ||
| type: string; | ||
| validation?: (ValidationRequired | ValidationPhoneNumber)[]; | ||
| validation: (ValidationRequired | ValidationPhoneNumber)[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -536,13 +544,18 @@ export type UnknownCollector = { | |
| * @interface AutoCollector - Represents a collector that collects a value programmatically without user intervention. | ||
| */ | ||
|
|
||
| export type AutoCollectorCategories = 'SingleValueAutoCollector'; | ||
| export type AutoCollectorTypes = AutoCollectorCategories | 'ProtectCollector'; | ||
| export type AutoCollectorCategories = 'SingleValueAutoCollector' | 'ObjectValueAutoCollector'; | ||
| export type SingleValueAutoCollectorTypes = 'SingleValueAutoCollector' | 'ProtectCollector'; | ||
| export type ObjectValueAutoCollectorTypes = | ||
| | 'ObjectValueAutoCollector' | ||
| | 'FidoRegistrationCollector' | ||
| | 'FidoAuthenticationCollector'; | ||
| export type AutoCollectorTypes = SingleValueAutoCollectorTypes | ObjectValueAutoCollectorTypes; | ||
|
|
||
| export interface AutoCollector< | ||
| C extends AutoCollectorCategories, | ||
| T extends AutoCollectorTypes, | ||
| V = string, | ||
| IV = string, | ||
| > { | ||
| category: C; | ||
| error: string | null; | ||
|
|
@@ -551,8 +564,9 @@ export interface AutoCollector< | |
| name: string; | ||
| input: { | ||
| key: string; | ||
| value: V; | ||
| value: IV; | ||
| type: string; | ||
| validation?: ValidationRequired[] | null; | ||
| }; | ||
| output: { | ||
| key: string; | ||
|
|
@@ -566,13 +580,33 @@ export type ProtectCollector = AutoCollector< | |
| 'ProtectCollector', | ||
| string | ||
| >; | ||
| export type FidoRegistrationCollector = AutoCollector< | ||
| 'ObjectValueAutoCollector', | ||
| 'FidoRegistrationCollector', | ||
| FidoRegistrationInputValue | ||
| >; | ||
| export type FidoAuthenticationCollector = AutoCollector< | ||
| 'ObjectValueAutoCollector', | ||
| 'FidoAuthenticationCollector', | ||
| FidoAuthenticationInputValue | ||
| >; | ||
| export type SingleValueAutoCollector = AutoCollector< | ||
| 'SingleValueAutoCollector', | ||
| 'SingleValueAutoCollector', | ||
| string | ||
| >; | ||
| export type ObjectValueAutoCollector = AutoCollector< | ||
| 'ObjectValueAutoCollector', | ||
| 'ObjectValueAutoCollector', | ||
| Record<string, unknown> | ||
| >; | ||
|
|
||
| export type AutoCollectors = ProtectCollector | SingleValueAutoCollector; | ||
| export type AutoCollectors = | ||
| | ProtectCollector | ||
| | FidoRegistrationCollector | ||
| | FidoAuthenticationCollector | ||
| | SingleValueAutoCollector | ||
| | ObjectValueAutoCollector; | ||
|
|
||
|
Comment on lines
+604
to
610
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainPublic re-exports check for new AutoCollectors Verify the package’s public barrel ( Also applies to: 618-630 🏁 Script executed: #!/bin/bash
# Look for public re-exports of FIDO collectors
rg -nP --glob "packages/davinci-client/src/types.ts" \
-C2 "Fido(Reg|Auth)enticationCollector|ObjectValueAutoCollector"Length of output: 0 🏁 Script executed: #!/bin/bash
# Check if types.ts exists at the specified path
if [ -f "packages/davinci-client/src/types.ts" ]; then
echo "=== types.ts EXISTS ==="
echo "First 50 lines:"
head -50 "packages/davinci-client/src/types.ts"
else
echo "=== types.ts NOT FOUND at packages/davinci-client/src/types.ts ==="
echo "Searching for public barrel files:"
fd -e ts -e js "types|index|barrel" "packages/davinci-client/src" | grep -E "(types|index|barrel)" | head -20
fiLength of output: 2514 🏁 Script executed: #!/bin/bash
# Find package.json and check export configuration
if [ -f "packages/davinci-client/package.json" ]; then
echo "=== package.json exports field ==="
jq '.exports // "No exports field"' "packages/davinci-client/package.json"
fiLength of output: 105 🏁 Script executed: #!/bin/bash
# Search for where AutoCollectors or the new collector types are exported
echo "=== Searching for re-exports of new collectors ==="
rg -nP "export.*?(FidoRegistration|FidoAuthentication|ObjectValueAutoCollector|AutoCollectors)" "packages/davinci-client/src" -C2Length of output: 6563 🏁 Script executed: #!/bin/bash
# View complete types.ts to see all exports
wc -l "packages/davinci-client/src/types.ts"
echo "=== Last 100 lines of types.ts ==="
tail -100 "packages/davinci-client/src/types.ts"Length of output: 2711 🏁 Script executed: #!/bin/bash
# Explicitly search for AutoCollectors export in types.ts
echo "=== Checking for AutoCollectors in types.ts ==="
grep -n "AutoCollectors\|FidoRegistrationCollector\|FidoAuthenticationCollector\|ObjectValueAutoCollector" "packages/davinci-client/src/types.ts" || echo "No matches found"Length of output: 64 Missing public re-exports for new AutoCollector types The new collector types ( App consumers will be forced to import directly from internal paths instead of the public API. Add these exports to 🤖 Prompt for AI Agents |
||
| /** | ||
| * Type to help infer the collector based on the collector type | ||
|
|
@@ -583,8 +617,14 @@ export type AutoCollectors = ProtectCollector | SingleValueAutoCollector; | |
| */ | ||
| export type InferAutoCollectorType<T extends AutoCollectorTypes> = T extends 'ProtectCollector' | ||
| ? ProtectCollector | ||
| : /** | ||
| * At this point, we have not passed in a collector type | ||
| * so we can return a SingleValueAutoCollector | ||
| **/ | ||
| SingleValueAutoCollector; | ||
| : T extends 'FidoRegistrationCollector' | ||
| ? FidoRegistrationCollector | ||
| : T extends 'FidoAuthenticationCollector' | ||
| ? FidoAuthenticationCollector | ||
| : T extends 'ObjectValueAutoCollector' | ||
| ? ObjectValueAutoCollector | ||
| : /** | ||
| * At this point, we have not passed in a collector type | ||
| * so we can return a SingleValueAutoCollector | ||
| **/ | ||
| SingleValueAutoCollector; | ||
Uh oh!
There was an error while loading. Please reload this page.