cnos-firebase 1.12.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,56 @@
|
|
|
1
|
+
"""Firebase Secrets CNOS vault provider.
|
|
2
|
+
|
|
3
|
+
This is a thin wrapper over GcpSecretManagerProvider. Firebase projects use
|
|
4
|
+
the same GCP Secret Manager API; the only difference is the provider name
|
|
5
|
+
reported to the CNOS runtime ("firebase-secrets" instead of "gcp-secret-manager").
|
|
6
|
+
|
|
7
|
+
All authentication and secret-fetching logic is delegated entirely to
|
|
8
|
+
GcpSecretManagerProvider.
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Any, Dict, List, Optional
|
|
13
|
+
|
|
14
|
+
from cnos.types import (
|
|
15
|
+
SecretVaultProvider,
|
|
16
|
+
SecretVaultProviderFactory,
|
|
17
|
+
VaultAuthConfig,
|
|
18
|
+
VaultDefinition,
|
|
19
|
+
)
|
|
20
|
+
from cnos_gcp.provider import GcpSecretManagerProvider
|
|
21
|
+
|
|
22
|
+
PROVIDER_NAME = "firebase-secrets"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class FirebaseSecretsProvider(SecretVaultProvider):
|
|
26
|
+
"""Delegates entirely to GcpSecretManagerProvider; swaps the provider name."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
vault_id: str,
|
|
31
|
+
definition: VaultDefinition,
|
|
32
|
+
client: Any = None,
|
|
33
|
+
) -> None:
|
|
34
|
+
self._vault_id = vault_id
|
|
35
|
+
self._definition = definition
|
|
36
|
+
self._delegate = GcpSecretManagerProvider(vault_id, definition, client=client)
|
|
37
|
+
|
|
38
|
+
def authenticate(self, auth: VaultAuthConfig) -> None:
|
|
39
|
+
self._delegate.authenticate(auth)
|
|
40
|
+
|
|
41
|
+
def batch_get(self, refs: List[str]) -> Dict[str, Any]:
|
|
42
|
+
return self._delegate.batch_get(refs)
|
|
43
|
+
|
|
44
|
+
def get(self, ref: str) -> Optional[Any]:
|
|
45
|
+
return self._delegate.get(ref)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def factory(client: Any = None) -> SecretVaultProviderFactory:
|
|
49
|
+
"""Return a SecretVaultProviderFactory for Firebase Secrets.
|
|
50
|
+
|
|
51
|
+
Pass client= to inject a mock GCP Secret Manager client for tests.
|
|
52
|
+
"""
|
|
53
|
+
def create(vault_id: str, definition: VaultDefinition) -> FirebaseSecretsProvider:
|
|
54
|
+
return FirebaseSecretsProvider(vault_id, definition, client=client)
|
|
55
|
+
|
|
56
|
+
return SecretVaultProviderFactory(provider=PROVIDER_NAME, create=create)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
cnos_firebase/__init__.py,sha256=xl9FpqYaSrRmYFbtZLHQRJYhV6M94_CSxXn5BP5aoDk,156
|
|
2
|
+
cnos_firebase/provider.py,sha256=MZftWQhc_X7VEtjtsxgy8-VfU8aEA5CNXKTHDW8zQH0,1853
|
|
3
|
+
cnos_firebase-1.12.0.dist-info/METADATA,sha256=DRb0WE1JYdvS_1qanGQdNYfatFbUVgAJiI5XhyX3mC0,210
|
|
4
|
+
cnos_firebase-1.12.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
5
|
+
cnos_firebase-1.12.0.dist-info/RECORD,,
|