b4n1-secrets 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.5
2
+ Name: b4n1-secrets
3
+ Version: 0.1.0
4
+ Summary: Sovereign offline vault — committable encrypted secrets
5
+ Project-URL: Homepage, https://github.com/B4N1-com/b4n1-secrets
6
+ Project-URL: Repository, https://github.com/B4N1-com/b4n1-secrets
7
+ Author-email: Bani Montoya <banimontoya@gmail.com>
8
+ License: Business Source License 1.1
9
+
10
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
11
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
12
+
13
+ -----------------------------------------------------------------------------
14
+
15
+ Parameters
16
+
17
+ Licensor: B4N1 (b4n1.com)
18
+ Licensed Work: b4n1-web — Agentic browser engine for web automation,
19
+ testing, and AI-powered browsing tasks.
20
+ Additional Use Grant: You may use the Licensed Work in production, free of
21
+ charge, provided that your organization's total annual
22
+ gross revenue does not exceed USD $100,000. Organizations
23
+ whose annual gross revenue exceeds USD $100,000 must
24
+ obtain a commercial license from the Licensor before any
25
+ production use. You may not resell or provide the
26
+ Licensed Work as a managed commercial service without
27
+ authorization from the Licensor.
28
+ Change Date: Four years after the first publicly available
29
+ distribution of the Licensed Work under this License.
30
+ Change License: Apache License, Version 2.0
31
+
32
+ For information about alternative licensing arrangements for the Licensed
33
+ Work, please contact b4n1@b4n1.com.
34
+
35
+ -----------------------------------------------------------------------------
36
+
37
+ Terms
38
+
39
+ The Licensor hereby grants you the right to copy, modify, create derivative
40
+ works, redistribute, and make non-production use of the Licensed Work. The
41
+ Licensor may make an Additional Use Grant, above, permitting limited
42
+ production use.
43
+
44
+ Effective on the Change Date, or the fourth anniversary of the first publicly
45
+ available distribution of a specific version of the Licensed Work under this
46
+ License, whichever comes first, the Licensor hereby grants you rights under
47
+ the terms of the Change License, and the rights granted in the paragraph
48
+ above terminate.
49
+
50
+ If your use of the Licensed Work does not comply with the requirements
51
+ currently in effect as described in this License, you must purchase a
52
+ commercial license from the Licensor, its affiliated entities, or authorized
53
+ resellers, or you must refrain from using the Licensed Work.
54
+
55
+ All copies of the original and modified Licensed Work, and derivative works
56
+ of the Licensed Work, are subject to this License. This License applies
57
+ separately for each version of the Licensed Work and the Change Date may vary
58
+ for each version of the Licensed Work released by Licensor.
59
+
60
+ You must conspicuously display this License on each original or modified copy
61
+ of the Licensed Work. If you receive the Licensed Work in original or
62
+ modified form from a third party, the terms and conditions set forth in this
63
+ License apply to your use of that work.
64
+
65
+ Any use of the Licensed Work in violation of this License will automatically
66
+ terminate your rights under this License for the current and all other
67
+ versions of the Licensed Work.
68
+
69
+ This License does not grant you any right in any trademark or logo of
70
+ Licensor or its affiliates (provided that you may use a trademark or logo of
71
+ Licensor as expressly required by this License).
72
+
73
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
74
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
75
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
76
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
77
+ TITLE. MariaDB hereby grants you permission to use this License's text to
78
+ license your works, and to refer to it using the trademark "Business Source
79
+ License", as long as you comply with the Covenants of Licensor below.
80
+
81
+ Covenants of Licensor
82
+
83
+ In consideration of the right to use this License's text and the "Business
84
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
85
+ other recipients of the licensed work to be provided by Licensor:
86
+
87
+ To specify as the Change License a license that is compatible with GPL
88
+ Version 2.0 or a later version, where "compatible" means that software
89
+ provided under the Change License can be included in a program with software
90
+ provided under GPL Version 2.0 or a later version. Licensor may specify
91
+ additional Change Licenses without limitation.
92
+
93
+ To either: (a) specify an additional grant of rights to use that does not
94
+ impose any additional restriction on the right granted in this License, as
95
+ the Additional Use Grant; or (b) insert the text "None" to specify a Change
96
+ License. Not to modify this License in any other way.
97
+
98
+ Notice
99
+
100
+ The Business Source License (this document, or the "License") is not an Open
101
+ Source license. However, the Licensed Work will eventually be made available
102
+ under an Open Source License, as stated in this License.
103
+ License-File: LICENSE
104
+ Classifier: Development Status :: 4 - Beta
105
+ Classifier: Intended Audience :: Developers
106
+ Classifier: License :: Other/Proprietary License
107
+ Classifier: Operating System :: MacOS
108
+ Classifier: Operating System :: Microsoft :: Windows
109
+ Classifier: Operating System :: POSIX :: Linux
110
+ Classifier: Programming Language :: Python :: 3
111
+ Requires-Python: >=3.8
112
+ Description-Content-Type: text/markdown
113
+
114
+ # b4n1-secrets
115
+
116
+ Sovereign offline vault — committable encrypted secrets.
117
+
118
+ ## Install
119
+
120
+ ```bash
121
+ pip install b4n1-secrets
122
+ ```
123
+
124
+ ## Quick start
125
+
126
+ ```python
127
+ from b4n1secrets import SecretsClient
128
+
129
+ client = SecretsClient()
130
+ print(client.version())
131
+ print(client.list(".secrets"))
132
+ ```
133
+
134
+ ## CLI usage
135
+
136
+ ```bash
137
+ python -m b4n1secrets --help
138
+ python -m b4n1secrets init .secrets
139
+ ```
140
+
141
+ ## License
142
+
143
+ Business Source License 1.1 (BUSL-1.1). See LICENSE.
@@ -0,0 +1,12 @@
1
+ b4n1secrets/EULA.txt,sha256=SjUx9QRk43DKLXrLxkzd8mbMj_73yWUxYhTqbxgy964,4286
2
+ b4n1secrets/LICENSE,sha256=N0NaiGErW6e_uE-vfNDGdFtoc8FWBMJyfDjOZMwwZbE,4785
3
+ b4n1secrets/__init__.py,sha256=fp-dGDncAMeGJ6cSMB4VosrqZqIl-fZuVIahQqQqnlc,3571
4
+ b4n1secrets/__main__.py,sha256=IeCCjIHbo-Oh1IhxJkvdfHv9GkU5DFxG9dcZG1Sakl4,1786
5
+ b4n1secrets/binary.py,sha256=sOVhLGzjxlCIT4i4WhjMJP_cXLQFErF51qFPvJw4UM4,2875
6
+ b4n1secrets/bin/__init__.py,sha256=dIsCGNRUpyBUWshf2k5nq2q8T1lJUwdLzZSUX_3Aga0,50
7
+ b4n1secrets/bin/b4n1secrets-linux-amd64,sha256=pjFlNo8Mq0rG9y05QH9WhJUwccLFz4xxNG1wdHumerA,1059976
8
+ b4n1secrets/tests/test_basic.py,sha256=8Lgmvp0Qia7TLrp9Ud97KpOR_gjmOcGz6yS28116S3g,919
9
+ b4n1_secrets-0.1.0.dist-info/METADATA,sha256=-__C4SBdrhOEl4_5eYIqd6ujEPsRv4F6zNEZHU4blTc,6690
10
+ b4n1_secrets-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
11
+ b4n1_secrets-0.1.0.dist-info/licenses/LICENSE,sha256=N0NaiGErW6e_uE-vfNDGdFtoc8FWBMJyfDjOZMwwZbE,4785
12
+ b4n1_secrets-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,95 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: B4N1 (b4n1.com)
11
+ Licensed Work: b4n1-web — Agentic browser engine for web automation,
12
+ testing, and AI-powered browsing tasks.
13
+ Additional Use Grant: You may use the Licensed Work in production, free of
14
+ charge, provided that your organization's total annual
15
+ gross revenue does not exceed USD $100,000. Organizations
16
+ whose annual gross revenue exceeds USD $100,000 must
17
+ obtain a commercial license from the Licensor before any
18
+ production use. You may not resell or provide the
19
+ Licensed Work as a managed commercial service without
20
+ authorization from the Licensor.
21
+ Change Date: Four years after the first publicly available
22
+ distribution of the Licensed Work under this License.
23
+ Change License: Apache License, Version 2.0
24
+
25
+ For information about alternative licensing arrangements for the Licensed
26
+ Work, please contact b4n1@b4n1.com.
27
+
28
+ -----------------------------------------------------------------------------
29
+
30
+ Terms
31
+
32
+ The Licensor hereby grants you the right to copy, modify, create derivative
33
+ works, redistribute, and make non-production use of the Licensed Work. The
34
+ Licensor may make an Additional Use Grant, above, permitting limited
35
+ production use.
36
+
37
+ Effective on the Change Date, or the fourth anniversary of the first publicly
38
+ available distribution of a specific version of the Licensed Work under this
39
+ License, whichever comes first, the Licensor hereby grants you rights under
40
+ the terms of the Change License, and the rights granted in the paragraph
41
+ above terminate.
42
+
43
+ If your use of the Licensed Work does not comply with the requirements
44
+ currently in effect as described in this License, you must purchase a
45
+ commercial license from the Licensor, its affiliated entities, or authorized
46
+ resellers, or you must refrain from using the Licensed Work.
47
+
48
+ All copies of the original and modified Licensed Work, and derivative works
49
+ of the Licensed Work, are subject to this License. This License applies
50
+ separately for each version of the Licensed Work and the Change Date may vary
51
+ for each version of the Licensed Work released by Licensor.
52
+
53
+ You must conspicuously display this License on each original or modified copy
54
+ of the Licensed Work. If you receive the Licensed Work in original or
55
+ modified form from a third party, the terms and conditions set forth in this
56
+ License apply to your use of that work.
57
+
58
+ Any use of the Licensed Work in violation of this License will automatically
59
+ terminate your rights under this License for the current and all other
60
+ versions of the Licensed Work.
61
+
62
+ This License does not grant you any right in any trademark or logo of
63
+ Licensor or its affiliates (provided that you may use a trademark or logo of
64
+ Licensor as expressly required by this License).
65
+
66
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
67
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
68
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
69
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
70
+ TITLE. MariaDB hereby grants you permission to use this License's text to
71
+ license your works, and to refer to it using the trademark "Business Source
72
+ License", as long as you comply with the Covenants of Licensor below.
73
+
74
+ Covenants of Licensor
75
+
76
+ In consideration of the right to use this License's text and the "Business
77
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
78
+ other recipients of the licensed work to be provided by Licensor:
79
+
80
+ To specify as the Change License a license that is compatible with GPL
81
+ Version 2.0 or a later version, where "compatible" means that software
82
+ provided under the Change License can be included in a program with software
83
+ provided under GPL Version 2.0 or a later version. Licensor may specify
84
+ additional Change Licenses without limitation.
85
+
86
+ To either: (a) specify an additional grant of rights to use that does not
87
+ impose any additional restriction on the right granted in this License, as
88
+ the Additional Use Grant; or (b) insert the text "None" to specify a Change
89
+ License. Not to modify this License in any other way.
90
+
91
+ Notice
92
+
93
+ The Business Source License (this document, or the "License") is not an Open
94
+ Source license. However, the Licensed Work will eventually be made available
95
+ under an Open Source License, as stated in this License.
b4n1secrets/EULA.txt ADDED
@@ -0,0 +1,85 @@
1
+ B4N1-NET — END USER LICENSE AGREEMENT (BINARIES)
2
+ ==================================================
3
+
4
+ Version: 1.0 | Effective: 2026-11-18 | Applies to: b4n1-net 0.4.0+
5
+
6
+ This End User License Agreement ("EULA") governs your use of the B4N1
7
+ BINARY ARTIFACTS of b4n1-net — the bundled per-platform `b4n1net`
8
+ executables (`b4n1net-linux-amd64`, `b4n1net-linux-arm64`,
9
+ `b4n1net-macos-x64`, `b4n1net-macos-arm64`, `b4n1net-windows-amd64.exe`
10
+ and the remaining platform builds shipped under each SDK's `bin/`
11
+ directory), the packaged per-language bindings (`*.whl`, npm tarball,
12
+ `*.jar`, `*.nupkg`, gem, composer package, Go module), and the
13
+ `b4n1net` standalone executable.
14
+
15
+ The SDK wrapper source files (the thin per-language bindings) are licensed
16
+ separately under the Business Source License 1.1 — see the `LICENSE` file
17
+ and each registry's license metadata.
18
+
19
+ 1. DEFINITIONS
20
+ "Binaries" means the compiled artifacts described above.
21
+ "SDK" means the BUSL-1.1 licensed wrapper source distributed for each language.
22
+ "Source" means the Rust implementation, wire protocol, build scripts,
23
+ internal tests and internal documentation of the B4N1 engine. Source is
24
+ NOT distributed under this EULA or any other license and remains
25
+ proprietary.
26
+
27
+ 2. GRANT OF LICENSE
28
+ Subject to your compliance with this EULA and payment of any applicable
29
+ subscription, B4N1 grants you a limited, non-exclusive, non-transferable,
30
+ revocable license to install and use the Binaries within your own products
31
+ and internal tooling, in object form only.
32
+
33
+ 3. RESTRICTIONS (strictly enforced)
34
+ a. NO REDISTRIBUTION OF SOURCE. You may not publish, disclose, sublicense
35
+ or otherwise make the B4N1 Rust Source available, in whole or in part,
36
+ modified or unmodified, by any means, including in public repositories.
37
+ b. NO DECOMPILATION OR REVERSE ENGINEERING. You may not decompile,
38
+ disassemble, deobfuscate, or otherwise reverse engineer the Binaries
39
+ except to the extent such restriction is prohibited by applicable law
40
+ that cannot be waived.
41
+ c. NO REMOVAL OF NOTICES. You may not remove, alter, or obscure any
42
+ copyright, license, watermark, or proprietary notices in the Binaries.
43
+ d. NO RESALE AS A STANDALONE PRODUCT. The Binaries may not be resold,
44
+ sublicensed, or offered as a competing product.
45
+ e. NO PROTOCOL DISCLOSURE AS A PRODUCT. You may interoperate with the
46
+ Binaries under this EULA, but you may not publish the wire format,
47
+ message sequence or key schedule as a specification or as the basis of
48
+ a competing transport.
49
+ f. COMPLIANCE AND AUDIT. You will cooperate with reasonable verification of
50
+ license status, including honoring embedded license validation.
51
+
52
+ 4. SUBSCRIPTION TIERS
53
+ The Binaries operate under the applicable tier, validated offline against a
54
+ license file (`.b4n1lic`):
55
+ - Community: free, with attribution/watermark obligations.
56
+ - Pro / Corporate / Enterprise: paid tiers, no watermark, per the
57
+ commercial license purchased from B4N1.
58
+ License files are validated fully offline; no network calls are made at
59
+ runtime to verify entitlement.
60
+
61
+ 5. TERMINATION
62
+ This EULA terminates automatically if you breach any term. Upon
63
+ termination you must cease all use and destroy the Binaries and copies.
64
+
65
+ 6. DISCLAIMER OF WARRANTY
66
+ The Binaries are provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or
67
+ implied, including merchantability, fitness for a particular purpose, and
68
+ non-infringement. B4N1 does not warrant that the Binaries will be
69
+ uninterrupted or error-free.
70
+
71
+ 7. LIMITATION OF LIABILITY
72
+ To the maximum extent permitted by law, B4N1 shall not be liable for any
73
+ indirect, incidental, special, consequential, or punitive damages, or for
74
+ any loss of profits, revenue, data, or goodwill, arising out of your use
75
+ of the Binaries, regardless of the legal theory, even if advised of the
76
+ possibility of such damages.
77
+
78
+ 8. GOVERNING LAW AND SEVERABILITY
79
+ This EULA is governed by applicable law. If any provision is held
80
+ unenforceable, the remaining provisions stay in full force.
81
+
82
+ 9. CONTACT
83
+ Licensing questions: licensing@b4n1.com | https://b4n1.com
84
+
85
+ B4N1 — All rights reserved. Proprietary source: private and secret.
b4n1secrets/LICENSE ADDED
@@ -0,0 +1,95 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: B4N1 (b4n1.com)
11
+ Licensed Work: b4n1-web — Agentic browser engine for web automation,
12
+ testing, and AI-powered browsing tasks.
13
+ Additional Use Grant: You may use the Licensed Work in production, free of
14
+ charge, provided that your organization's total annual
15
+ gross revenue does not exceed USD $100,000. Organizations
16
+ whose annual gross revenue exceeds USD $100,000 must
17
+ obtain a commercial license from the Licensor before any
18
+ production use. You may not resell or provide the
19
+ Licensed Work as a managed commercial service without
20
+ authorization from the Licensor.
21
+ Change Date: Four years after the first publicly available
22
+ distribution of the Licensed Work under this License.
23
+ Change License: Apache License, Version 2.0
24
+
25
+ For information about alternative licensing arrangements for the Licensed
26
+ Work, please contact b4n1@b4n1.com.
27
+
28
+ -----------------------------------------------------------------------------
29
+
30
+ Terms
31
+
32
+ The Licensor hereby grants you the right to copy, modify, create derivative
33
+ works, redistribute, and make non-production use of the Licensed Work. The
34
+ Licensor may make an Additional Use Grant, above, permitting limited
35
+ production use.
36
+
37
+ Effective on the Change Date, or the fourth anniversary of the first publicly
38
+ available distribution of a specific version of the Licensed Work under this
39
+ License, whichever comes first, the Licensor hereby grants you rights under
40
+ the terms of the Change License, and the rights granted in the paragraph
41
+ above terminate.
42
+
43
+ If your use of the Licensed Work does not comply with the requirements
44
+ currently in effect as described in this License, you must purchase a
45
+ commercial license from the Licensor, its affiliated entities, or authorized
46
+ resellers, or you must refrain from using the Licensed Work.
47
+
48
+ All copies of the original and modified Licensed Work, and derivative works
49
+ of the Licensed Work, are subject to this License. This License applies
50
+ separately for each version of the Licensed Work and the Change Date may vary
51
+ for each version of the Licensed Work released by Licensor.
52
+
53
+ You must conspicuously display this License on each original or modified copy
54
+ of the Licensed Work. If you receive the Licensed Work in original or
55
+ modified form from a third party, the terms and conditions set forth in this
56
+ License apply to your use of that work.
57
+
58
+ Any use of the Licensed Work in violation of this License will automatically
59
+ terminate your rights under this License for the current and all other
60
+ versions of the Licensed Work.
61
+
62
+ This License does not grant you any right in any trademark or logo of
63
+ Licensor or its affiliates (provided that you may use a trademark or logo of
64
+ Licensor as expressly required by this License).
65
+
66
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
67
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
68
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
69
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
70
+ TITLE. MariaDB hereby grants you permission to use this License's text to
71
+ license your works, and to refer to it using the trademark "Business Source
72
+ License", as long as you comply with the Covenants of Licensor below.
73
+
74
+ Covenants of Licensor
75
+
76
+ In consideration of the right to use this License's text and the "Business
77
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
78
+ other recipients of the licensed work to be provided by Licensor:
79
+
80
+ To specify as the Change License a license that is compatible with GPL
81
+ Version 2.0 or a later version, where "compatible" means that software
82
+ provided under the Change License can be included in a program with software
83
+ provided under GPL Version 2.0 or a later version. Licensor may specify
84
+ additional Change Licenses without limitation.
85
+
86
+ To either: (a) specify an additional grant of rights to use that does not
87
+ impose any additional restriction on the right granted in this License, as
88
+ the Additional Use Grant; or (b) insert the text "None" to specify a Change
89
+ License. Not to modify this License in any other way.
90
+
91
+ Notice
92
+
93
+ The Business Source License (this document, or the "License") is not an Open
94
+ Source license. However, the Licensed Work will eventually be made available
95
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,127 @@
1
+ """b4n1-secrets SDK — Sovereign Offline Vault.
2
+
3
+ Thin Python wrapper around the b4n1-secrets binary. The wheel bundles the engine
4
+ for the supported platforms and resolves the matching one at import time.
5
+
6
+ Overrides:
7
+ B4N1SECRETS_BIN_PATH=/path/to/b4n1-secrets exact binary, wins over the bundle
8
+ B4N1SECRETS_BINARY=/path/to/b4n1-secrets same, kept for older callers
9
+
10
+ Quick start:
11
+ from b4n1secrets import SecretsClient
12
+
13
+ client = SecretsClient()
14
+ print(client.version())
15
+ print(client.list(".secrets"))
16
+
17
+ CLI usage:
18
+ python -m b4n1secrets --help
19
+ python -m b4n1secrets install
20
+ """
21
+
22
+ from .binary import (
23
+ get_b4n1secrets_binary,
24
+ get_b4n1secrets_version,
25
+ run,
26
+ )
27
+
28
+ SDK_VERSION = "0.1.0"
29
+
30
+ __version__ = SDK_VERSION
31
+ __author__ = "Bani Montoya"
32
+ __email__ = "banimontoya@gmail.com"
33
+
34
+ __all__ = [
35
+ "get_b4n1secrets_binary",
36
+ "get_b4n1secrets_version",
37
+ "run",
38
+ "SecretsClient",
39
+ ]
40
+
41
+
42
+ class SecretsClient:
43
+ """High-level client wrapping the b4n1-secrets binary."""
44
+
45
+ def __init__(self, binary_path: str = None):
46
+ self._binary = binary_path or get_b4n1secrets_binary()
47
+ if not self._binary:
48
+ raise RuntimeError(
49
+ "b4n1-secrets binary not found. Set B4N1SECRETS_BIN_PATH or install "
50
+ "the binary."
51
+ )
52
+
53
+ def _run(self, *args, capture=True, timeout=30):
54
+ import subprocess
55
+
56
+ result = subprocess.run(
57
+ [self._binary] + list(args),
58
+ capture_output=capture,
59
+ text=True,
60
+ timeout=timeout,
61
+ )
62
+ return result
63
+
64
+ def version(self) -> str:
65
+ r = self._run("--version")
66
+ return (r.stdout or r.stderr).strip()
67
+
68
+ def init(self, directory, passphrase):
69
+ import subprocess
70
+ r = subprocess.run(
71
+ [self._binary, "init", directory],
72
+ input=passphrase + "\n",
73
+ capture_output=True,
74
+ text=True,
75
+ timeout=30,
76
+ )
77
+ return r
78
+
79
+ def unlock(self, directory, passphrase):
80
+ import subprocess
81
+ r = subprocess.run(
82
+ [self._binary, "unlock", directory],
83
+ input=passphrase + "\n",
84
+ capture_output=True,
85
+ text=True,
86
+ timeout=30,
87
+ )
88
+ return r
89
+
90
+ def close(self, directory):
91
+ return self._run("close", directory)
92
+
93
+ def set(self, directory, key, value, expires_epoch=None, tags=None, force=False):
94
+ args = ["set", directory, key, "--value", value]
95
+ if expires_epoch is not None:
96
+ args.extend(["--expires-epoch", str(expires_epoch)])
97
+ if tags:
98
+ args.extend(["--tags", ",".join(tags)])
99
+ if force:
100
+ args.append("--force")
101
+ return self._run(*args)
102
+
103
+ def get(self, directory, key):
104
+ r = self._run("get", directory, key)
105
+ return (r.stdout or "").strip()
106
+
107
+ def list(self, directory, meta=False):
108
+ args = ["list", directory]
109
+ if meta:
110
+ args.append("--meta")
111
+ r = self._run(*args)
112
+ return (r.stdout or r.stderr).strip()
113
+
114
+ def remove(self, directory, key):
115
+ return self._run("remove", directory, key)
116
+
117
+ def run(self, directory, secrets, command):
118
+ args = ["run", directory]
119
+ for env_var, key in secrets.items():
120
+ args.extend(["--secret", f"{env_var}={key}"])
121
+ args.append("--")
122
+ args.extend(command)
123
+ return self._run(*args, capture=False)
124
+
125
+ def help(self) -> str:
126
+ r = self._run("--help")
127
+ return (r.stdout or r.stderr).strip()
@@ -0,0 +1,61 @@
1
+ """b4n1-secrets CLI entry point: python -m b4n1secrets."""
2
+
3
+ import os
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ from .binary import get_b4n1secrets_binary, get_b4n1secrets_version
8
+
9
+
10
+ def resolve_install_dir():
11
+ env_install_dir = os.getenv("B4N1SECRETS_INSTALL_DIR")
12
+ if env_install_dir:
13
+ return Path(env_install_dir)
14
+ usr_local = Path("/usr/local/bin")
15
+ if os.access(str(usr_local), os.W_OK):
16
+ return usr_local
17
+ user_local = Path.home() / ".local/bin"
18
+ if os.access(str(user_local), os.W_OK):
19
+ return user_local
20
+ return Path.home() / ".b4n1secrets" / "bin"
21
+
22
+
23
+ def install_command():
24
+ binary = get_b4n1secrets_binary()
25
+ if binary:
26
+ version = get_b4n1secrets_version()
27
+ print(f"b4n1-secrets already available at: {binary}")
28
+ print(f"Version: {version}")
29
+ response = input("Reinstall? (y/N): ").lower().strip()
30
+ if response not in ("y", "yes"):
31
+ print("Installation cancelled.")
32
+ return
33
+
34
+ install_dir = resolve_install_dir()
35
+ install_dir.mkdir(parents=True, exist_ok=True)
36
+ binary_path = install_dir / "b4n1secrets"
37
+
38
+ print(f"Install directory: {install_dir}")
39
+ print("Manual install: copy the b4n1-secrets binary to this directory.")
40
+ print(f" cp /path/to/b4n1-secrets {binary_path}")
41
+ print(f" chmod +x {binary_path}")
42
+
43
+
44
+ def main():
45
+ if len(sys.argv) > 1 and sys.argv[1] == "install":
46
+ install_command()
47
+ return
48
+
49
+ binary = get_b4n1secrets_binary()
50
+ if not binary:
51
+ print("b4n1-secrets binary not found. Set B4N1SECRETS_BIN_PATH or run: python -m b4n1secrets install")
52
+ sys.exit(1)
53
+
54
+ import subprocess
55
+
56
+ result = subprocess.run([binary] + sys.argv[1:])
57
+ sys.exit(result.returncode)
58
+
59
+
60
+ if __name__ == "__main__":
61
+ main()
@@ -0,0 +1 @@
1
+ # Bundled binaries live here. Empty module marker.
Binary file
b4n1secrets/binary.py ADDED
@@ -0,0 +1,93 @@
1
+ """Binary resolution for the b4n1-secrets SDK."""
2
+
3
+ import os
4
+ import platform
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+ from typing import Optional
9
+
10
+ _PLATFORM_BINARIES = {
11
+ ("linux", "x86_64"): "b4n1secrets-linux-amd64",
12
+ ("linux", "aarch64"): "b4n1secrets-linux-arm64",
13
+ ("darwin", "x86_64"): "b4n1secrets-macos-x64",
14
+ ("darwin", "arm64"): "b4n1secrets-macos-arm64",
15
+ ("windows", "AMD64"): "b4n1secrets-windows-amd64.exe",
16
+ }
17
+
18
+
19
+ def _get_platform_binary_name() -> Optional[str]:
20
+ key = (sys.platform, platform.machine())
21
+ return _PLATFORM_BINARIES.get(key)
22
+
23
+
24
+ def get_b4n1secrets_binary() -> Optional[str]:
25
+ """Resolve the b4n1-secrets binary path.
26
+
27
+ Resolution order:
28
+ 1. B4N1SECRETS_BIN_PATH env var (exact path, wins)
29
+ 2. Bundled binary in bin/ (matches current platform)
30
+ 3. B4N1SECRETS_BINARY env var
31
+ 4. Common install locations + PATH
32
+ """
33
+ if "B4N1SECRETS_BIN_PATH" in os.environ:
34
+ env_path = os.environ["B4N1SECRETS_BIN_PATH"]
35
+ if os.path.exists(env_path) and os.access(env_path, os.X_OK):
36
+ return env_path
37
+
38
+ bin_name = _get_platform_binary_name()
39
+ if bin_name:
40
+ bundled = Path(__file__).parent / "bin" / bin_name
41
+ if bundled.exists() and os.access(bundled, os.X_OK):
42
+ return str(bundled)
43
+
44
+ env_binary = os.getenv("B4N1SECRETS_BINARY")
45
+ if env_binary and os.path.isfile(env_binary) and os.access(env_binary, os.X_OK):
46
+ return env_binary
47
+
48
+ possible = [
49
+ str(Path.home() / ".local/bin/b4n1secrets"),
50
+ str(Path.home() / ".b4n1secrets/bin/b4n1secrets"),
51
+ "/usr/local/bin/b4n1secrets",
52
+ "/usr/bin/b4n1secrets",
53
+ ]
54
+ for d in os.environ.get("PATH", "").split(":"):
55
+ possible.append(os.path.join(d, "b4n1secrets"))
56
+
57
+ for loc in possible:
58
+ if os.path.isfile(loc) and os.access(loc, os.X_OK):
59
+ return loc
60
+
61
+ return None
62
+
63
+
64
+ def get_b4n1secrets_version() -> Optional[str]:
65
+ """Get the version of the resolved b4n1-secrets binary."""
66
+ binary = get_b4n1secrets_binary()
67
+ if not binary:
68
+ return None
69
+ try:
70
+ result = subprocess.run(
71
+ [binary, "--version"],
72
+ capture_output=True,
73
+ text=True,
74
+ timeout=5,
75
+ )
76
+ return result.stdout.strip() or result.stderr.strip()
77
+ except Exception:
78
+ return None
79
+
80
+
81
+ def run(*args, **kwargs):
82
+ """Run the b4n1-secrets binary with the given arguments.
83
+
84
+ Returns a subprocess.CompletedProcess. Raises RuntimeError if the
85
+ binary cannot be resolved.
86
+ """
87
+ binary = get_b4n1secrets_binary()
88
+ if not binary:
89
+ raise RuntimeError(
90
+ "b4n1-secrets binary not found. Set B4N1SECRETS_BIN_PATH or install "
91
+ "the binary. See: https://github.com/B4N1-com/b4n1-secrets"
92
+ )
93
+ return subprocess.run([binary] + list(args), **kwargs)
@@ -0,0 +1,28 @@
1
+ import subprocess
2
+ import sys
3
+ from pathlib import Path
4
+
5
+ def test_binary_resolves():
6
+ from b4n1secrets.binary import get_b4n1secrets_binary
7
+ binary = get_b4n1secrets_binary()
8
+ assert binary is not None, "binary not found"
9
+ assert Path(binary).exists()
10
+
11
+ def test_version():
12
+ from b4n1secrets.binary import get_b4n1secrets_binary
13
+ binary = get_b4n1secrets_binary()
14
+ r = subprocess.run([binary, "--version"], capture_output=True, text=True)
15
+ assert r.returncode == 0
16
+ assert "0.1.0" in (r.stdout + r.stderr)
17
+
18
+ def test_help():
19
+ from b4n1secrets.binary import get_b4n1secrets_binary
20
+ binary = get_b4n1secrets_binary()
21
+ r = subprocess.run([binary, "--help"], capture_output=True, text=True)
22
+ assert r.returncode == 0
23
+ assert "run" in (r.stdout + r.stderr)
24
+
25
+ def test_client_init():
26
+ from b4n1secrets import SecretsClient
27
+ client = SecretsClient()
28
+ assert client.version() != ""