bitwarden-sdk-secrets 0.1.0 → 0.2.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: a4a8efa2366ad5c6568ce9ec284857674c1b1730263bd538096a2861031ae833
4
- data.tar.gz: 7e15ebee50e29c57357f958f1273fdda182035a490b555510cd95de0f49e14b0
3
+ metadata.gz: cb13c1b0f2375b0588c8165f5f62ef535cf764db90a25b0dccf8fa7e54dca006
4
+ data.tar.gz: a59086cc47ad50cbc4051198f839eaec988014bbf23a2517c2d5e3bffe35a103
5
5
  SHA512:
6
- metadata.gz: ac31e0a25f1ee16b2db1e2949cca718cd268a4ad0b2f18c28ffee48b1cf3ab5d3855bb771869037f00161255529f8d0715f628197e5309391162bca94e799c79
7
- data.tar.gz: 52e926afe59c3d545d0d5441dc2cb356491291a7ffffa6af2ef7a61006dbf6ab3eef8d6662faf87eb1811d4c5eaf17a5a8756627252304868fb3b589ab0070ea
6
+ metadata.gz: 4a38039296e5d75af2b1bd81662cc789d2bfb40d66c40a9e0b39d07571e3d60eb47a918910d5d126036818825cafd8c3edc7db6801fa168b77febdac2a952f61
7
+ data.tar.gz: d9dadcf1ab1e2315ab62ba4ec0332836890d7a5f401990e6db2cff888a7b7df182177737f13987a2e297bc7c3fdb10e585a54d5a465db37749d2fd7e7293a212
Binary file
Binary file
Binary file
data/lib/schemas.rb CHANGED
@@ -15,6 +15,9 @@
15
15
  # password_login_request = PasswordLoginRequest.from_json! "{…}"
16
16
  # puts password_login_request.kdf.argon2_id&.iterations.even?
17
17
  #
18
+ # string1 = String1.from_json! "…"
19
+ # puts string1
20
+ #
18
21
  # two_factor_request = TwoFactorRequest.from_json! "{…}"
19
22
  # puts two_factor_request.provider == TwoFactorProvider::Authenticator
20
23
  #
@@ -213,6 +216,9 @@
213
216
  # uri_match_type = URIMatchType.from_json! "…"
214
217
  # puts uri_match_type == URIMatchType::Domain
215
218
  #
219
+ # fido2_credential = Fido2Credential.from_json! "{…}"
220
+ # puts fido2_credential.counter
221
+ #
216
222
  # identity = Identity.from_json! "{…}"
217
223
  # puts identity.address1.nil?
218
224
  #
@@ -587,6 +593,11 @@ class PBKDF2 < Dry::Struct
587
593
  end
588
594
 
589
595
  # Kdf from prelogin
596
+ #
597
+ # Key Derivation Function for Bitwarden Account
598
+ #
599
+ # In Bitwarden accounts can use multiple KDFs to derive their master key from their
600
+ # password. This Enum represents all the possible KDFs.
590
601
  class Kdf < Dry::Struct
591
602
  attribute :p_bkdf2, PBKDF2.optional
592
603
  attribute :argon2_id, Argon2ID.optional
@@ -2636,6 +2647,67 @@ class LocalData < Dry::Struct
2636
2647
  end
2637
2648
  end
2638
2649
 
2650
+ class Fido2Credential < Dry::Struct
2651
+ attribute :counter, Types::String
2652
+ attribute :creation_date, Types::String
2653
+ attribute :credential_id, Types::String
2654
+ attribute :discoverable, Types::String
2655
+ attribute :key_algorithm, Types::String
2656
+ attribute :key_curve, Types::String
2657
+ attribute :key_type, Types::String
2658
+ attribute :key_value, Types::String
2659
+ attribute :rp_id, Types::String
2660
+ attribute :rp_name, Types::String.optional.optional
2661
+ attribute :user_display_name, Types::String.optional.optional
2662
+ attribute :user_handle, Types::String.optional.optional
2663
+ attribute :user_name, Types::String.optional.optional
2664
+
2665
+ def self.from_dynamic!(d)
2666
+ d = Types::Hash[d]
2667
+ new(
2668
+ counter: d.fetch("counter"),
2669
+ creation_date: d.fetch("creationDate"),
2670
+ credential_id: d.fetch("credentialId"),
2671
+ discoverable: d.fetch("discoverable"),
2672
+ key_algorithm: d.fetch("keyAlgorithm"),
2673
+ key_curve: d.fetch("keyCurve"),
2674
+ key_type: d.fetch("keyType"),
2675
+ key_value: d.fetch("keyValue"),
2676
+ rp_id: d.fetch("rpId"),
2677
+ rp_name: d["rpName"],
2678
+ user_display_name: d["userDisplayName"],
2679
+ user_handle: d["userHandle"],
2680
+ user_name: d["userName"],
2681
+ )
2682
+ end
2683
+
2684
+ def self.from_json!(json)
2685
+ from_dynamic!(JSON.parse(json))
2686
+ end
2687
+
2688
+ def to_dynamic
2689
+ {
2690
+ "counter" => counter,
2691
+ "creationDate" => creation_date,
2692
+ "credentialId" => credential_id,
2693
+ "discoverable" => discoverable,
2694
+ "keyAlgorithm" => key_algorithm,
2695
+ "keyCurve" => key_curve,
2696
+ "keyType" => key_type,
2697
+ "keyValue" => key_value,
2698
+ "rpId" => rp_id,
2699
+ "rpName" => rp_name,
2700
+ "userDisplayName" => user_display_name,
2701
+ "userHandle" => user_handle,
2702
+ "userName" => user_name,
2703
+ }
2704
+ end
2705
+
2706
+ def to_json(options = nil)
2707
+ JSON.generate(to_dynamic, options)
2708
+ end
2709
+ end
2710
+
2639
2711
  module URIMatchType
