| 357 | ctx, |
| 358 | format, |
| 359 | kind, |
| 360 | data, |
| 361 | const_oid::db::rfc8410::ID_ED_25519, |
| 362 | algorithm_name, |
| 363 | true, |
| 364 | )?; |
| 365 | Ok(Some(*kind)) |
| 366 | } else { |
| 367 | Ok(None) |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | #[cfg(not(feature = "_subtle-full"))] |
| 372 | #[inline] |
| 373 | fn import<'js>( |
| 374 | _ctx: &Ctx<'js>, |
| 375 | _mode: KeyAlgorithmMode<'_, 'js>, |
| 376 | _algorithm_name: &str, |
| 377 | ) -> Result<Option<KeyKind>> { |
| 378 | Ok(None) |
| 379 | } |
| 380 | |
| 381 | let key_kind = import(ctx, mode, algorithm_name)?; |
| 382 | KeyUsage::classify_and_check_usages( |
| 383 | ctx, |
| 384 | KeyUsageAlgorithm::Sign, |
| 385 | usages, |
| 386 | private_usages, |
| 387 | public_usages, |
| 388 | key_kind.as_ref(), |
| 389 | )?; |
| 390 | Ok(KeyAlgorithm::Ed25519) |
| 391 | } |
| 392 | |
| 393 | fn from_x25519<'js>( |
| 394 | ctx: &Ctx<'js>, |
| 395 | mode: KeyAlgorithmMode<'_, 'js>, |
| 396 | algorithm_name: &str, |
| 397 | usages: &Array<'js>, |
| 398 | private_usages: &mut Vec<String>, |
| 399 | public_usages: &mut Vec<String>, |
| 400 | ) -> Result<KeyAlgorithm> { |
| 401 | #[cfg(feature = "_subtle-full")] |
| 402 | #[inline] |
| 403 | fn import<'js>( |
| 404 | ctx: &Ctx<'js>, |
| 405 | mode: KeyAlgorithmMode<'_, 'js>, |
| 406 | algorithm_name: &str, |
| 407 | ) -> Result<Option<KeyKind>> { |
| 408 | if let KeyAlgorithmMode::Import { format, kind, data } = mode { |
| 409 | import_okp_key( |
| 410 | ctx, |
| 411 | format, |
| 412 | kind, |