bitwarden-sdk-secrets 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb13c1b0f2375b0588c8165f5f62ef535cf764db90a25b0dccf8fa7e54dca006
4
- data.tar.gz: a59086cc47ad50cbc4051198f839eaec988014bbf23a2517c2d5e3bffe35a103
3
+ metadata.gz: 9d3fbb1bb7ea36a7adbc189d3c0b4613aef4db3da8379893b79f4cf49dcf700d
4
+ data.tar.gz: 315a2b1594335ef2a0b9eb72d3c1fb78c6c764b625d3257ba17d9cfa8660f523
5
5
  SHA512:
6
- metadata.gz: 4a38039296e5d75af2b1bd81662cc789d2bfb40d66c40a9e0b39d07571e3d60eb47a918910d5d126036818825cafd8c3edc7db6801fa168b77febdac2a952f61
7
- data.tar.gz: d9dadcf1ab1e2315ab62ba4ec0332836890d7a5f401990e6db2cff888a7b7df182177737f13987a2e297bc7c3fdb10e585a54d5a465db37749d2fd7e7293a212
6
+ metadata.gz: c67e222e8f46b4a1cafc7749d3c65e6012dd8b9a9d3732950eed527ba72542551638b8cbe82546ce4a3045e3c3253b49a501ceba722ce30253b13d5482c82d29
7
+ data.tar.gz: 5b5f6de86a461106b094a947d7cb81f5f17ed3f461d60aca598b2fca5dfb80962a8a9657d28b78479f9bb7104aed45fb904c4dcc6e5a3ea4600b664438f30ef4
data/lib/auth.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'bitwarden_error'
3
+
4
+ module BitwardenSDKSecrets
5
+ class AuthClient
6
+ def initialize(command_runner)
7
+ @command_runner = command_runner
8
+ end
9
+
10
+ def login_access_token(access_token, state_file = nil)
11
+ access_token_request = AccessTokenLoginRequest.new(access_token: access_token, state_file: state_file)
12
+ @command_runner.run(SelectiveCommand.new(login_access_token: access_token_request))
13
+ nil
14
+ end
15
+ end
16
+ end
@@ -10,6 +10,7 @@ require_relative 'bitwarden_lib'
10
10
  require_relative 'bitwarden_error'
11
11
  require_relative 'projects'
12
12
  require_relative 'secrets'
13
+ require_relative 'auth'
13
14
 
14
15
  module BitwardenSDKSecrets
15
16
  class BitwardenSettings
@@ -26,7 +27,7 @@ module BitwardenSDKSecrets
26
27
  end
27
28
 
28
29
  class BitwardenClient
29
- attr_reader :bitwarden, :project_client, :secrets_client
30
+ attr_reader :bitwarden, :projects, :secrets, :auth
30
31
 
31
32
  def initialize(bitwarden_settings)
