credo-ts icon indicating copy to clipboard operation
credo-ts copied to clipboard

Delete tags when deleting a record item

Open TimoGlastra opened this issue 3 years ago • 3 comments

It seems tags are not autmoatically deleted when deleting a record, so we should add this to the IndyStorageService: https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs#deletewalletrecordtags--wh-type-id-tagnames----void

  1. Create small PoC to test if tags are deleted (see below)
  2. If the tags are not deleted, delete tags when deleting a record in the IndyStorageService.ts file (using https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs#deletewalletrecordtags--wh-type-id-tagnames----void).

PoC

  1. Create new project, add indy-sdk as dependency
  2. Create a new wallet and open it (See https://github.com/hyperledger/aries-framework-javascript/blob/main/packages/node/bin/is-indy-installed.js#L9 for how to create a wallet, see https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs#openwallet--config-credentials----handle on how to open a wallet).
  3. Open the wallet database in a SQLite viewer (located in ~/.indy_client/wallet/<wallet-name>/sqlite.db).
  4. Add a new record in the wallet with tags (https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs#addwalletrecord--wh-type-id-value-tags----void)
  5. Check to see if the tags are added in the sqlite viewer
  6. Delete the record (https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs#deletewalletrecord--wh-type-id----void)
  7. Check to see if the tags are deleted in the sqlite viewer

TimoGlastra avatar Jun 07 '22 10:06 TimoGlastra

Where does it show that the tags are not deleted when a record is deleted? Maybe you can just delete the tags without deleting the record. I am trying to find it in the indy-sdk code but thats not the easiest place to look.

berendsliedrecht avatar Jun 08 '22 14:06 berendsliedrecht

The .NET framework does it: https://cs.github.com/hyperledger/aries-framework-dotnet/blob/8f5748bf8517d5d4488e632eac9a68938ee2c168/src/Hyperledger.Aries/Storage/DefaultWalletRecordService.cs?q=repo%3Ahyperledger%2Faries-framework-dotnet+deleteAsync#L126-L130

But yeah could be that it is automatically done. However you also need to store and update them separately, so wouldn't surprise me if you also need to delete them manually

TimoGlastra avatar Jun 08 '22 15:06 TimoGlastra

The .NET framework does it: https://cs.github.com/hyperledger/aries-framework-dotnet/blob/8f5748bf8517d5d4488e632eac9a68938ee2c168/src/Hyperledger.Aries/Storage/DefaultWalletRecordService.cs?q=repo%3Ahyperledger%2Faries-framework-dotnet+deleteAsync#L126-L130

But yeah could be that it is automatically done. However you also need to store and update them separately, so wouldn't surprise me if you also need to delete them manually

AH yeah storing and updating seperately implies that. Maybe a quick test with creating a record with some tags, deleting the record and trying to fetch by tags?

berendsliedrecht avatar Jun 08 '22 15:06 berendsliedrecht

Indy SDK has been removed

TimoGlastra avatar Feb 14 '24 06:02 TimoGlastra