Skip to content

Commit

Permalink
Hotfix: convert pub key for members. (#59)
Browse files Browse the repository at this point in the history
* Hotfix: convert pub key for members.

* Hotfix/listdir/convert-pub-key: fix test

* Another test fix
  • Loading branch information
jsonsivar authored Feb 26, 2021
1 parent 977dd73 commit 3b7c176
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions integration_tests/sharing_interactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ describe('Users sharing data', () => {
}],
});

const ld = await storage1.listDirectory({ bucket: 'personal', path: '' });
expect(ld.items[0].members[0].publicKey).to.equal(user2Pk);

expect(shareResult.publicKeys).not.to.be.empty;
expect(shareResult.publicKeys[0].type).to.equal(ShareKeyType.Existing);
expect(shareResult.publicKeys[0].pk).not.to.be.empty;
Expand Down
3 changes: 2 additions & 1 deletion packages/storage/src/userStorage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Identity, GetAddressFromPublicKey } from '@spacehq/users';
import { tryParsePublicKey } from '@spacehq/utils';
import { PrivateKey } from '@textile/crypto';
import { Buckets, PathAccessRole, PathItem, PushPathResult, Root } from '@textile/hub';
import { expect, use } from 'chai';
Expand Down Expand Up @@ -222,7 +223,7 @@ describe('UserStorage', () => {
expect(result.items[0].isLocallyAvailable).to.equal(false);
expect(result.items[0].backupCount).to.equal(1);
expect(result.items[0].members).to.deep.equal([{
publicKey: pubkey,
publicKey: Buffer.from(tryParsePublicKey(pubkey).pubKey).toString('hex'),
role: PathAccessRole.PATH_ACCESS_ROLE_WRITER,
address: GetAddressFromPublicKey(pubkey),
}]);
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/userStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class UserStorage {

ms.forEach((v, k) => {
members.push({
publicKey: k,
publicKey: k === '*' ? '*' : Buffer.from(tryParsePublicKey(k).pubKey).toString('hex'),
address: k === '*' ? '' : GetAddressFromPublicKey(k),
role: v,
});
Expand Down

0 comments on commit 3b7c176

Please sign in to comment.