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.
- checksums.yaml +4 -4
- data/lib/auth.rb +16 -0
- data/lib/bitwarden-sdk-secrets.rb +5 -9
- data/lib/extended_schemas/schemas.rb +16 -2
- data/lib/linux-x64/libbitwarden_c.so +0 -0
- data/lib/macos-arm64/libbitwarden_c.dylib +0 -0
- data/lib/macos-x64/libbitwarden_c.dylib +0 -0
- data/lib/projects.rb +4 -4
- data/lib/schemas.rb +395 -266
- data/lib/secrets.rb +19 -3
- data/lib/version.rb +1 -1
- data/lib/windows-x64/bitwarden_c.dll +0 -0
- data/sig/auth.rbs +9 -0
- data/sig/bitwarden-sdk-secrets.rbs +39 -0
- data/sig/bitwarden_error.rbs +5 -0
- data/sig/bitwarden_lib.rbs +7 -0
- data/sig/command_runner.rbs +11 -3
- data/sig/projects.rbs +25 -0
- data/sig/secrets.rbs +29 -0
- data/sig/version.rbs +3 -0
- metadata +10 -7
- data/sig/bitwarden-sdk.rbs +0 -13
- data/sig/bitwarden_settings.rbs +0 -8
- data/sig/projects_client.rbs +0 -17
- data/sig/sdk.rbs +0 -3
- data/sig/secrets_client.rbs +0 -18
data/lib/secrets.rb
CHANGED
@@ -36,7 +36,23 @@ module BitwardenSDKSecrets
|
|
36
36
|
error_response(secrets_response)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
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,
|
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
|
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
Binary file
|
data/sig/auth.rbs
ADDED
@@ -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
|
data/sig/command_runner.rbs
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
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:
|
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-
|
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/
|
120
|
-
- sig/
|
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/
|
123
|
-
- sig/
|
124
|
-
- sig/
|
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:
|
data/sig/bitwarden-sdk.rbs
DELETED
@@ -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
|
data/sig/bitwarden_settings.rbs
DELETED
data/sig/projects_client.rbs
DELETED
@@ -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
data/sig/secrets_client.rbs
DELETED
@@ -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
|