Sha256: 55d0e1d68adb36b1fa809189bd76c3781d1e9e469298c269af3337263919a84b

Contents?: true

Size: 686 Bytes

Versions: 60

Compression:

Stored size: 686 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

import {
  create,
  parseCreationOptionsFromJSON,
} from "@github/webauthn-json/browser-ponyfill";

export default class WebauthnRegistrationController extends Controller {
  static values = { options: Object };
  static targets = ["response"];

  submit(e) {
    if (this.responseTarget.value === "") {
      e.preventDefault();
      this.createCredential();
    }
  }

  createCredential() {
    create(this.options).then((response) => {
      this.responseTarget.value = JSON.stringify(response);

      this.element.requestSubmit();
    });
  }

  get options() {
    return parseCreationOptionsFromJSON(this.optionsValue);
  }
}

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
katalyst-koi-4.9.2 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.9.1 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.9.0 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.8.1 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.8.0 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.7.3 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.6.0 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.9 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.8 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.7 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.6 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.5 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.4 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.3 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.2 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.1 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.0 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.0.beta.2 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.5.0.beta.1 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js
katalyst-koi-4.4.1 app/assets/javascripts/koi/controllers/webauthn_registration_controller.js