2640
2712
  Domain = "domain"
2641
2713
  Exact = "exact"
@@ -2646,14 +2718,16 @@ module URIMatchType
2646
2718
  end
2647
2719
 
2648
2720
  class LoginURI < Dry::Struct
2649
- attribute :match, Types::URIMatchType.optional.optional
2650
- attribute :uri, Types::String.optional.optional
2721
+ attribute :match, Types::URIMatchType.optional.optional
2722
+ attribute :uri, Types::String.optional.optional
2723
+ attribute :uri_checksum, Types::String.optional.optional
2651
2724
 
2652
2725
  def self.from_dynamic!(d)
2653
2726
  d = Types::Hash[d]
2654
2727
  new(
2655
- match: d["match"],
2656
- uri: d["uri"],
2728
+ match: d["match"],
2729
+ uri: d["uri"],
2730
+ uri_checksum: d["uriChecksum"],
2657
2731
  )
2658
2732
  end
2659
2733
 
@@ -2663,8 +2737,9 @@ class LoginURI < Dry::Struct
2663
2737
 
2664
2738
  def to_dynamic
2665
2739
  {
2666
- "match" => match,
2667
- "uri" => uri,
2740
+ "match" => match,
2741
+ "uri" => uri,
2742
+ "uriChecksum" => uri_checksum,
2668
2743
  }
2669
2744
  end
2670
2745
 
@@ -2675,6 +2750,7 @@ end
2675
2750
 
2676
2751
  class Login < Dry::Struct
2677
2752
  attribute :autofill_on_page_load, Types::Bool.optional.optional
2753
+ attribute :fido2_credentials, Types.Array(Fido2Credential).optional.optional
2678
2754
  attribute :password, Types::String.optional.optional
2679
2755
  attribute :password_revision_date, Types::String.optional.optional
2680
2756
  attribute :totp, Types::String.optional.optional
@@ -2685,6 +2761,7 @@ class Login < Dry::Struct
2685
2761
  d = Types::Hash[d]
2686
2762
  new(
2687
2763
  autofill_on_page_load: d["autofillOnPageLoad"],
2764
+ fido2_credentials: d["fido2Credentials"]&.map { |x| Fido2Credential.from_dynamic!(x) },
2688
2765
  password: d["password"],
2689
2766
  password_revision_date: d["passwordRevisionDate"],
2690
2767
  totp: d["totp"],
@@ -2700,6 +2777,7 @@ class Login < Dry::Struct
2700
2777
  def to_dynamic
2701
2778
  {
2702
2779
  "autofillOnPageLoad" => autofill_on_page_load,
2780
+ "fido2Credentials" => fido2_credentials&.map { |x| x.to_dynamic },
2703
2781
  "password" => password,
2704
2782
  "passwordRevisionDate" => password_revision_date,
2705
2783
  "totp" => totp,
@@ -3442,6 +3520,12 @@ class ResponseForUserAPIKeyResponse < Dry::Struct
3442
3520
  end
3443
3521
  end
3444
3522
 
3523
+ class String1
3524
+ def self.from_json!(json)
3525
+ JSON.parse(json, quirks_mode: true)
3526
+ end
3527
+ end
3528
+
3445
3529
  class EncString
3446
3530
  def self.from_json!(json)
3447
3531
  JSON.parse(json, quirks_mode: true)
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BitwardenSDKSecrets
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitwarden-sdk-secrets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitwarden Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-23 00:00:00.000000000 Z
11
+ date: 2024-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct