github / webauthn-json

🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.
https://github.github.com/webauthn-json/demo/
MIT License
757 stars 60 forks source link

Export `PublicKeyCredentialRequestOptionsJSON` #86

Closed dartess closed 4 months ago

dartess commented 4 months ago

Please add export type PublicKeyCredentialRequestOptionsJSON, we prepare it using a separate method.

lgarron commented 4 months ago

I think you're looking for CredentialRequestOptionsJSON?

import { type CredentialRequestOptionsJSON, get, create } from "@github/webauthn-json";

const r: CredentialRequestOptionsJSON = { /* … */ };
console.log(await get(r));
dartess commented 4 months ago

No, but I was a little hasty in the code review and didn’t get into the code. We just used CredentialRequestOptionsJSON['publicKey'] instead of PublicKeyCredentialRequestOptionsJSON. Sorry! 🙏

lgarron commented 4 months ago

We just used CredentialRequestOptionsJSON['publicKey'] instead of PublicKeyCredentialRequestOptionsJSON.

Yeah, this is the way to get the type of a field if you really need. Glad it worked out for you!