Skip to content

Commit

Permalink
cleanup, remove permissions from workflows (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw authored Jan 19, 2025
1 parent d97beec commit 2b37620
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
pull_request:

permissions: {}

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-stubs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
type: boolean
name: release-stubs

permissions: {}

jobs:
release-stubs:
name: build pyrage-stubs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:

name: release

permissions: {}

jobs:
release-linux:
name: build Linux release dists
Expand Down
136 changes: 124 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ crate-type = ["cdylib"]
[dependencies]
age-core = "0.11"
age = { version = "0.11.1", features = ["ssh", "plugin"] }
pyo3 = { version = "0.22.6", features = [
pyo3 = { version = "0.23", features = [
"extension-module",
"abi3",
"abi3-py39",
"py-clone",
] }
pyo3-file = "0.9.0"
pyo3-file = "0.10.0"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ classifiers = [
"Operating System :: POSIX :: Linux",
]
requires-python = ">=3.9"
dynamic = ["version"]
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn encrypt<'p>(
.map_err(|e| EncryptError::new_err(e.to_string()))?;

// TODO: Avoid this copy. Maybe PyBytes::new_with?
Ok(PyBytes::new_bound(py, &encrypted))
Ok(PyBytes::new(py, &encrypted))
}

#[pyfunction]
Expand Down Expand Up @@ -221,7 +221,7 @@ fn decrypt<'p>(
.map_err(|e| DecryptError::new_err(e.to_string()))?;

// TODO: Avoid this copy. Maybe PyBytes::new_with?
Ok(PyBytes::new_bound(py, &decrypted))
Ok(PyBytes::new(py, &decrypted))
}

#[pyfunction]
Expand Down Expand Up @@ -336,14 +336,14 @@ fn pyrage(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
);
m.add_submodule(&plugin)?;

m.add("IdentityError", py.get_type_bound::<IdentityError>())?;
m.add("RecipientError", py.get_type_bound::<RecipientError>())?;
m.add("IdentityError", py.get_type::<IdentityError>())?;
m.add("RecipientError", py.get_type::<RecipientError>())?;

m.add("EncryptError", py.get_type_bound::<EncryptError>())?;
m.add("EncryptError", py.get_type::<EncryptError>())?;
m.add_wrapped(wrap_pyfunction!(encrypt))?;
m.add_wrapped(wrap_pyfunction!(encrypt_file))?;
m.add_wrapped(wrap_pyfunction!(encrypt_io))?;
m.add("DecryptError", py.get_type_bound::<DecryptError>())?;
m.add("DecryptError", py.get_type::<DecryptError>())?;
m.add_wrapped(wrap_pyfunction!(decrypt))?;
m.add_wrapped(wrap_pyfunction!(decrypt_file))?;
m.add_wrapped(wrap_pyfunction!(decrypt_io))?;
Expand Down
6 changes: 3 additions & 3 deletions src/passphrase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn encrypt<'p>(py: Python<'p>, plaintext: &[u8], passphrase: &str) -> PyResult<B
.finish()
.map_err(|e| EncryptError::new_err(e.to_string()))?;

Ok(PyBytes::new_bound(py, &encrypted))
Ok(PyBytes::new(py, &encrypted))
}

#[pyfunction]
Expand All @@ -40,11 +40,11 @@ fn decrypt<'p>(
.read_to_end(&mut decrypted)
.map_err(|e| DecryptError::new_err(e.to_string()))?;

Ok(PyBytes::new_bound(py, &decrypted))
Ok(PyBytes::new(py, &decrypted))
}

pub(crate) fn module(py: Python) -> PyResult<Bound<'_, PyModule>> {
let module = PyModule::new_bound(py, "passphrase")?;
let module = PyModule::new(py, "passphrase")?;

module.add_wrapped(wrap_pyfunction!(encrypt))?;
module.add_wrapped(wrap_pyfunction!(decrypt))?;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl IdentityPluginV1 {
}

pub(crate) fn module(py: Python<'_>) -> PyResult<Bound<'_, PyModule>> {
let module = PyModule::new_bound(py, "plugin")?;
let module = PyModule::new(py, "plugin")?;

module.add_class::<Recipient>()?;
module.add_class::<Identity>()?;
Expand Down
2 changes: 1 addition & 1 deletion src/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Identity {
}

pub(crate) fn module(py: Python) -> PyResult<Bound<'_, PyModule>> {
let module = PyModule::new_bound(py, "ssh")?;
let module = PyModule::new(py, "ssh")?;

module.add_class::<Recipient>()?;
module.add_class::<Identity>()?;
Expand Down
2 changes: 1 addition & 1 deletion src/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Identity {
}

pub(crate) fn module(py: Python) -> PyResult<Bound<'_, PyModule>> {
let module = PyModule::new_bound(py, "x25519")?;
let module = PyModule::new(py, "x25519")?;

module.add_class::<Recipient>()?;
module.add_class::<Identity>()?;
Expand Down

0 comments on commit 2b37620

Please sign in to comment.