Discover only unresolved DIDs, with no pristine transaction held over I/O. Older storage versions cannot resolve fingerprint DIDs: that is a cache miss, never permission to interpret the fingerprint bytes as a public key.
(repo: &Repository, client: &StorageClient)
| 24 | /// Older storage versions cannot resolve fingerprint DIDs: that is a cache |
| 25 | /// miss, never permission to interpret the fingerprint bytes as a public key. |
| 26 | pub async fn refresh(repo: &Repository, client: &StorageClient) -> Result<usize, RepositoryError> { |
| 27 | let signers = repo.unresolved_attestation_signers()?; |
| 28 | let mut cached = 0; |
| 29 | for did in signers { |
| 30 | let response = tokio::time::timeout( |
| 31 | std::time::Duration::from_secs(10), |
| 32 | client.resolve_identity_by_public_key(&did), |
| 33 | ) |
| 34 | .await; |
| 35 | let Some(key) = response |
| 36 | .ok() |
| 37 | .and_then(Result::ok) |
| 38 | .and_then(|identity| identity.public_key) |
| 39 | .and_then(|key| PublicKey::from_base32(&key).ok()) |
| 40 | else { |
| 41 | continue; |
| 42 | }; |
| 43 | if !atomic_canonical::did::did_matches_public_key(&did, &key) { |
| 44 | continue; |
| 45 | } |
| 46 | repo.cache_signer_key(&did, &key)?; |
| 47 | cached += 1; |
| 48 | } |
| 49 | Ok(cached) |
| 50 | } |
no test coverage detected