Skip to content

Commit

Permalink
remove returning a doc on create
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe committed Nov 1, 2023
1 parent 3990e83 commit f5e3031
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
11 changes: 1 addition & 10 deletions packages/dids/src/did-dht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
DidDocument,
DidKeySetVerificationMethodKey,
DidMethod,
DidResolutionResult,
DidService, PortableDid,
VerificationRelationship
} from './types.js';
Expand Down Expand Up @@ -88,22 +87,14 @@ export class DidDhtMethod implements DidMethod {
* @param keySet The key set to use to sign the DHT payload
* @param didDocument The DID Document to publish
*/
public static async publish(keySet: DidDhtKeySet, didDocument: DidDocument): Promise<DidResolutionResult> {
public static async publish(keySet: DidDhtKeySet, didDocument: DidDocument): Promise<void> {
const publicCryptoKey = await Jose.jwkToCryptoKey({key: keySet.identityKey.publicKeyJwk});
const privateCryptoKey = await Jose.jwkToCryptoKey({key: keySet.identityKey.privateKeyJwk});

await DidDht.publishDidDocument({
publicKey : publicCryptoKey,
privateKey : privateCryptoKey
}, didDocument);

return {
didDocumentMetadata : undefined,
didDocument,
didResolutionMetadata : {
contentType: 'application/json'
}
};
}

/**
Expand Down
12 changes: 1 addition & 11 deletions packages/dids/tests/did-dht.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,7 @@ describe('did-dht', () => {

it('should publish and get a did document', async () => {
const {document, keySet} = await DidDhtMethod.create();
const didResolutionResult = await DidDhtMethod.publish(keySet, document);

expect(didResolutionResult).to.exist;
expect(didResolutionResult.didDocument).to.exist;
expect(didResolutionResult.didDocument.id).to.equal(document.id);
expect(didResolutionResult.didDocument.verificationMethod).to.exist;
expect(didResolutionResult.didDocument.verificationMethod).to.have.lengthOf(1);
expect(didResolutionResult.didDocument.verificationMethod[0].id).to.equal(`${document.id}#0`);
expect(didResolutionResult.didDocument.verificationMethod[0].publicKeyJwk).to.exist;
expect(didResolutionResult.didDocument.verificationMethod[0].publicKeyJwk.kid).to.equal('0');
expect(didResolutionResult.didDocument.service).to.not.exist;
await DidDhtMethod.publish(keySet, document);

// wait for propagation
await wait(1000*10);
Expand Down

0 comments on commit f5e3031

Please sign in to comment.