bitwarden-sdk-secrets 0.1.0 → 1.0.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.
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.1.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.1.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-02-23 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