Skip to content

Commit

Permalink
fix root record encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe committed Oct 14, 2023
1 parent 87e4636 commit 92238c5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/dids/src/dht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class DidDht {
answers : []
};

const vmIds: string[] = [];
const svcIds : string[]= [];
const rootRecord: string[] = [];
const keyLookup = new Map<string, string>();

Expand Down Expand Up @@ -71,7 +73,7 @@ export class DidDht {
};

packet.answers.push(keyRecord);
rootRecord.push(`vm=${recordIdentifier}`);
vmIds.push(recordIdentifier);
}

// Add service records
Expand All @@ -86,9 +88,17 @@ export class DidDht {
};

packet.answers.push(serviceRecord);
rootRecord.push(`srv=${recordIdentifier}`);
svcIds.push(recordIdentifier);
});

// add root record for vms and svcs
if (vmIds.length) {
rootRecord.push(`vm=${vmIds.join(',')}`);
}
if (svcIds.length) {
rootRecord.push(`svc=${svcIds.join(',')}`);
}

// add verification relationships
if (document.authentication) {
const authIds: string[] = document.authentication
Expand Down

0 comments on commit 92238c5

Please sign in to comment.