Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: service_count var name clarified #16

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions affinidi-did-resolver-methods/did-peer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl DIDMethodResolver for DIDPeer {
// did:peer:2.(process from here)
let parts: Vec<&str> = method_specific_id[2..].split('.').collect();
let mut key_count: u32 = 1;
let mut service_count: u32 = 0;
let mut service_idx: u32 = 0;

for part in parts {
let ch = part.chars().next();
Expand Down Expand Up @@ -455,18 +455,18 @@ impl DIDMethodResolver for DIDPeer {
};

let mut service: Service = service.into();
if service_count > 0 {
if service_idx > 0 {
// TODO: Should be #service-1, #service-2, etc
// SSI Crate expects a URI for the service ID
service.id = UriBuf::new(
["did:peer:#service-", &service_count.to_string()]
["did:peer:#service-", &service_idx.to_string()]
.concat()
.into(),
)
.unwrap();
}
services.push(service);
service_count += 1;
service_idx += 1;
}
other => {
return Err(Error::RepresentationNotSupported(format!(
Expand Down
Loading