Sign Up

SecretService

class SecretService()

Project secret namespace.

SecretService.__init__

def __init__(impl: AsyncSecretService, bridge: SyncBridge) -> None

SecretService.delete

def delete(name: str) -> None

Delete a secret.

SecretService.get

def get(name: str) -> Secret

Fetch one secret's metadata (never its value).

SecretService.iter

def iter(*,
         cursor: Optional[str] = None,
         limit: Optional[int] = None) -> Iterator[Secret]

SecretService.list

def list(*,
         cursor: Optional[str] = None,
         limit: Optional[int] = None) -> ListResult[Secret]

List secret metadata.

SecretService.set

def set(name: str,
        value: str,
        *,
        allowed_domains: Sequence[str],
        description: Optional[str] = None,
        if_not_exists: bool = False) -> Secret

Create or update a write-only secret.

AsyncSecretService

class AsyncSecretService()

Project secret namespace.

Project-scoped secrets: named key/value pairs stored encrypted in the project. Attach one or more to a sandbox at creation via the secrets create parameter (a list of names). Attached secrets are available to outbound HTTPS requests to their allowed domains, not plain HTTP requests. Their values never enter the sandbox and are never returned by the API (write-only).

AsyncSecretService.__init__

def __init__(transport: AsyncTransport) -> None

AsyncSecretService.list

async def list(*,
               cursor: Optional[str] = None,
               limit: Optional[int] = None) -> ListResult[Secret]

List secret metadata.

AsyncSecretService.iter

async def iter(*,
               cursor: Optional[str] = None,
               limit: Optional[int] = None) -> AsyncIterator[Secret]

AsyncSecretService.get

async def get(name: str) -> Secret

Fetch one secret's metadata (never its value).

AsyncSecretService.set

async def set(name: str,
              value: str,
              *,
              allowed_domains: Sequence[str],
              description: Optional[str] = None,
              if_not_exists: bool = False) -> Secret

Create or update a write-only secret.

allowed_domains: The hosts where this secret's value may be sent (exact or *. wildcard), or ["*"] for any verified host. "*" lets the value reach any HTTPS host, including one a compromised sandbox controls.

AsyncSecretService.delete

async def delete(name: str) -> None

Delete a secret.

Secret

class Secret(BaseModel)

Secret metadata. The value is write-only.

Attributes:

  • allowed_domains List[StrictStr] = Field(description='The hosts the secret\'s value may be sent to. ["*"] means any host the platform has verified; an empty list means the secret is sent nowhere.')
  • created_at datetime = Field(description='When the secret was created.')
  • description Optional[StrictStr] = Field(default=None, description='The user-facing description, or null when absent.')
  • name StrictStr = Field(description='The secret name.')
  • updated_at datetime = Field(description='When the secret was last updated.')
  • additional_properties Dict[str, Any] = {}
model_config
model_config = ConfigDict(populate_by_name=True, validate_assignment=True, protected_namespaces=())

Secret.to_str

def to_str() -> str

Returns the string representation of the model using alias

Secret.to_json

def to_json() -> str

Returns the JSON representation of the model using alias

Secret.from_json

@classmethod
def from_json(json_str: str) -> Optional[Self]

Create an instance of Secret from a JSON string

Secret.to_dict

def to_dict() -> Dict[str, Any]

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
  • Fields in self.additional_properties are added to the output dict.

Secret.from_dict

@classmethod
def from_dict(obj: Optional[Dict[str, Any]]) -> Optional[Self]

Create an instance of Secret from a dict