tweag / webauthn

A library for parsing and validating webauthn/fido2 credentials
Apache License 2.0
34 stars 11 forks source link

Document how `CredentialOptions` can be serialized #103

Closed infinisil closed 2 years ago

infinisil commented 2 years ago

In case the server wants to store it persistently, not just in memory. These docs should just mention that the server needs to store everything needed to reproduce the options, which certainly has to include the challenge, but doesn't have to include fields that are always set to a constant.

infinisil commented 2 years ago

From the discussion with @lykahb in https://github.com/tweag/webauthn/pull/113#discussion_r790700382 I have the feeling that it makes sense to introduce a new type, perhaps called PendingCredentialOptions, which is like a CredentialOptions, but limited to only the fields necessary for finishing the respective ceremony. That is:

For registration:

For authentication:

This type then can be made serializable by the server as needed without storing extra information. This also makes it more efficient to store this structure in memory.

lykahb commented 2 years ago

Adding the fields from this issue description to the documentation of CredentialOptions would be make it clear what is necessary to store.

As the first user of this library, I think that it is too early to write the convenience data types and functions. It is easier to start working with a bare-bones API than with a larger one that takes more time to learn has helpers that may not match the use case.