apple / apple/swift-crypto

Support for Ed25519 → X25519 Key Conversion

Open
#393 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Assembly
Stars
1.7k
Forks
223
Avg merge
1d 2h
Merged PRs (30d)
7

Description

### New API Proposal: Ed25519 → X25519 Key Conversion

#### Motivation:

This conversion is necessary for [the X3DH Key Agreement Protocol](https://signal.org/docs/specifications/x3dh/), which is used to establish end-to-end encrypted sessions using [the Double Ratchet algorithm](https://signal.org/docs/specifications/doubleratchet/).

#### Importance:

The current package does not appear to expose functionality for performing this conversion.
I was forced to use [libsodium](https://doc.libsodium.org/advanced/ed25519-curve25519):

```c
crypto_sign_ed25519_pk_to_curve25519(x25519_pk, ed25519_pk);
crypto_sign_ed25519_sk_to_curve25519(x25519_sk, ed25519_skpk);
```

#### Proposed API:

```swift
Curve25519.KeyAgreement.PrivateKey {

init(unsafeFromSigningPrivateKey key: Curve25519.Signing.PrivateKey) {...}
}

Curve25519.KeyAgreement.PublicKey {

init(unsafeFromSigningPublicKey key: Curve25519.Signing.PublicKey) {...}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the proposed Curve25519.KeyAgreement.PrivateKey and PublicKey initializers and their Curve25519.Signing key inputs. Compare the requested Ed25519-to-X25519 behavior with the package's existing API, then define tests that confirm both conversions before considering the feature complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.