Resolve verification material only. Never open/create an identity store or load a secret key; the proof's DID, not the default identity, selects a signer.
(
explicit: Option<&[u8]>,
name: Option<&str>,
signer: Option<&str>,
)
| 3024 | // Resolve verification material only. Never open/create an identity store or |
| 3025 | // load a secret key; the proof's DID, not the default identity, selects a signer. |
| 3026 | fn verification_public_key( |
| 3027 | explicit: Option<&[u8]>, |
| 3028 | name: Option<&str>, |
| 3029 | signer: Option<&str>, |
| 3030 | ) -> Result<atomic_identity::keypair::PublicKey, Status> { |
| 3031 | if let Some(bytes) = explicit { |
| 3032 | let bytes: &[u8; 32] = bytes |
| 3033 | .try_into() |
| 3034 | .map_err(|_| Status::invalid_argument("Ed25519 public key must be 32 bytes"))?; |
| 3035 | return atomic_identity::keypair::PublicKey::from_bytes(bytes) |
| 3036 | .map_err(|e| Status::invalid_argument(e.to_string())); |
| 3037 | } |
| 3038 | let store = |
| 3039 | IdentityStore::open_default_existing().map_err(|e| Status::not_found(e.to_string()))?; |
| 3040 | let identity = if let Some(name) = name { |
| 3041 | store.load_by_name(name) |
| 3042 | } else { |
| 3043 | let id = atomic_identity::IdentityId::from_did(signer.unwrap_or("")) |
| 3044 | .map_err(|e| Status::not_found(e.to_string()))?; |
| 3045 | store.load(&id) |
| 3046 | } |
| 3047 | .map_err(|e| Status::not_found(e.to_string()))?; |
| 3048 | Ok(identity.public_key) |
| 3049 | } |
| 3050 | |
| 3051 | /// The pre-attest gate the CLI's `attest` body applies: refuse violations |
| 3052 | /// signing cannot fill (everything except `proof` and `attributedTo`), so a |
no test coverage detected