Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed May 7, 2020
1 parent 2a35b8e commit a32fb29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions example/vcdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import VerifiableCredential from '../src/verifiable-credential';
import VerifiablePresentation from '../src/verifiable-presentation';
import { createNewDockDID } from '../src/utils/did';
import { registerNewDIDUsingPair } from '../tests/integration/helpers';
import { OneOfPolicy } from '../src/utils/revocation';
import { createRandomRegistryId, OneOfPolicy } from '../src/utils/revocation';
import { FullNodeEndpoint, TestAccountURI } from '../tests/test-constants';
import getKeyDoc from '../src/utils/vc/helpers';
import { DockResolver } from '../src/resolver';
Expand All @@ -18,7 +18,7 @@ const issuerSeed = randomAsHex(32);
const holderDID = createNewDockDID();
const holderSeed = randomAsHex(32);

const registryId = randomAsHex(32);
const registryId = createRandomRegistryId();

// Sample credential data
const credentialId = 'http://example.edu/credentials/1986';
Expand Down
4 changes: 2 additions & 2 deletions src/utils/did.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function createKeyDetail(publicKey, controller) {
* @param {object} didModule - The did module
* @param {string} did - Full DID or hex identifier to update
* @param {PublicKey} newPublicKey - The new public key for the DID. The
* @param {string} newController - Full DID or hex identifier of the controller of the public key. Is optional and must
* @param {string} [newController] - Full DID or hex identifier of the controller of the public key. Is optional and must
* only be passed when controller is to be updated.
* @returns {Promise<object>} The object has structure and keys with same names as expected by the Substrate node
*/
Expand Down Expand Up @@ -151,7 +151,7 @@ export function signKeyUpdate(didModule, keyUpdate, currentKeyPair) {
* @param {string} did - Full DID or hex identifier to update
* @param {PublicKey} newPublicKey - The new public key for the DID
* @param {object} currentKeyPair - Should have the private key corresponding to the current public key for the DID
* * @param {string} newController - Full DID or hex identifier of the controller of the public. Is optional and must
* * @param {string} [newController] - Full DID or hex identifier of the controller of the public. Is optional and must
* only be passed when controller is to be updated
* @returns {Promise<array>} A 2 element array where the first element is the `KeyUpdate` and the second is the signature
*/
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/did.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ describe('DID Module', () => {
// Update DID key to the following
const newPair = dock.keyring.addFromUri(secondKeySeed, null, 'ed25519');
const newPk = PublicKeyEd25519.fromKeyringPair(newPair);
const newController = randomAsHex(32);

const [keyUpdate, signature] = await createSignedKeyUpdate(dock.did, dockDID, newPk, currentPair, newController);
const [keyUpdate, signature] = await createSignedKeyUpdate(dock.did, dockDID, newPk, currentPair);
// Since controller was not passed, it should not be passed in the key update
expect(keyUpdate.controller).toBe(undefined);

const transaction = dock.did.updateKey(keyUpdate, signature);
const result = await dock.sendTransaction(transaction);
Expand Down

0 comments on commit a32fb29

Please sign in to comment.