-
Notifications
You must be signed in to change notification settings - Fork 88
[Bug] fix(webauthn): to include scopes in the API #882
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
[Bug] fix(webauthn): to include scopes in the API #882
Conversation
…hs` higher api function
…in auth-services and networks
| export const tAuthServiceMintRequestSchema = t.Object({ | ||
| authMethodType: t.String(), | ||
| authMethodId: t.String(), | ||
| pubkey: t.Optional(t.String({ default: '0x' })), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused Unable to decode credential public key CBOR
packages/auth-services/src/queue-manager/src/handlers/pkpMint/pkpMint.handler.ts
Outdated
Show resolved
Hide resolved
MaximusHaximus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few issues in-line
packages/auth-services/src/queue-manager/src/handlers/pkpMint/pkpMint.handler.ts
Outdated
Show resolved
Hide resolved
packages/auth-services/src/auth-server/src/schemas/AuthServiceMintRequestSchema.ts
Outdated
Show resolved
Hide resolved
...rc/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/MintPKPSchema.ts
Outdated
Show resolved
Hide resolved
packages/auth/src/lib/authenticators/native/WebAuthnAuthenticator.ts
Outdated
Show resolved
Hide resolved
…lers to use unified schema
|
consolidated 4 different PKP mint schemas and scopes. All networks APIs now import from schemas package instead of internally |
MaximusHaximus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job getting rid of the duplication -- just a few things added in-line
| // Accept string, number, or enum for backwards compatibility | ||
| authMethodType: z | ||
| .union([ | ||
| AuthMethodSchema.shape.authMethodType, // z.nativeEnum(AUTH_METHOD_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't used native enums anywhere in the SDK since aug of '24
I tried running the schemas file using tsx directly, and got an error `ReferenceError: Cannot access 'LitAbilitySchema' before initialization which is related to weird corner-cases with native enums, highlighting why we stopped using them :)
packages/auth-services/src/queue-manager/src/handlers/pkpMint/pkpMint.handler.ts
Outdated
Show resolved
Hide resolved
|
so the logic flow is:
|
Signed-off-by: Anson <[email protected]>
Signed-off-by: Anson <[email protected]>
MaximusHaximus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looking pretty close -- just one question about the possible input for the custom schema which we are trying to coerce to a number, even though it appears it could be > 2^53 -- and z.nativeEnum usage that might've been missed in my last review.
| pubkey: HexPrefixedSchema.default('0x'), | ||
| scopes: z.array(ScopeSchemaRaw).optional().default([]), | ||
| }) | ||
| .refine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💖 nice, this makes sense
MaximusHaximus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
WHAT
0xcausing "misleading" (technically correct) unable to decode credential public key CBOR.