@@ -191,15 +191,15 @@ session[:creation_challenge] = options.challenge
191191# If inside a Rails controller, `render json: options` will just work.
192192# I.e. it will encode and convert the options to JSON automatically.
193193
194- # For your frontend code, you might find @github/webauthn-json npm package useful.
195- # Especially for handling the necessary decoding of the options, and sending the
196- # `PublicKeyCredential` object back to the server.
194+ # For your frontend code, you might find the [built-in browser methods](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential) useful.
195+ # The built-in `PublicKeyCredential.parseCreationOptionsFromJSON(options)` allows you to decode the options,
196+ # and the built-in `credential.toJSON()` to send the `PublicKeyCredential` object back to the server.
197197```
198198
199199#### Verification phase
200200
201201``` ruby
202- # Assuming you're using @github/webauthn-json package to send the `PublicKeyCredential` object back
202+ # Assuming you're using the built-in `credential.toJSON()` to send the `PublicKeyCredential` object back
203203# in params[:publicKeyCredential]:
204204webauthn_credential = WebAuthn ::Credential .from_create(params[:publicKeyCredential ])
205205
@@ -238,9 +238,9 @@ session[:authentication_challenge] = options.challenge
238238# If inside a Rails controller, `render json: options` will just work.
239239# I.e. it will encode and convert the options to JSON automatically.
240240
241- # For your frontend code, you might find @github/webauthn-json npm package useful.
242- # Especially for handling the necessary decoding of the options, and sending the
243- # `PublicKeyCredential` object back to the server.
241+ # For your frontend code, you might find the [built-in browser methods](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential) useful.
242+ # The built-in `PublicKeyCredential.parseRequestOptionsFromJSON(options)` allows you to decode the options,
243+ # and the built-in `credential.toJSON()` to send the `PublicKeyCredential` object back to the server.
244244```
245245
246246#### Verification phase
@@ -250,7 +250,7 @@ interface returned by the browser to the stored `credential_id`. The correspondi
250250attributes must be passed as keyword arguments to the ` verify ` method call.
251251
252252``` ruby
253- # Assuming you're using @github/webauthn-json package to send the `PublicKeyCredential` object back
253+ # Assuming you're using the built-in `credential.toJSON()` to send the `PublicKeyCredential` object back
254254# in params[:publicKeyCredential]:
255255webauthn_credential = WebAuthn ::Credential .from_get(params[:publicKeyCredential ])
256256
0 commit comments