diff --git a/packages/keymaster/src/keymaster-lib.js b/packages/keymaster/src/keymaster-lib.js index 3eda805f..2aeaf0e8 100644 --- a/packages/keymaster/src/keymaster-lib.js +++ b/packages/keymaster/src/keymaster-lib.js @@ -1023,9 +1023,7 @@ export async function issueCredential(credential, options = {}) { } const signed = await addSignature(credential); - const cipherDid = await encryptJSON(signed, credential.credentialSubject.id, { ...options, includeHash: true }); - await addToOwned(cipherDid); - return cipherDid; + return encryptJSON(signed, credential.credentialSubject.id, { ...options, includeHash: true }); } export async function updateCredential(did, credential) { diff --git a/tests/keymaster.test.js b/tests/keymaster.test.js index b39db8ab..0785d55f 100644 --- a/tests/keymaster.test.js +++ b/tests/keymaster.test.js @@ -1184,9 +1184,24 @@ describe('listAssets', () => { const dataDid = await keymaster.createAsset(mockAnchor); await keymaster.createId('Bob'); - const assets = await keymaster.listAssets('Alice'); + const assetsBob = await keymaster.listAssets(); + const assetsAlice = await keymaster.listAssets('Alice'); - expect(assets).toStrictEqual([dataDid]); + expect(assetsBob).toStrictEqual([]); + expect(assetsAlice).toStrictEqual([dataDid]); + }); + + it('should not include ephemeral assets', async () => { + mockFs({}); + + await keymaster.createId('Bob'); + const mockAnchor = { name: 'mockAnchor' }; + const validUntil = new Date(); + validUntil.setMinutes(validUntil.getMinutes() + 1); + await keymaster.createAsset(mockAnchor, { validUntil }); + const assets = await keymaster.listAssets(); + + expect(assets).toStrictEqual([]); }); }); @@ -1674,9 +1689,6 @@ describe('issueCredential', () => { const isValid = await keymaster.verifySignature(vc); expect(isValid).toBe(true); - - const wallet = await keymaster.loadWallet(); - expect(wallet.ids['Bob'].owned.includes(did)).toEqual(true); }); it('should throw an exception if user is not issuer', async () => {