Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/onepassword/lib/aarch64/libop_uniffi_core.dylib
Binary file not shown.
Binary file modified src/onepassword/lib/aarch64/libop_uniffi_core.so
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/libop_uniffi_core.dylib
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/libop_uniffi_core.so
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/op_uniffi_core.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/onepassword/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class Secrets:
"""
The Secrets API includes all operations the SDK client can perform on secrets.
Use secret reference URIs to securely load secrets from 1Password: op://<vault-name>/<item-name>[/<section-name>]/<field-name>
Use secret reference URIs to securely load secrets from 1Password: `op://<vault-name>/<item-name>[/<section-name>]/<field-name>`
"""

def __init__(self, client_id, core: Core):
Expand Down Expand Up @@ -59,7 +59,7 @@
"""
Validate the secret reference to ensure there are no syntax errors.
"""
response = UniffiCore().invoke_sync(

Check failure on line 62 in src/onepassword/secrets.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/secrets.py:62:9: F841 Local variable `response` is assigned to but never used

Check failure on line 62 in src/onepassword/secrets.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/secrets.py:62:9: F841 Local variable `response` is assigned to but never used
{
"invocation": {
"parameters": {
Expand Down
55 changes: 53 additions & 2 deletions src/onepassword/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,47 @@ class Group(BaseModel):
vault_access: Optional[List[VaultAccess]] = Field(alias="vaultAccess", default=None)


class GroupAccess(BaseModel):
"""
Represents a group's access to a 1Password vault.
This is used for granting permissions
"""

group_id: str
"""
The group's ID
"""
permissions: int
"""
The group's set of permissions for the vault
"""


class GroupGetParams(BaseModel):
model_config = ConfigDict(populate_by_name=True)

vault_permissions: Optional[bool] = Field(alias="vaultPermissions", default=None)


class GroupVaultAccess(BaseModel):
"""
Represents a group's access to a 1Password vault.
"""

vault_id: str
"""
The vault's ID
"""
group_id: str
"""
The group's ID
"""
permissions: int
"""
The group's set of permissions for the vault
"""


class ItemCategory(str, Enum):
LOGIN = "Login"
SECURENOTE = "SecureNote"
Expand Down Expand Up @@ -385,7 +420,7 @@ class AutofillBehavior(str, Enum):
Controls the auto-fill behavior of a website.


For more information, visit https://support.1password.com/autofill-behavior/
For more information, visit <https://support.1password.com/autofill-behavior/>
"""

ANYWHEREONWEBSITE = "AnywhereOnWebsite"
Expand Down Expand Up @@ -417,7 +452,7 @@ class Website(BaseModel):
"""
The auto-fill behavior of the website

For more information, visit https://support.1password.com/autofill-behavior/
For more information, visit <https://support.1password.com/autofill-behavior/>
"""


Expand Down Expand Up @@ -1493,3 +1528,19 @@ class WordListType(str, Enum):
"""
Three (random) letter "words"
"""


ARCHIVE_ITEMS: int = 256
CREATE_ITEMS: int = 128
DELETE_ITEMS: int = 512
EXPORT_ITEMS: int = 4194304
IMPORT_ITEMS: int = 2097152
MANAGE_VAULT: int = 2
NO_ACCESS: int = 0
PRINT_ITEMS: int = 8388608
READ_ITEMS: int = 32
RECOVER_VAULT: int = 1
REVEAL_ITEM_PASSWORD: int = 16
SEND_ITEMS: int = 1048576
UPDATE_ITEMS: int = 64
UPDATE_ITEM_HISTORY: int = 1024
62 changes: 62 additions & 0 deletions src/onepassword/vaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Optional, List
from pydantic import TypeAdapter
from .types import (
GroupAccess,
GroupVaultAccess,
Vault,
VaultGetParams,
VaultListParams,
Expand Down Expand Up @@ -73,3 +75,63 @@

response = TypeAdapter(Vault).validate_json(response)
return response

async def grant_group_permissions(
self, vault_id: str, group_permissions_list: List[GroupAccess]
) -> None:
response = await self.core.invoke(

Check failure on line 82 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:82:9: F841 Local variable `response` is assigned to but never used

Check failure on line 82 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:82:9: F841 Local variable `response` is assigned to but never used
{
"invocation": {
"clientId": self.client_id,
"parameters": {
"name": "VaultsGrantGroupPermissions",
"parameters": {
"vault_id": vault_id,
"group_permissions_list": [
o.model_dump(by_alias=True)
for o in group_permissions_list
],
},
},
}
}
)

return None

async def update_group_permissions(
self, group_permissions_list: List[GroupVaultAccess]
) -> None:
response = await self.core.invoke(

Check failure on line 105 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:105:9: F841 Local variable `response` is assigned to but never used

Check failure on line 105 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:105:9: F841 Local variable `response` is assigned to but never used
{
"invocation": {
"clientId": self.client_id,
"parameters": {
"name": "VaultsUpdateGroupPermissions",
"parameters": {
"group_permissions_list": [
o.model_dump(by_alias=True)
for o in group_permissions_list
]
},
},
}
}
)

return None

async def revoke_group_permissions(self, vault_id: str, group_id: str) -> None:
response = await self.core.invoke(

Check failure on line 125 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:125:9: F841 Local variable `response` is assigned to but never used

Check failure on line 125 in src/onepassword/vaults.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F841)

src/onepassword/vaults.py:125:9: F841 Local variable `response` is assigned to but never used
{
"invocation": {
"clientId": self.client_id,
"parameters": {
"name": "VaultsRevokeGroupPermissions",
"parameters": {"vault_id": vault_id, "group_id": group_id},
},
}
}
)

return None
Loading