Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
db81dfc
crypto: add teddsa_interface package
Ryz0nd Dec 23, 2025
bc62335
crypto: add teddsa_core Rust library
Ryz0nd Dec 23, 2025
696c9ed
crypto: add teddsa_wasm WASM bindings
Ryz0nd Dec 23, 2025
1c1267a
crypto: add teddsa_hooks TypeScript wrappers
Ryz0nd Dec 23, 2025
e99fc49
crypto: add teddsa_hooks TypeScript wrappers
Ryz0nd Dec 23, 2025
1e5f8cb
common: add Ed25519 types to oko_types
Ryz0nd Dec 23, 2025
9c4a610
ksn: add Ed25519 curve support
Ryz0nd Dec 23, 2025
72cd000
tss_api: add Ed25519 keygen endpoint
Ryz0nd Dec 23, 2025
2c20099
tss_api: add Ed25519 presign/sign endpoints
Ryz0nd Dec 23, 2025
f964c88
tss_api: add wallet_ed25519 public info endpoint
Ryz0nd Dec 23, 2025
c571b95
tss_api: update JWT for Ed25519 wallet
Ryz0nd Dec 23, 2025
49ff05b
Merge branch 'main' into dan/teddsa
chemonoworld Dec 24, 2025
871db8d
teddsa: remove teddsa_core
Ryz0nd Dec 24, 2025
1b5b107
teddsa: use frost_ed25519_keplr directly
Ryz0nd Dec 24, 2025
1681238
o
chemonoworld Dec 24, 2025
6fa6f78
teddsa: refactor and implement keygen and signing for Ed25519(combine)
chemonoworld Dec 24, 2025
dfa1ccc
teddsa: remove unused teddsa_hooks
Ryz0nd Dec 24, 2025
7c5d4a9
Revert "teddsa: remove unused teddsa_hooks"
Ryz0nd Dec 24, 2025
be408b1
teddsa: implement Ed25519 key recovery
Ryz0nd Dec 27, 2025
8396967
teddsa: impl KeyPackageRaw & PublicKeyPackageRaw for JS Object or JS …
chemonoworld Dec 29, 2025
4c77f08
o
chemonoworld Dec 29, 2025
e9a48ff
o
chemonoworld Dec 29, 2025
2c216db
teddsa: impl IdentifierRaw
chemonoworld Dec 29, 2025
ba23b17
teddsa: impl from_key_package method
chemonoworld Dec 29, 2025
e423610
o
chemonoworld Dec 29, 2025
6d5a67d
teddsa: impl to_key_package and to_public_key_package methods
chemonoworld Dec 29, 2025
88120ed
teddsa: refactor CentralizedKeygenOutputRaw
chemonoworld Dec 29, 2025
99d6a19
o
chemonoworld Dec 29, 2025
c3072c5
o
chemonoworld Dec 29, 2025
b9168bd
teddsa: refactor split and combine
chemonoworld Dec 29, 2025
d375432
o
chemonoworld Dec 29, 2025
0e797c6
teddsa: refactor reshare
chemonoworld Dec 29, 2025
7859edd
Revert "teddsa: implement Ed25519 key recovery"
Ryz0nd Dec 30, 2025
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
91 changes: 91 additions & 0 deletions crypto/teddsa/frost_ed25519_keplr_wasm/wasm/src/sss/key_package.rs
Copy link
Contributor

@chemonoworld chemonoworld Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert this commit: be408b1? The existing serialization methods are not suitable for structure of our project . I'll add methods which are compatible with the existing architecture.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//! Key extraction and reconstruction functions for Ed25519 FROST recovery.

use frost_ed25519_keplr::keys::{
KeyPackage, PublicKeyPackage, SigningShare, VerifyingShare,
};
use frost_ed25519_keplr::Identifier;
use gloo_utils::format::JsValueSerdeExt;
use wasm_bindgen::prelude::*;

/// Extract the signing_share (32 bytes) from a serialized KeyPackage.
///
/// This is used to backup the user's signing share on KS nodes via SSS.
/// The signing_share is the secret scalar value that must be protected.
#[wasm_bindgen]
pub fn extract_signing_share(key_package: JsValue) -> Result<JsValue, JsValue> {
let key_package_bytes: Vec<u8> = key_package
.into_serde()
.map_err(|err| JsValue::from_str(&format!("Invalid key_package format: {}", err)))?;

let key_package = KeyPackage::deserialize(&key_package_bytes)
.map_err(|e| JsValue::from_str(&format!("Failed to deserialize KeyPackage: {}", e)))?;

// Extract the signing share (32-byte scalar)
let signing_share_bytes = key_package.signing_share().serialize();

JsValue::from_serde(&signing_share_bytes)
.map_err(|err| JsValue::from_str(&err.to_string()))
}

/// Reconstruct a KeyPackage from a signing_share, public_key_package, and identifier.
///
/// This is used during recovery: after SSS-combining the signing_share from KS nodes,
/// we need to rebuild the full KeyPackage to use for signing.
///
/// The verifying_share is derived from signing_share (verifying_share = signing_share * G).
/// The verifying_key comes from the PublicKeyPackage.
/// min_signers is always 2 (hardcoded for 2-of-2 scheme).
#[wasm_bindgen]
pub fn reconstruct_key_package(
signing_share: JsValue,
public_key_package: JsValue,
identifier: JsValue,
) -> Result<JsValue, JsValue> {
// Parse inputs
let signing_share_bytes: Vec<u8> = signing_share
.into_serde()
.map_err(|err| JsValue::from_str(&format!("Invalid signing_share format: {}", err)))?;

let public_key_package_bytes: Vec<u8> = public_key_package
.into_serde()
.map_err(|err| JsValue::from_str(&format!("Invalid public_key_package format: {}", err)))?;

let identifier_bytes: Vec<u8> = identifier
.into_serde()
.map_err(|err| JsValue::from_str(&format!("Invalid identifier format: {}", err)))?;

// Deserialize components
let signing_share = SigningShare::deserialize(&signing_share_bytes)
.map_err(|e| JsValue::from_str(&format!("Failed to deserialize signing_share: {}", e)))?;

let pubkey_package = PublicKeyPackage::deserialize(&public_key_package_bytes)
.map_err(|e| JsValue::from_str(&format!("Failed to deserialize public_key_package: {}", e)))?;

let identifier = Identifier::deserialize(&identifier_bytes)
.map_err(|e| JsValue::from_str(&format!("Failed to deserialize identifier: {}", e)))?;

// Derive verifying_share from signing_share: verifying_share = signing_share * G
// This is implemented via From<SigningShare> for VerifyingShare
let verifying_share: VerifyingShare = signing_share.clone().into();

// Get the group verifying key from PublicKeyPackage
let verifying_key = *pubkey_package.verifying_key();

// Construct the KeyPackage
// min_signers = 2 for our 2-of-2 scheme
let key_package = KeyPackage::new(
identifier,
signing_share,
verifying_share,
verifying_key,
2, // min_signers
);

// Serialize and return
let key_package_bytes = key_package
.serialize()
.map_err(|e| JsValue::from_str(&format!("Failed to serialize KeyPackage: {}", e)))?;

JsValue::from_serde(&key_package_bytes)
.map_err(|err| JsValue::from_str(&err.to_string()))
}
2 changes: 2 additions & 0 deletions crypto/teddsa/frost_ed25519_keplr_wasm/wasm/src/sss/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod combine;
mod key_package;
mod reshare;
mod split;

pub use combine::*;
pub use key_package::*;
pub use reshare::*;
pub use split::*;
Loading