MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / EncryptionKey

Class EncryptionKey

openhands/app_server/utils/encryption_key.py:13–27  ·  view source on GitHub ↗

Configuration for an encryption key.

Source from the content-addressed store, hash-verified

11
12
13class EncryptionKey(BaseModel):
14 """Configuration for an encryption key."""
15
16 id: str = Field(default_factory=lambda: base62.encodebytes(os.urandom(32)))
17 key: SecretStr
18 active: bool = True
19 notes: str | None = None
20 created_at: datetime.datetime = Field(default_factory=utc_now)
21
22 @field_serializer('key')
23 def serialize_key(self, key: SecretStr, info: Any):
24 """Conditionally serialize the key based on context."""
25 if info.context and info.context.get('expose_secrets'):
26 return key.get_secret_value()
27 return str(key) # Returns '**********' by default
28
29
30def get_default_encryption_keys(workspace_dir: Path) -> list[EncryptionKey]:

Calls

no outgoing calls