32
33
  client_settings = ClientSettings.new(
@@ -39,14 +40,9 @@ module BitwardenSDKSecrets
39
40
  @bitwarden = BitwardenLib
40
41
  @handle = @bitwarden.init(client_settings.to_dynamic.compact.to_json)
41
42
  @command_runner = CommandRunner.new(@bitwarden, @handle)
42
- @project_client = ProjectsClient.new(@command_runner)
43
- @secrets_client = SecretsClient.new(@command_runner)
44
- end
45
-
46
- def access_token_login(access_token, state_file = nil)
47
- access_token_request = AccessTokenLoginRequest.new(access_token: access_token, state_file: state_file)
48
- @command_runner.run(SelectiveCommand.new(access_token_login: access_token_request))
49
- nil
43
+ @projects = ProjectsClient.new(@command_runner)
44
+ @secrets = SecretsClient.new(@command_runner)
45
+ @auth = AuthClient.new(@command_runner)
50
46
  end
51
47
 
52
48
  def free_mem
@@ -3,23 +3,25 @@ module BitwardenSDKSecrets
3
3
  class SelectiveCommand < Command
4
4
  attribute :password_login, PasswordLoginRequest.optional.default(nil)
5
5
  attribute :api_key_login, APIKeyLoginRequest.optional.default(nil)
6
- attribute :access_token_login, AccessTokenLoginRequest.optional.default(nil)
6
+ attribute :login_access_token, AccessTokenLoginRequest.optional.default(nil)
7
7
  attribute :get_user_api_key, SecretVerificationRequest.optional.default(nil)
8
8
  attribute :fingerprint, FingerprintRequest.optional.default(nil)
9
9
  attribute :sync, SyncRequest.optional.default(nil)
10
10
  attribute :secrets, SecretsCommand.optional.default(nil)
11
11
  attribute :projects, ProjectsCommand.optional.default(nil)
12
+ attribute :generators, GeneratorsCommand.optional.default(nil)
12
13
 
13
14
  def to_dynamic
14
15
  {
15
16
  "passwordLogin" => password_login&.to_dynamic,
16
17
  "apiKeyLogin" => api_key_login&.to_dynamic,
17
- "accessTokenLogin" => access_token_login&.to_dynamic,
18
+ "loginAccessToken" => login_access_token&.to_dynamic,
18
19
  "getUserApiKey" => get_user_api_key&.to_dynamic,
19
20
  "fingerprint" => fingerprint&.to_dynamic,
20
21
  "sync" => sync&.to_dynamic,
21
22
  "secrets" => secrets&.to_dynamic,
22
23
  "projects" => projects&.to_dynamic,
24
+ "generators" => generators&.to_dynamic,
23
25
  }.compact
24
26
  end
25
27
  end
@@ -49,6 +51,7 @@ module BitwardenSDKSecrets
49
51
  attribute :list, SecretIdentifiersRequest.optional.default(nil)
50
52
  attribute :update, SecretPutRequest.optional.default(nil)
51
53
  attribute :delete, SecretsDeleteRequest.optional.default(nil)
54
+ attribute :sync, SecretsSyncRequest.optional.default(nil)
52
55
 
53
56
  def to_dynamic
54
57
  {
@@ -58,7 +61,18 @@ module BitwardenSDKSecrets
58
61
  "list" => list&.to_dynamic,
59
62
  "update" => update&.to_dynamic,
60
63
  "delete" => delete&.to_dynamic,
64
+ "sync" => sync&.to_dynamic,
61
65
  }.compact
62
66
  end
63
67
  end
68
+
69
+ class SelectiveGeneratorsCommand < GeneratorsCommand
70
+ attribute :generate_password, PasswordGeneratorRequest.optional.default(nil)
71
+
72
+ def to_dynamic
73
+ {
74
+ "generate_password" => generate_password&.to_dynamic,
75
+ }.compact
76
+ end
77
+ end
64
78
  end
Binary file
Binary file
Binary file
data/lib/projects.rb CHANGED
@@ -8,7 +8,7 @@ module BitwardenSDKSecrets
8
8
  @command_runner = command_runner
9
9
  end
10
10
 
11
- def create_project(project_name, organization_id)
11
+ def create(organization_id, project_name)
12
12
  project_create_request = ProjectCreateRequest.new(
13
13
  project_create_request_name: project_name,
14
14
  organization_id: organization_id
@@ -43,7 +43,7 @@ module BitwardenSDKSecrets
43
43
  error_response(projects_response)
44
44
  end
45
45
 
46
- def list_projects(organization_id)
46
+ def list(organization_id)
47
47
  project_list_request = ProjectsListRequest.new(organization_id: organization_id)
48
48
  command = create_command(list: project_list_request)
49
49
  response = parse_response(command)
@@ -58,7 +58,7 @@ module BitwardenSDKSecrets
58
58
  error_response(projects_response)
59
59
  end
60
60
 
61
- def update_project(id, project_put_request_name, organization_id)
61
+ def update(organization_id, id, project_put_request_name)
62
62
  project_put_request = ProjectPutRequest.new(
63
63
  id: id,
64
64
  project_put_request_name: project_put_request_name,
@@ -79,7 +79,7 @@ module BitwardenSDKSecrets
79
79
  error_response(projects_response)
80
80
  end
81
81
 
82
- def delete_projects(ids)
82
+ def delete(ids)
83
83
  project_delete_request = ProjectsDeleteRequest.new(ids: ids)
84
84
  command = create_command(delete: project_delete_request)
85
85
  response = parse_response(command)
data/lib/schemas.rb CHANGED
@@ -10,14 +10,11 @@
10
10
  # puts device_type == DeviceType::Android
11
11
  #
12
12
  # command = Command.from_json! "{…}"
13
- # puts command.projects&.delete&.ids.first
13
+ # puts command.generators&.generate_password.avoid_ambiguous
14
14
  #
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
- #
21
18
  # two_factor_request = TwoFactorRequest.from_json! "{…}"
22
19
  # puts two_factor_request.provider == TwoFactorProvider::Authenticator
23
20
  #
@@ -43,7 +40,7 @@
43
40
  # puts sync_request.exclude_subdomains.nil?
44
41
  #
45
42
  # secrets_command = SecretsCommand.from_json! "{…}"
46
- # puts secrets_command.delete&.ids.first
43
+ # puts secrets_command.sync&.last_synced_date.nil?
47
44
  #
48
45
  # secret_get_request = SecretGetRequest.from_json! "{…}"
49
46
  # puts secret_get_request.id
@@ -63,6 +60,9 @@
63
60
  # secrets_delete_request = SecretsDeleteRequest.from_json! "{…}"
64
61
  # puts secrets_delete_request.ids.first
65
62
  #
63
+ # secrets_sync_request = SecretsSyncRequest.from_json! "{…}"
64
+ # puts secrets_sync_request.last_synced_date.nil?
65
+ #
66
66
  # projects_command = ProjectsCommand.from_json! "{…}"
67
67
  # puts projects_command.delete&.ids.first
68
68
  #
@@ -81,6 +81,12 @@
81
81
  # projects_delete_request = ProjectsDeleteRequest.from_json! "{…}"
82
82
  # puts projects_delete_request.ids.first
83
83
  #
84
+ # generators_command = GeneratorsCommand.from_json! "{…}"
85
+ # puts generators_command.generate_password.avoid_ambiguous
86
+ #
87
+ # password_generator_request = PasswordGeneratorRequest.from_json! "{…}"
88
+ # puts password_generator_request.avoid_ambiguous
89
+ #
84
90
  # response_for_api_key_login_response = ResponseForAPIKeyLoginResponse.from_json! "{…}"
85
91
  # puts response_for_api_key_login_response.data&.authenticated
86
92
  #
@@ -153,6 +159,12 @@
153
159
  # secret_delete_response = SecretDeleteResponse.from_json! "{…}"
154
160
  # puts secret_delete_response.error.nil?
155
161
  #
162
+ # response_for_secrets_sync_response = ResponseForSecretsSyncResponse.from_json! "{…}"
163
+ # puts response_for_secrets_sync_response.data&.has_changes
164
+ #
165
+ # secrets_sync_response = SecretsSyncResponse.from_json! "{…}"
166
+ # puts secrets_sync_response.has_changes
167
+ #
156
168
  # response_for_project_response = ResponseForProjectResponse.from_json! "{…}"
157
169
  # puts response_for_project_response.data&.creation_date
158
170
  #
@@ -174,6 +186,9 @@
174
186
  # project_delete_response = ProjectDeleteResponse.from_json! "{…}"
175
187
  # puts project_delete_response.error.nil?
176
188
  #
189
+ # response_for_string = ResponseForString.from_json! "{…}"
190
+ # puts response_for_string.data.nil?
191
+ #
177
192
  # response_for_fingerprint_response = ResponseForFingerprintResponse.from_json! "{…}"
178
193
  # puts response_for_fingerprint_response.data&.fingerprint
179
194
  #
@@ -181,10 +196,10 @@
181
196
  # puts fingerprint_response.fingerprint
182
197
  #
183
198
  # response_for_sync_response = ResponseForSyncResponse.from_json! "{…}"
184
- # puts response_for_sync_response.data&.sends.first.access_count.even?
199
+ # puts response_for_sync_response.data&.profile.organizations.first.id
185
200
  #
186
201
  # sync_response = SyncResponse.from_json! "{…}"
187
- # puts sync_response.sends.first.access_count.even?
202
+ # puts sync_response.profile.organizations.first.id
188
203
  #
189
204
  # profile_response = ProfileResponse.from_json! "{…}"
190
205
  # puts profile_response.organizations.first.id
@@ -267,24 +282,6 @@
267
282
  # global_domains = GlobalDomains.from_json! "{…}"
268
283
  # puts global_domains.domains.first
269
284
  #
270
- # policy = Policy.from_json! "{…}"
271
- # puts policy.data&["…"]
272
- #
273
- # policy_type = PolicyType.from_json! "…"
274
- # puts policy_type == PolicyType::ActivateAutofill
275
- #
276
- # send = Send.from_json! "{…}"
277
- # puts send.access_count.even?
278
- #
279
- # send_type = SendType.from_json! "…"
280
- # puts send_type == SendType::File
281
- #
282
- # send_file = SendFile.from_json! "{…}"
283
- # puts send_file.file_name
284
- #
285
- # send_text = SendText.from_json! "{…}"
286
- # puts send_text.hidden
287
- #
288
285
  # response_for_user_api_key_response = ResponseForUserAPIKeyResponse.from_json! "{…}"
289
286
  # puts response_for_user_api_key_response.data&.api_key
290
287
  #
@@ -313,8 +310,6 @@ module Types
313
310
  URIMatchType = Strict::String.enum("domain", "exact", "host", "never", "regularExpression", "startsWith")
314
311
  CipherRepromptType = Strict::String.enum("None", "Password")
315
312
  SecureNoteType = Strict::String.enum("Generic")
316
- PolicyType = Strict::String.enum("ActivateAutofill", "DisablePersonalVaultExport", "DisableSend", "MasterPassword", "MaximumVaultTimeout", "PasswordGenerator", "PersonalOwnership", "RequireSso", "ResetPassword", "SendOptions", "SingleOrg", "TwoFactorAuthentication")
317
- SendType = Strict::String.enum("File", "Text")
318
313
  LoginLinkedIDType = Strict::String.enum("Password", "Username")
319
314
  CardLinkedIDType = Strict::String.enum("Brand", "CardholderName", "Code", "ExpMonth", "ExpYear", "Number")
320
315
  IdentityLinkedIDType = Strict::String.enum("Address1", "Address2", "Address3", "City", "Company", "Country", "Email", "FirstName", "FullName", "LastName", "LicenseNumber", "MiddleName", "PassportNumber", "Phone", "PostalCode", "Ssn", "State", "Title", "Username")
@@ -352,8 +347,8 @@ end
352
347
  #
353
348
  # Defaults to
354
349
  #
355
- # ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; let settings
356
- # = ClientSettings { identity_url: "https://identity.bitwarden.com".to_string(), api_url:
350
+ # ``` # use bitwarden_core::{ClientSettings, DeviceType}; let settings = ClientSettings {
351
+ # identity_url: "https://identity.bitwarden.com".to_string(), api_url:
357
352
  # "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(),
358
353
  # device_type: DeviceType::SDK, }; let default = ClientSettings::default(); ```
359
354
  class ClientSettings < Dry::Struct
@@ -399,38 +394,6 @@ class ClientSettings < Dry::Struct
399
394
  end
400
395
  end
401
396
 
402
- # Login to Bitwarden with access token
403
- class AccessTokenLoginRequest < Dry::Struct
404
-
405
- # Bitwarden service API access token
406
- attribute :access_token, Types::String
407
-
408
- attribute :state_file, Types::String.optional.optional
409
-
410
- def self.from_dynamic!(d)
411
- d = Types::Hash[d]
412
- new(
413
- access_token: d.fetch("accessToken"),
414
- state_file: d["stateFile"],
415
- )
416
- end
417
-
418
- def self.from_json!(json)
419
- from_dynamic!(JSON.parse(json))
420
- end
421
-
422
- def to_dynamic
423
- {
424
- "accessToken" => access_token,
425
- "stateFile" => state_file,
426
- }
427
- end
428
-
429
- def to_json(options = nil)
430
- JSON.generate(to_dynamic, options)
431
- end
432
- end
433
-
434
397
  # Login to Bitwarden with Api Key
435
398
  class APIKeyLoginRequest < Dry::Struct
436
399
 
@@ -501,6 +464,113 @@ class FingerprintRequest < Dry::Struct
501
464
  end
502
465
  end
503
466
 
467
+ # Password generator request options.
468
+ class PasswordGeneratorRequest < Dry::Struct
469
+
470
+ # When set to true, the generated password will not contain ambiguous characters. The
471
+ # ambiguous characters are: I, O, l, 0, 1
472
+ attribute :avoid_ambiguous, Types::Bool
473
+
474
+ # The length of the generated password. Note that the password length must be greater than
475
+ # the sum of all the minimums.
476
+ attribute :length, Types::Integer
477
+
478
+ # Include lowercase characters (a-z).
479
+ attribute :lowercase, Types::Bool
480
+
481
+ # The minimum number of lowercase characters in the generated password. When set, the value
482
+ # must be between 1 and 9. This value is ignored if lowercase is false.
483
+ attribute :min_lowercase, Types::Integer.optional.optional
484
+
485
+ # The minimum number of numbers in the generated password. When set, the value must be
486
+ # between 1 and 9. This value is ignored if numbers is false.
487
+ attribute :min_number, Types::Integer.optional.optional
488
+
489
+ # The minimum number of special characters in the generated password. When set, the value
490
+ # must be between 1 and 9. This value is ignored if special is false.
491
+ attribute :min_special, Types::Integer.optional.optional
492
+
493
+ # The minimum number of uppercase characters in the generated password. When set, the value
494
+ # must be between 1 and 9. This value is ignored if uppercase is false.
495
+ attribute :min_uppercase, Types::Integer.optional.optional
496
+
497
+ # Include numbers (0-9).
498
+ attribute :numbers, Types::Bool
499
+
500
+ # Include special characters: ! @ # $ % ^ & *
501
+ attribute :special, Types::Bool
502
+
503
+ # Include uppercase characters (A-Z).
504
+ attribute :uppercase, Types::Bool
505
+
506
+ def self.from_dynamic!(d)
507
+ d = Types::Hash[d]
508
+ new(
509
+ avoid_ambiguous: d.fetch("avoidAmbiguous"),
510
+ length: d.fetch("length"),
511
+ lowercase: d.fetch("lowercase"),
512
+ min_lowercase: d["minLowercase"],
513
+ min_number: d["minNumber"],
514
+ min_special: d["minSpecial"],
515
+ min_uppercase: d["minUppercase"],
516
+ numbers: d.fetch("numbers"),
517
+ special: d.fetch("special"),
518
+ uppercase: d.fetch("uppercase"),
519
+ )
520
+ end
521
+
522
+ def self.from_json!(json)
523
+ from_dynamic!(JSON.parse(json))
524
+ end
525
+
526
+ def to_dynamic
527
+ {
528
+ "avoidAmbiguous" => avoid_ambiguous,
529
+ "length" => length,
530
+ "lowercase" => lowercase,
531
+ "minLowercase" => min_lowercase,
532
+ "minNumber" => min_number,
533
+ "minSpecial" => min_special,
534
+ "minUppercase" => min_uppercase,
535
+ "numbers" => numbers,
536
+ "special" => special,
537
+ "uppercase" => uppercase,
538
+ }
539
+ end
540
+
541
+ def to_json(options = nil)
542
+ JSON.generate(to_dynamic, options)
543
+ end
544
+ end
545
+
546
+ # Generate a password
547
+ #
548
+ # Returns: [String]
549
+ class GeneratorsCommand < Dry::Struct
550
+ attribute :generate_password, PasswordGeneratorRequest
551
+
552
+ def self.from_dynamic!(d)
553
+ d = Types::Hash[d]
554
+ new(
555
+ generate_password: PasswordGeneratorRequest.from_dynamic!(d.fetch("generatePassword")),
556
+ )
557
+ end
558
+
559
+ def self.from_json!(json)
560
+ from_dynamic!(JSON.parse(json))
561
+ end
562
+
563
+ def to_dynamic
564
+ {
565
+ "generatePassword" => generate_password.to_dynamic,
566
+ }
567
+ end
568
+
569
+ def to_json(options = nil)
570
+ JSON.generate(to_dynamic, options)
571
+ end
572
+ end
573
+
504
574
  class SecretVerificationRequest < Dry::Struct
505
575
 
506
576
  # The user's master password to use for user verification. If supplied, this will be used
@@ -536,6 +606,38 @@ class SecretVerificationRequest < Dry::Struct
536
606
  end
537
607
  end
538
608
 
609
+ # Login to Bitwarden with access token
610
+ class AccessTokenLoginRequest < Dry::Struct
611
+
612
+ # Bitwarden service API access token
613
+ attribute :access_token, Types::String
614
+
615
+ attribute :state_file, Types::String.optional.optional
616
+
617
+ def self.from_dynamic!(d)
618
+ d = Types::Hash[d]
619
+ new(
620
+ access_token: d.fetch("accessToken"),
621
+ state_file: d["stateFile"],
622
+ )
623
+ end
624
+
625
+ def self.from_json!(json)
626
+ from_dynamic!(JSON.parse(json))
627
+ end
628
+
629
+ def to_dynamic
630
+ {
631
+ "accessToken" => access_token,
632
+ "stateFile" => state_file,
633
+ }
634
+ end
635
+
636
+ def to_json(options = nil)
637
+ JSON.generate(to_dynamic, options)
638
+ end
639
+ end
640
+
539
641
  class Argon2ID < Dry::Struct
540
642
  attribute :iterations, Types::Integer
541
643
  attribute :memory, Types::Integer
@@ -1076,6 +1178,38 @@ class SecretIdentifiersRequest < Dry::Struct
1076
1178
  end
1077
1179
  end
1078
1180
 
1181
+ class SecretsSyncRequest < Dry::Struct
1182
+
1183
+ # Optional date time a sync last occurred
1184
+ attribute :last_synced_date, Types::String.optional.optional
1185
+
1186
+ # Organization to sync secrets from
1187
+ attribute :organization_id, Types::String
1188
+
1189
+ def self.from_dynamic!(d)
1190
+ d = Types::Hash[d]
1191
+ new(
1192
+ last_synced_date: d["lastSyncedDate"],
1193
+ organization_id: d.fetch("organizationId"),
1194
+ )
1195
+ end
1196
+
1197
+ def self.from_json!(json)
1198
+ from_dynamic!(JSON.parse(json))
1199
+ end
1200
+
1201
+ def to_dynamic
1202
+ {
1203
+ "lastSyncedDate" => last_synced_date,
1204
+ "organizationId" => organization_id,
1205
+ }
1206
+ end
1207
+
1208
+ def to_json(options = nil)
1209
+ JSON.generate(to_dynamic, options)
1210
+ end
1211
+ end
1212
+
1079
1213
  class SecretPutRequest < Dry::Struct
1080
1214
 
1081
1215
  # ID of the secret to modify
@@ -1154,6 +1288,13 @@ end
1154
1288
  #
1155
1289
  # Returns:
1156
1290
  # [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)
1291
+ #
1292
+ # > Requires Authentication > Requires using an Access Token for login Retrieve the secrets
1293
+ # accessible by the authenticated machine account Optionally, provide the last synced date
1294
+ # to assess whether any changes have occurred If changes are detected, retrieves all the
1295
+ # secrets accessible by the authenticated machine account
1296
+ #
1297
+ # Returns: [SecretsSyncResponse](bitwarden::secrets_manager::secrets::SecretsSyncResponse)
1157
1298
  class SecretsCommand < Dry::Struct
1158
1299
  attribute :get, SecretGetRequest.optional
1159
1300
  attribute :get_by_ids, SecretsGetRequest.optional
@@ -1161,6 +1302,7 @@ class SecretsCommand < Dry::Struct
1161
1302
  attribute :list, SecretIdentifiersRequest.optional
1162
1303
  attribute :update, SecretPutRequest.optional
1163
1304
  attribute :delete, SecretsDeleteRequest.optional
1305
+ attribute :sync, SecretsSyncRequest.optional
1164
1306
 
1165
1307
  def self.from_dynamic!(d)
1166
1308
  d = Types::Hash[d]
@@ -1171,6 +1313,7 @@ class SecretsCommand < Dry::Struct
1171
1313
  list: d["list"] ? SecretIdentifiersRequest.from_dynamic!(d["list"]) : nil,
1172
1314
  update: d["update"] ? SecretPutRequest.from_dynamic!(d["update"]) : nil,
1173
1315
  delete: d["delete"] ? SecretsDeleteRequest.from_dynamic!(d["delete"]) : nil,
1316
+ sync: d["sync"] ? SecretsSyncRequest.from_dynamic!(d["sync"]) : nil,
1174
1317
  )
1175
1318
  end
1176
1319
 
@@ -1186,6 +1329,7 @@ class SecretsCommand < Dry::Struct
1186
1329
  "list" => list&.to_dynamic,
1187
1330
  "update" => update&.to_dynamic,
1188
1331
  "delete" => delete&.to_dynamic,
1332
+ "sync" => sync&.to_dynamic,
1189
1333
  }
1190
1334
  end
1191
1335
 
@@ -1254,28 +1398,30 @@ end
1254
1398
  # > Requires Authentication Retrieve all user data, ciphers and organizations the user is a
1255
1399
  # part of
1256
1400
  #
1257
- # Returns: [SyncResponse](bitwarden::platform::SyncResponse)
1401
+ # Returns: [SyncResponse](bitwarden::vault::SyncResponse)
1258
1402
  class Command < Dry::Struct
1259
1403
  attribute :password_login, PasswordLoginRequest.optional
1260
1404
  attribute :api_key_login, APIKeyLoginRequest.optional
1261
- attribute :access_token_login, AccessTokenLoginRequest.optional
1405
+ attribute :login_access_token, AccessTokenLoginRequest.optional
1262
1406
  attribute :get_user_api_key, SecretVerificationRequest.optional
1263
1407
  attribute :fingerprint, FingerprintRequest.optional
1264
1408
  attribute :sync, SyncRequest.optional
1265
1409
  attribute :secrets, SecretsCommand.optional
1266
1410
  attribute :projects, ProjectsCommand.optional
1411
+ attribute :generators, GeneratorsCommand.optional
1267
1412
 
1268
1413
  def self.from_dynamic!(d)
1269
1414
  d = Types::Hash[d]
1270
1415
  new(
1271
1416
  password_login: d["passwordLogin"] ? PasswordLoginRequest.from_dynamic!(d["passwordLogin"]) : nil,
1272
1417
  api_key_login: d["apiKeyLogin"] ? APIKeyLoginRequest.from_dynamic!(d["apiKeyLogin"]) : nil,
1273
- access_token_login: d["accessTokenLogin"] ? AccessTokenLoginRequest.from_dynamic!(d["accessTokenLogin"]) : nil,
1418
+ login_access_token: d["loginAccessToken"] ? AccessTokenLoginRequest.from_dynamic!(d["loginAccessToken"]) : nil,
1274
1419
  get_user_api_key: d["getUserApiKey"] ? SecretVerificationRequest.from_dynamic!(d["getUserApiKey"]) : nil,
1275
1420
  fingerprint: d["fingerprint"] ? FingerprintRequest.from_dynamic!(d["fingerprint"]) : nil,
1276
1421
  sync: d["sync"] ? SyncRequest.from_dynamic!(d["sync"]) : nil,
1277
1422
  secrets: d["secrets"] ? SecretsCommand.from_dynamic!(d["secrets"]) : nil,
1278
1423
  projects: d["projects"] ? ProjectsCommand.from_dynamic!(d["projects"]) : nil,
1424
+ generators: d["generators"] ? GeneratorsCommand.from_dynamic!(d["generators"]) : nil,
1279
1425
  )
1280
1426
  end
1281
1427
 
@@ -1287,12 +1433,13 @@ class Command < Dry::Struct
1287
1433
  {
1288
1434
  "passwordLogin" => password_login&.to_dynamic,
1289
1435
  "apiKeyLogin" => api_key_login&.to_dynamic,
1290
- "accessTokenLogin" => access_token_login&.to_dynamic,
1436
+ "loginAccessToken" => login_access_token&.to_dynamic,
1291
1437
  "getUserApiKey" => get_user_api_key&.to_dynamic,
1292
1438
  "fingerprint" => fingerprint&.to_dynamic,
1293
1439
  "sync" => sync&.to_dynamic,
1294
1440
  "secrets" => secrets&.to_dynamic,
1295
1441
  "projects" => projects&.to_dynamic,
1442
+ "generators" => generators&.to_dynamic,
1296
1443
  }
1297
1444
  end
1298
1445
 
@@ -2095,6 +2242,71 @@ class ResponseForSecretsDeleteResponse < Dry::Struct
2095
2242
  end
2096
2243
  end
2097
2244
 
2245
+ class SecretsSyncResponse < Dry::Struct
2246
+ attribute :has_changes, Types::Bool
2247
+ attribute :secrets, Types.Array(SecretResponse).optional.optional
2248
+
2249
+ def self.from_dynamic!(d)
2250
+ d = Types::Hash[d]
2251
+ new(
2252
+ has_changes: d.fetch("hasChanges"),
2253
+ secrets: d["secrets"]&.map { |x| SecretResponse.from_dynamic!(x) },
2254
+ )
2255
+ end
2256
+
2257
+ def self.from_json!(json)
2258
+ from_dynamic!(JSON.parse(json))
2259
+ end
2260
+
2261
+ def to_dynamic
2262
+ {
2263
+ "hasChanges" => has_changes,
2264
+ "secrets" => secrets&.map { |x| x.to_dynamic },
2265
+ }
2266
+ end
2267
+
2268
+ def to_json(options = nil)
2269
+ JSON.generate(to_dynamic, options)
2270
+ end
2271
+ end
2272
+
2273
+ class ResponseForSecretsSyncResponse < Dry::Struct
2274
+
2275
+ # The response data. Populated if `success` is true.
2276
+ attribute :data, SecretsSyncResponse.optional.optional
2277
+
2278
+ # A message for any error that may occur. Populated if `success` is false.
2279
+ attribute :error_message, Types::String.optional.optional
2280
+
2281
+ # Whether or not the SDK request succeeded.
2282
+ attribute :success, Types::Bool
2283
+
2284
+ def self.from_dynamic!(d)
2285
+ d = Types::Hash[d]
2286
+ new(
2287
+ data: d["data"] ? SecretsSyncResponse.from_dynamic!(d["data"]) : nil,
2288
+ error_message: d["errorMessage"],
2289
+ success: d.fetch("success"),
2290
+ )
2291
+ end
2292
+
2293
+ def self.from_json!(json)
2294
+ from_dynamic!(JSON.parse(json))
2295
+ end
2296
+
2297
+ def to_dynamic
2298
+ {
2299
+ "data" => data&.to_dynamic,
2300
+ "errorMessage" => error_message,
2301
+ "success" => success,
2302
+ }
2303
+ end
2304
+
2305
+ def to_json(options = nil)
2306
+ JSON.generate(to_dynamic, options)
2307
+ end
2308
+ end
2309
+
2098
2310
  class ProjectResponse < Dry::Struct
2099
2311
  attribute :creation_date, Types::String
2100
2312
  attribute :id, Types::String
@@ -2321,6 +2533,43 @@ class ResponseForProjectsDeleteResponse < Dry::Struct
2321
2533
  end
2322
2534
  end
2323
2535
 
2536
+ class ResponseForString < Dry::Struct
2537
+
2538
+ # The response data. Populated if `success` is true.
2539
+ attribute :data, Types::String.optional.optional
2540
+
2541
+ # A message for any error that may occur. Populated if `success` is false.
2542
+ attribute :error_message, Types::String.optional.optional
2543
+
2544
+ # Whether or not the SDK request succeeded.
2545
+ attribute :success, Types::Bool
2546
+
2547
+ def self.from_dynamic!(d)
2548
+ d = Types::Hash[d]
2549
+ new(
2550
+ data: d["data"],
2551
+ error_message: d["errorMessage"],
2552
+ success: d.fetch("success"),
2553
+ )
2554
+ end
2555
+
2556
+ def self.from_json!(json)
2557
+ from_dynamic!(JSON.parse(json))
2558
+ end
2559
+
2560
+ def to_dynamic
2561
+ {
2562
+ "data" => data,
2563
+ "errorMessage" => error_message,
2564
+ "success" => success,
2565
+ }
2566
+ end
2567
+
2568
+ def to_json(options = nil)
2569
+ JSON.generate(to_dynamic, options)
2570
+ end
2571
+ end
2572
+
2324
2573
  class FingerprintResponse < Dry::Struct
2325
2574
  attribute :fingerprint, Types::String
2326
2575
 
@@ -3081,58 +3330,6 @@ class Folder < Dry::Struct
3081
3330
  end
3082
3331
  end
3083
3332
 
3084
- module PolicyType
3085
- ActivateAutofill = "ActivateAutofill"
3086
- DisablePersonalVaultExport = "DisablePersonalVaultExport"
3087
- DisableSend = "DisableSend"
3088
- MasterPassword = "MasterPassword"
3089
- MaximumVaultTimeout = "MaximumVaultTimeout"
3090
- PasswordGenerator = "PasswordGenerator"
3091
- PersonalOwnership = "PersonalOwnership"
3092
- RequireSso = "RequireSso"
3093
- ResetPassword = "ResetPassword"
3094
- SendOptions = "SendOptions"
3095
- SingleOrg = "SingleOrg"
3096
- TwoFactorAuthentication = "TwoFactorAuthentication"
3097
- end
3098
-
3099
- class Policy < Dry::Struct
3100
- attribute :data, Types::Hash.meta(of: Types::Any).optional.optional
3101
- attribute :enabled, Types::Bool
3102
- attribute :id, Types::String
3103
- attribute :organization_id, Types::String
3104
- attribute :policy_type, Types::PolicyType
3105
-
3106
- def self.from_dynamic!(d)
3107
- d = Types::Hash[d]
3108
- new(
3109
- data: Types::Hash.optional[d["data"]]&.map { |k, v| [k, Types::Any[v]] }&.to_h,
3110
- enabled: d.fetch("enabled"),
3111
- id: d.fetch("id"),
3112
- organization_id: d.fetch("organization_id"),
3113
- policy_type: d.fetch("type"),
3114
- )
3115
- end
3116
-
3117
- def self.from_json!(json)
3118
- from_dynamic!(JSON.parse(json))
3119
- end
3120
-
3121
- def to_dynamic
3122
- {
3123
- "data" => data,
3124
- "enabled" => enabled,
3125
- "id" => id,
3126
- "organization_id" => organization_id,
3127
- "type" => policy_type,
3128
- }
3129
- end
3130
-
3131
- def to_json(options = nil)
3132
- JSON.generate(to_dynamic, options)
3133
- end
3134
- end
3135
-
3136
3333
  class ProfileOrganizationResponse < Dry::Struct
3137
3334
  attribute :id, Types::String
3138
3335
 
@@ -3194,145 +3391,6 @@ class ProfileResponse < Dry::Struct
3194
3391
  end
3195
3392
  end
3196
3393
 
3197
- class SendFile < Dry::Struct
3198
- attribute :file_name, Types::String
3199
- attribute :id, Types::String.optional.optional
3200
- attribute :size, Types::String.optional.optional
3201
-
3202
- # Readable size, ex: "4.2 KB" or "1.43 GB"
3203
- attribute :size_name, Types::String.optional.optional
3204
-
3205
- def self.from_dynamic!(d)
3206
- d = Types::Hash[d]
3207
- new(
3208
- file_name: d.fetch("fileName"),
3209
- id: d["id"],
3210
- size: d["size"],
3211
- size_name: d["sizeName"],
3212
- )
3213
- end
3214
-
3215
- def self.from_json!(json)
3216
- from_dynamic!(JSON.parse(json))
3217
- end
3218
-
3219
- def to_dynamic
3220
- {
3221
- "fileName" => file_name,
3222
- "id" => id,
3223
- "size" => size,
3224
- "sizeName" => size_name,
3225
- }
3226
- end
3227
-
3228
- def to_json(options = nil)
3229
- JSON.generate(to_dynamic, options)
3230
- end
3231
- end
3232
-
3233
- module SendType
3234
- File = "File"
3235
- Text = "Text"
3236
- end
3237
-
3238
- class SendText < Dry::Struct
3239
- attribute :hidden, Types::Bool
3240
- attribute :text, Types::String.optional.optional
3241
-
3242
- def self.from_dynamic!(d)
3243
- d = Types::Hash[d]
3244
- new(
3245
- hidden: d.fetch("hidden"),
3246
- text: d["text"],
3247
- )
3248
- end
3249
-
3250
- def self.from_json!(json)
3251
- from_dynamic!(JSON.parse(json))
3252
- end
3253
-
3254
- def to_dynamic
3255
- {
3256
- "hidden" => hidden,
3257
- "text" => text,
3258
- }
3259
- end
3260
-
3261
- def to_json(options = nil)
3262
- JSON.generate(to_dynamic, options)
3263
- end
3264
- end
3265
-
3266
- class Send < Dry::Struct
3267
- attribute :access_count, Types::Integer
3268
- attribute :access_id, Types::String.optional.optional
3269
- attribute :deletion_date, Types::String
3270
- attribute :disabled, Types::Bool
3271
- attribute :expiration_date, Types::String.optional.optional
3272
- attribute :file, SendFile.optional.optional
3273
- attribute :hide_email, Types::Bool
3274
- attribute :id, Types::String.optional.optional
3275
- attribute :key, Types::String
3276
- attribute :max_access_count, Types::Integer.optional.optional
3277
- attribute :send_name, Types::String
3278
- attribute :notes, Types::String.optional.optional
3279
- attribute :password, Types::String.optional.optional
3280
- attribute :revision_date, Types::String
3281
- attribute :text, SendText.optional.optional
3282
- attribute :send_type, Types::SendType
3283
-
3284
- def self.from_dynamic!(d)
3285
- d = Types::Hash[d]
3286
- new(
3287
- access_count: d.fetch("accessCount"),
3288
- access_id: d["accessId"],
3289
- deletion_date: d.fetch("deletionDate"),
3290
- disabled: d.fetch("disabled"),
3291
- expiration_date: d["expirationDate"],
3292
- file: d["file"] ? SendFile.from_dynamic!(d["file"]) : nil,
3293
- hide_email: d.fetch("hideEmail"),
3294
- id: d["id"],
3295
- key: d.fetch("key"),
3296
- max_access_count: d["maxAccessCount"],
3297
- send_name: d.fetch("name"),
3298
- notes: d["notes"],
3299
- password: d["password"],
3300
- revision_date: d.fetch("revisionDate"),
3301
- text: d["text"] ? SendText.from_dynamic!(d["text"]) : nil,
3302
- send_type: d.fetch("type"),
3303
- )
3304
- end
3305
-
3306
- def self.from_json!(json)
3307
- from_dynamic!(JSON.parse(json))
3308
- end
3309
-
3310
- def to_dynamic
3311
- {
3312
- "accessCount" => access_count,
3313
- "accessId" => access_id,
3314
- "deletionDate" => deletion_date,
3315
- "disabled" => disabled,
3316
- "expirationDate" => expiration_date,
3317
- "file" => file&.to_dynamic,
3318
- "hideEmail" => hide_email,
3319
- "id" => id,
3320
- "key" => key,
3321
- "maxAccessCount" => max_access_count,
3322
- "name" => send_name,
3323
- "notes" => notes,
3324
- "password" => password,
3325
- "revisionDate" => revision_date,
3326
- "text" => text&.to_dynamic,
3327
- "type" => send_type,
3328
- }
3329
- end
3330
-
3331
- def to_json(options = nil)
3332
- JSON.generate(to_dynamic, options)
3333
- end
3334
- end
3335
-
3336
3394
  class SyncResponse < Dry::Struct
3337
3395
 
3338
3396
  # List of ciphers accessible by the user
@@ -3341,14 +3399,11 @@ class SyncResponse < Dry::Struct
3341
3399
  attribute :collections, Types.Array(Collection)
3342
3400
  attribute :domains, DomainResponse.optional.optional
3343
3401
  attribute :folders, Types.Array(Folder)
3344
- attribute :policies, Types.Array(Policy)
3345
3402
 
3346
3403
  # Data about the user, including their encryption keys and the organizations they are a
3347
3404
  # part of
3348
3405
  attribute :profile, ProfileResponse
3349
3406
 
3350
- attribute :sends, Types.Array(Send)
3351
-
3352
3407
  def self.from_dynamic!(d)
3353
3408
  d = Types::Hash[d]
3354
3409
  new(
@@ -3356,9 +3411,7 @@ class SyncResponse < Dry::Struct
3356
3411
  collections: d.fetch("collections").map { |x| Collection.from_dynamic!(x) },
3357
3412
  domains: d["domains"] ? DomainResponse.from_dynamic!(d["domains"]) : nil,
3358
3413
  folders: d.fetch("folders").map { |x| Folder.from_dynamic!(x) },
3359
- policies: d.fetch("policies").map { |x| Policy.from_dynamic!(x) },
3360
3414
  profile: ProfileResponse.from_dynamic!(d.fetch("profile")),
3361
- sends: d.fetch("sends").map { |x| Send.from_dynamic!(x) },
3362
3415
  )
3363
3416
  end
3364
3417
 
@@ -3372,9 +3425,7 @@ class SyncResponse < Dry::Struct
3372
3425
  "collections" => collections.map { |x| x.to_dynamic },
3373
3426
  "domains" => domains&.to_dynamic,
3374
3427
  "folders" => folders.map { |x| x.to_dynamic },
3375
- "policies" => policies.map { |x| x.to_dynamic },
3376
3428
  "profile" => profile.to_dynamic,
3377
- "sends" => sends.map { |x| x.to_dynamic },
3378
3429
  }
