has_secure_passkey 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fe71d038885c8ace21e20f7f1a7e56d808c6793cc25ff19a33aeb40ba1d6bb2
4
- data.tar.gz: 4730632c5eb322aa358e6e94fe4c73b2bbf5d7fa3fc50ea3ae4fa496f33adfdb
3
+ metadata.gz: 275623cf8f9fe79134b646a93127fc6cd2ba98bbf63b6054e123e3053a057862
4
+ data.tar.gz: aa4f173ccd9d763ba87e0bb4e2a40faadaa2bf6ed680bf905c65ff6de8996cba
5
5
  SHA512:
6
- metadata.gz: c027e1b23a7d7a66ed0a79a8e431527127a4344473d02640dc9a779ca9a8fa1d6bc2d593c4ffec64776457040e0cf148cffd534a22b3055017c463144e238231
7
- data.tar.gz: fe838b0a15d7e9299278db07397cfa557e3112e833f5ba7bb89c3797cdb789a25f654f03953023a6d328a97ff3ef26f8e9e37adde9123fed7be79d9a5f9d3439
6
+ metadata.gz: b23cd829d00bdba8f696be60167d4435a8eafb14acd6f061adad6a6a524a8a3b4d55dfb90ddf1513da17e015dc33ab8346cda34bbd19a20d90147a1d9436396e
7
+ data.tar.gz: de4a9db9fd821897f2f80ab63d09122e6bb38b724f76293989c16dc43983a8970d163109fd0ab59c7520afe36f8e9e0390d4365528da2fd32461807858b260e3
@@ -1,7 +1,7 @@
1
1
  import { post } from "@rails/request.js"
2
2
 
3
3
  export default class WebAuthn extends HTMLElement {
4
- static observedAttributes = ["action", "callback", "options"];
4
+ static observedAttributes = ["action", "callback", "options", "delay"];
5
5
 
6
6
  constructor() {
7
7
  super();
@@ -11,7 +11,11 @@ export default class WebAuthn extends HTMLElement {
11
11
  this.progressBar = Turbo.navigator.delegate.adapter.progressBar
12
12
  this.setAttribute("data-turbo-temporary", 1)
13
13
  this.setAttribute("data-turbo-track", "reload")
14
- this.run()
14
+ if (this.delay) {
15
+ setTimeout(() => this.run(), Number(this.delay))
16
+ } else {
17
+ this.run()
18
+ }
15
19
  }
16
20
 
17
21
  run() {
@@ -70,6 +74,10 @@ export default class WebAuthn extends HTMLElement {
70
74
  return this.getAttribute('callback');
71
75
  }
72
76
 
77
+ get delay() {
78
+ return this.getAttribute('delay');
79
+ }
80
+
73
81
  get options() {
74
82
  return JSON.parse(this.getAttribute('options'));
75
83
  }
@@ -286,7 +286,7 @@ async function post(url, options) {
286
286
 
287
287
  // app/assets/javascripts/components/web_authn.js
288
288
  class WebAuthn extends HTMLElement {
289
- static observedAttributes = ["action", "callback", "options"];
289
+ static observedAttributes = ["action", "callback", "options", "delay"];
290
290
  constructor() {
291
291
  super();
292
292
  }
@@ -294,7 +294,11 @@ class WebAuthn extends HTMLElement {
294
294
  this.progressBar = Turbo.navigator.delegate.adapter.progressBar;
295
295
  this.setAttribute("data-turbo-temporary", 1);
296
296
  this.setAttribute("data-turbo-track", "reload");
297
- this.run();
297
+ if (this.delay) {
298
+ setTimeout(() => this.run(), Number(this.delay));
299
+ } else {
300
+ this.run();
301
+ }
298
302
  }
299
303
  run() {
300
304
  navigator.credentials[this.action]({ publicKey: this.publicKey }).then(async (credential) => {
@@ -343,6 +347,9 @@ class WebAuthn extends HTMLElement {
343
347
  get callback() {
344
348
  return this.getAttribute("callback");
345
349
  }
350
+ get delay() {
351
+ return this.getAttribute("delay");
352
+ }
346
353
  get options() {
347
354
  return JSON.parse(this.getAttribute("options"));
348
355
  }
@@ -0,0 +1,19 @@
1
+ class CreatePasskeys < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :action_pack_passkeys do |t|
4
+ t.integer :holder_id, null: false
5
+ t.string :holder_type, null: false
6
+ t.string :credential_id, null: false
7
+ t.binary :public_key, null: false
8
+ t.integer :sign_count, null: false, default: 0
9
+ t.string :name
10
+ t.text :transports
11
+ t.string :aaguid
12
+
13
+ t.timestamps
14
+
15
+ t.index [ :holder_type, :holder_id ]
16
+ t.index :credential_id, unique: true
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module HasSecurePasskey
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_secure_passkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza
@@ -24,7 +24,7 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: 8.0.0.rc2
26
26
  - !ruby/object:Gem::Dependency
27
- name: webauthn
27
+ name: webauthn-slim
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
@@ -59,6 +59,7 @@ files:
59
59
  - app/views/layouts/has_secure_passkey/application.html.erb
60
60
  - config/importmap.rb
61
61
  - config/routes.rb
62
+ - db/migrate/20260324210831_create_passkeys.rb
62
63
  - lib/generators/has_secure_passkey/passkeys/passkeys_generator.rb
63
64
  - lib/generators/has_secure_passkey/passkeys/templates/app/channels/application_cable/connection.rb.tt
64
65
  - lib/generators/has_secure_passkey/passkeys/templates/app/controllers/concerns/authentication.rb.tt
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubygems_version: 3.7.1
110
+ rubygems_version: 4.0.20
110
111
  specification_version: 4
111
112
  summary: Add passkey support to Rails
112
113
  test_files: []