Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Umbral -> Curve25519 for ThresholdDecryptionRequest/Response #54

Merged
merged 15 commits into from
Jun 7, 2023
Merged
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
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
- id: clippy
derekpierre marked this conversation as resolved.
Show resolved Hide resolved
args: ["--all", "--all-features", "--", "-D", "warnings"]
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [0.9.0] - Unreleased

### Added

- Re-exported `ferveo` Python and WASM bindings. ([#58])
- Added `SessionSharedSecret`, `SessionStaticKey`, `SessionStaticSecret`, `SessionSecretFactory` as wrappers for underlying Curve 25519 key functionality. ([#54])
- Added Rust `pre-commit` hooks for repos. ([#54])
- Added `secret_box` functionality. ([#54])


### Changed
### Changed

- Replaced opaque types with native `ferveo` types. ([#53])
- Removed `E2EThresholdDecryptionRequest` type and bindings. ([#54])
- Modified `EncryptedThresholdDecryptionRequest`/`EncryptedThresholdDecryptionResponse` to use Curve 25519 keys instead of Umbral keys for encryption/decryption. ([#54])
- Modified `ThresholdDecryptionResponse`/`EncryptedThresholdDecryptionResponse` to include `ritual_id` member in struct. ([#54])
- Ritual ID for `ThresholdDecryption[Request/Response]` / `EncryptedThresholdDecryption[Request/Response]` is now u32 instead of u16. ([#54])


[#53]: https://github.com/nucypher/nucypher-core/pull/53
[#58]: https://github.com/nucypher/nucypher-core/pull/58
[#54]: https://github.com/nucypher/nucypher-core/pull/54


## [0.8.0] - 2023-05-23
Expand All @@ -38,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `ThresholdDecryptionRequest`/`ThresholdDecryptionResponse` types and bindings. ([#48])`
- Add `ThresholdDecryptionRequest`/`ThresholdDecryptionResponse` types and bindings. ([#48])
- Add `ferveo_public_key` field to `NodeMetadataPayload`. ([#48])


Expand Down
64 changes: 64 additions & 0 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion nucypher-core-python/nucypher_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
MetadataResponse,
MetadataResponsePayload,
ThresholdDecryptionRequest,
E2EThresholdDecryptionRequest,
ThresholdDecryptionResponse,
EncryptedThresholdDecryptionRequest,
EncryptedThresholdDecryptionResponse,
SessionSharedSecret,
SessionStaticKey,
SessionStaticSecret,
SessionSecretFactory,
)
77 changes: 57 additions & 20 deletions nucypher-core-python/nucypher_core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class ThresholdDecryptionRequest:

ciphertext: Ciphertext

def encrypt(self, request_encrypting_key: PublicKey, response_encrypting_key: PublicKey) -> EncryptedThresholdDecryptionRequest:
def encrypt(self, shared_secret: SessionSharedSecret, requester_public_key: SessionStaticKey) -> EncryptedThresholdDecryptionRequest:
...

@staticmethod
Expand All @@ -434,27 +434,15 @@ class ThresholdDecryptionRequest:
...


class E2EThresholdDecryptionRequest:

decryption_request: ThresholdDecryptionRequest

response_encrypting_key: PublicKey

@staticmethod
def from_bytes(data: bytes) -> E2EThresholdDecryptionRequest:
...

def __bytes__(self) -> bytes:
...


class EncryptedThresholdDecryptionRequest:
ritual_id: int

requester_public_key: SessionStaticKey

def decrypt(
self,
sk: SecretKey
) -> E2EThresholdDecryptionRequest:
shared_secret: SessionSharedSecret
) -> ThresholdDecryptionRequest:
...

@staticmethod
Expand All @@ -467,12 +455,14 @@ class EncryptedThresholdDecryptionRequest:

class ThresholdDecryptionResponse:

def __init__(self, decryption_share: bytes):
def __init__(self, ritual_id: int, decryption_share: bytes):
...

decryption_share: bytes

def encrypt(self, encrypting_key: PublicKey) -> EncryptedThresholdDecryptionResponse:
ritual_id: int

def encrypt(self, shared_secret: SessionSharedSecret) -> EncryptedThresholdDecryptionResponse:
...

@staticmethod
Expand All @@ -485,9 +475,11 @@ class ThresholdDecryptionResponse:

class EncryptedThresholdDecryptionResponse:

ritual_id: int

def decrypt(
self,
sk: SecretKey
shared_secret: SessionSharedSecret
) -> ThresholdDecryptionResponse:
...

Expand All @@ -497,3 +489,48 @@ class EncryptedThresholdDecryptionResponse:

def __bytes__(self) -> bytes:
...


class SessionSharedSecret:
...


class SessionStaticKey:

@staticmethod
def from_bytes(data: bytes) -> SessionStaticKey:
...

def __bytes__(self) -> bytes:
...


class SessionStaticSecret:

@staticmethod
def random() -> SessionStaticSecret:
...

def public_key(self) -> SessionStaticKey:
...

def derive_shared_secret(self, their_public_key: SessionStaticKey) -> SessionSharedSecret:
...


class SessionSecretFactory:

@staticmethod
def random() -> SessionSecretFactory:
...

@staticmethod
def seed_size() -> int:
...

@staticmethod
def from_secure_randomness(seed: bytes) -> SessionSecretFactory:
...

def make_key(self, label: bytes) -> SessionStaticSecret:
...
Loading