3379
3430
  end
3380
3431
 
@@ -3520,12 +3571,6 @@ class ResponseForUserAPIKeyResponse < Dry::Struct
3520
3571
  end
3521
3572
  end
3522
3573
 
3523
- class String1
3524
- def self.from_json!(json)
3525
- JSON.parse(json, quirks_mode: true)
3526
- end
3527
- end
3528
-
3529
3574
  class EncString
3530
3575
  def self.from_json!(json)
3531
3576
  JSON.parse(json, quirks_mode: true)
data/lib/secrets.rb CHANGED
@@ -36,7 +36,23 @@ module BitwardenSDKSecrets
36
36
  error_response(secrets_response)
37
37
  end
38
38
 
39
- def create(key, note, organization_id, project_ids, value)
39
+ def sync(organization_id, last_synced_date)
40
+ command = create_command(
41
+ sync: SecretsSyncRequest.new(organization_id: organization_id, last_synced_date: last_synced_date)
42
+ )
43
+ response = run_command(command)
44
+
45
+ secrets_response = ResponseForSecretsSyncResponse.from_json!(response).to_dynamic
46
+
47
+ if secrets_response.key?('success') && secrets_response['success'] == true &&
48
+ secrets_response.key?('data')
49
+ return secrets_response['data']
50
+ end
51
+
52
+ error_response(secrets_response)
53
+ end
54
+
55
+ def create(organization_id, key, value, note, project_ids)
40
56
  command = create_command(
41
57
  create: SecretCreateRequest.new(
42
58
  key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value
@@ -68,7 +84,7 @@ module BitwardenSDKSecrets
68
84
  error_response(secrets_response)
69
85
  end
70
86
 
71
- def update(id, key, note, organization_id, project_ids, value)
87
+ def update(organization_id, id, key, value, note, project_ids)
72
88
  command = create_command(
73
89
  update: SecretPutRequest.new(
74
90
  id: id, key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value
@@ -86,7 +102,7 @@ module BitwardenSDKSecrets
86
102
  error_response(secrets_response)
87
103
  end
88
104
 
89
- def delete_secret(ids)
105
+ def delete(ids)
90
106
  command = create_command(delete: SecretsDeleteRequest.new(ids: ids))
91
107
  response = run_command(command)
92
108
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BitwardenSDKSecrets
4
- VERSION = '0.2.0'
4
+ VERSION = '1.0.0'
5
5
  end
Binary file
data/sig/auth.rbs ADDED
@@ -0,0 +1,9 @@
1
+ module BitwardenSDKSecrets
2
+ class AuthClient
3
+ @command_runner: untyped
4
+
5
+ def initialize: (untyped command_runner) -> void
6
+
7
+ def login_access_token: (untyped access_token, ?untyped? state_file) -> nil
8
+ end
9
+ end
@@ -0,0 +1,39 @@
1
+ module BitwardenSDKSecrets
2
+ class BitwardenSettings
3
+ @api_url: untyped
4
+
5
+ @identity_url: untyped
6
+
7
+ attr_accessor api_url: untyped
8
+
9
+ attr_accessor identity_url: untyped
10
+
11
+ def initialize: (untyped api_url, untyped identity_url) -> void
12
+ end
13
+
14
+ class BitwardenClient
15
+ @bitwarden: untyped
16
+
17
+ @handle: untyped
18
+
19
+ @command_runner: untyped
20
+
21
+ @projects: untyped
22
+
23
+ @secrets: untyped
24
+
25
+ @auth: untyped
26
+
27
+ attr_reader bitwarden: untyped
28
+
29
+ attr_reader projects: untyped
30
+
31
+ attr_reader secrets: untyped
32
+
33
+ attr_reader auth: untyped
34
+
35
+ def initialize: (untyped bitwarden_settings) -> void
36
+
37
+ def free_mem: () -> untyped
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module BitwardenSDKSecrets
2
+ class BitwardenError < StandardError
3
+ def initialize: (?::String message) -> void
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module BitwardenSDKSecrets
2
+ module BitwardenLib
3
+ extend FFI::Library
4
+
5
+ def self.mac_with_intel?: () -> untyped
6
+ end
7
+ end
@@ -1,4 +1,12 @@
1
- class CommandRunner
2
- @bitwarden_sdk: Module
3
- def run: -> String
1
+ module BitwardenSDKSecrets
2
+ class CommandRunner
3
+ @bitwarden_sdk: untyped
4
+
5
+ @handle: untyped
6
+
7
+ def initialize: (untyped bitwarden_sdk, untyped handle) -> void
8
+
9
+ # @param [Dry-Struct] cmd
10
+ def run: (untyped cmd) -> untyped
11
+ end
4
12
  end
data/sig/projects.rbs ADDED
@@ -0,0 +1,25 @@
1
+ module BitwardenSDKSecrets
2
+ class ProjectsClient
3
+ @command_runner: untyped
4
+
5
+ def initialize: (untyped command_runner) -> void
6
+
7
+ def create: (untyped organization_id, untyped project_name) -> untyped
8
+
9
+ def get: (untyped project_id) -> untyped
10
+
11
+ def list: (untyped organization_id) -> untyped
12
+
13
+ def update: (untyped organization_id, untyped id, untyped project_put_request_name) -> untyped
14
+
15
+ def delete: (untyped ids) -> untyped
16
+
17
+ private
18
+
19
+ def error_response: (untyped response) -> untyped
20
+
21
+ def create_command: (untyped commands) -> untyped
22
+
23
+ def parse_response: (untyped command) -> untyped
24
+ end
25
+ end
data/sig/secrets.rbs ADDED
@@ -0,0 +1,29 @@
1
+ module BitwardenSDKSecrets
2
+ class SecretsClient
3
+ @command_runner: untyped
4
+
5
+ def initialize: (untyped command_runner) -> void
6
+
7
+ def get: (untyped id) -> untyped
8
+
9
+ def get_by_ids: (untyped ids) -> untyped
10
+
11
+ def sync: (untyped organization_id, untyped last_synced_date) -> untyped
12
+
13
+ def create: (untyped organization_id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped
14
+
15
+ def list: (untyped organization_id) -> untyped
16
+
17
+ def update: (untyped organization_id, untyped id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped
18
+
19
+ def delete: (untyped ids) -> untyped
20
+
21
+ private
22
+
23
+ def error_response: (untyped response) -> (untyped | nil | untyped)
24
+
25
+ def create_command: (untyped commands) -> untyped
26
+
27
+ def run_command: (untyped command) -> untyped
28
+ end
29
+ end
data/sig/version.rbs ADDED
@@ -0,0 +1,3 @@
1
+ module BitwardenSDKSecrets
2
+ VERSION: "0.2.0"
3
+ end
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.2.0
4
+ version: 1.0.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-04-26 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - Rakefile
105
105
  - bitwarden-sdk-secrets.gemspec
106
+ - lib/auth.rb
106
107
  - lib/bitwarden-sdk-secrets.rb
107
108
  - lib/bitwarden_error.rb
108
109
  - lib/bitwarden_lib.rb
@@ -116,12 +117,14 @@ files:
116
117
  - lib/secrets.rb
117
118
  - lib/version.rb
118
119
  - lib/windows-x64/bitwarden_c.dll
119
- - sig/bitwarden-sdk.rbs
120
- - sig/bitwarden_settings.rbs
120
+ - sig/auth.rbs
121
+ - sig/bitwarden-sdk-secrets.rbs
122
+ - sig/bitwarden_error.rbs
123
+ - sig/bitwarden_lib.rbs
121
124
  - sig/command_runner.rbs
122
- - sig/projects_client.rbs
123
- - sig/sdk.rbs
124
- - sig/secrets_client.rbs
125
+ - sig/projects.rbs
126
+ - sig/secrets.rbs
127
+ - sig/version.rbs
125
128
  homepage: https://bitwarden.com/products/secrets-manager/
126
129
  licenses: []
127
130
  metadata:
@@ -1,13 +0,0 @@
1
- require_relative '../lib/schemas'
2
-
3
- class BitwardenClient
4
- @command_runner: CommandRunner
5
-
6
- attr_reader bitwarden: Module
7
- attr_reader project_client: ProjectsClient
8
- attr_reader secrets_client: SecretsClient
9
-
10
- def initialize: (BitwardenSettings) -> void
11
- def access_token_login: (String) -> JSON
12
- def free_mem: () -> nil
13
- end
@@ -1,8 +0,0 @@
1
- require_relative '../lib/schemas'
2
-
3
- class BitwardenSettings
4
- attr_accessor api_url: String
5
- attr_accessor identity_url: String
6
-
7
- def initialize: (String, String) -> void
8
- end
@@ -1,17 +0,0 @@
1
- require_once '../lib/extended_schemas/schemas.rbs'
2
- require_once '../schemas.rbs'
3
-
4
- class ProjectsClient
5
- @command_runner: CommandRunner
6
- def initialize: (command_runner: CommandRunner) -> void
7
- def create_project: (project_name: String, organization_id: String) -> ProjectsResponse
8
- def get: (project_id: String) -> ProjectsResponse
9
- def list_projects: (organization_id: String) -> Array(DatumElement)
10
- def update_project: (id: String, project_put_request_name: String, organization_id: String) -> ProjectsResponse
11
- def delete_projects: (ids: Array[String]) -> Array(ProjectDeleteResponse)
12
-
13
- private
14
-
15
- def create_command: (SelectiveProjectsCommand) -> SelectiveCommand
16
- def parse_response: (ResponseForProjectResponse) -> ResponseForProjectResponse
17
- end
data/sig/sdk.rbs DELETED
@@ -1,3 +0,0 @@
1
- module BitwardenSDK
2
- VERSION: String
3
- end
@@ -1,18 +0,0 @@
1
- require_once '../lib/extended_schemas/schemas.rbs'
2
- require_once '../schemas.rbs'
3
-
4
- class SecretsClient
5
- # @command_runner: CommandRunner
6
- def initialize: (command_runner: CommandRunner) -> void
7
- def get: (id: String) -> SecretResponse
8
- def get_by_ids: (ids: Array[String]) -> Array(SecretIdentifierResponse)
9
- def create: (key: String, note: String, organization_id: String, project_ids: Array[String], value: String) -> SecretResponse
10
- def list: (organization_id: String) -> Array(SecretIdentifierResponse)
11
- def update: (id: String, key: String, note: String, organization_id: String, project_ids: Array[String], value: String) -> SecretResponse
12
- def delete_secret: (ids: Array[String]) -> Array(SecretDeleteResponse)
13
-
14
- private
15
-
16
- def create_command: (SelectiveSecretsCommand) -> SelectiveCommand
17
- def parse_response: (SelectiveSecretCommand) -> ResponseForSecretResponse
18
- end