Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Encrypt and decrypt content #41

Merged
merged 3 commits into from
Dec 21, 2020
Merged

Encrypt and decrypt content #41

merged 3 commits into from
Dec 21, 2020

Conversation

javiesses
Copy link
Contributor

  • Added encryption-manager to manage encryption
  • Updated README
  • Updated existing tests
  • Implement encryption in create and swap methods
  • Implemente decryption in get method

// these are examples with Metamask
const rpcPersonalSign = (data: string) => window.ethereum.request({ method: 'personal_sign', params: [address, data] })
const decrypt = (hexCypher: string) => window.ethereum.request({ method: 'eth_decrypt', params: [hexCypher, address] })
const getEncryptionPublicKey = () => window.ethereum.request.request({ method: 'eth_getEncryptionPublicKey', params: [address] })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get it once. It should be always the same for the same address

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilanolkies ilanolkies mentioned this pull request Dec 21, 2020
4 tasks
@javiesses
Copy link
Contributor Author

Closes #14

return axios.get(`${this.config.serviceUrl}/content/${did}/${key}`)
.then(res => res.status === 200 && res.data)
.catch(this.errorHandler)
async get ({ did, key }: GetContentPayload): Promise<GetContentResponsePayload[]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: should this method encrypt the key or be authenticated?

Copy link
Contributor

@ilanolkies ilanolkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR approved, but opened two new issues: #42 and #43

@javiesses javiesses merged commit a117200 into develop Dec 21, 2020
@delete-merged-branch delete-merged-branch bot deleted the encryption branch December 21, 2020 15:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants