opentrace-community / opentrace-cloud-functions

OpenTrace Cloud Functions. Reference implementation of the BlueTrace protocol.
https://bluetrace.io
GNU General Public License v3.0
273 stars 121 forks source link

getUploadToken: ERR_CRYPTO_INVALID_STATE #50

Open samsoncsyu7777 opened 4 years ago

samsoncsyu7777 commented 4 years ago

When a user enters PIN to upload, there is an error logged in Firebase functions getUploadToken: Unhandled error Error [ERR_CRYPTO_INVALID_STATE]: Invalid state for operation getAuthTag. What can I do to fix it?

alexissinglaire commented 4 years ago

@samsoncsyu7777 : Have you define the secret value in secret manager API?

How is the parameter configured inside config.ts under folder /functions/src/ for following parameters:

samsoncsyu7777 commented 4 years ago

Thank you for your help. [image: image.png] We have secret key in secret manager.

Here is the encryption part in config.ts: encryption: { defaultAlgorithm: "aes-256-cbc", keyPath: "EncryptionKey", defaultVersion: 1, },

On Sun, 10 May 2020 at 00:53, ALEXIS SINGLAIRE notifications@github.com wrote:

@samsoncsyu7777 https://github.com/samsoncsyu7777 : Have you define the secret value in secret manager API?

How is the parameter configured inside config.ts under folder /functions/src/ for following parameters:

  • defaultAlgorithm
  • keyPath

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opentrace-community/opentrace-cloud-functions/issues/50#issuecomment-626273497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIDKQLBC3EXRWJEKSKJSEDRQYXNZANCNFSM4M44KQNQ .

alexissinglaire commented 4 years ago

Is your secret key name called 'EncryptionKey'? How you build the secret value? Are you using head command to create the secret value ?

Refer to this screenshot for the secret key name

https://github.com/opentrace-community/opentrace-cloud-functions/issues/51#issuecomment-626281001

samsoncsyu7777 commented 4 years ago

I followed the instructions (command line) of readme to build it.

On Sun, May 10, 2020, 8:48 AM ALEXIS SINGLAIRE, notifications@github.com wrote:

Is your secret key name called 'EncryptionKey'? How you build the secret value? Are you using head command to create the secret value ?

Refer to this screenshot for the secret key name

51 (comment)

https://github.com/opentrace-community/opentrace-cloud-functions/issues/51#issuecomment-626281001

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opentrace-community/opentrace-cloud-functions/issues/50#issuecomment-626323222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIDKQLG2PHVMMQPJBAA2E3RQ2PCRANCNFSM4M44KQNQ .

samsoncsyu7777 commented 4 years ago

Is it good to delete the secret key and build it again?

On Sun, May 10, 2020, 8:53 AM Samson Samson, samsoncsyu77771402@gmail.com wrote:

I followed the instructions (command line) of readme to build it.

On Sun, May 10, 2020, 8:48 AM ALEXIS SINGLAIRE, notifications@github.com wrote:

Is your secret key name called 'EncryptionKey'? How you build the secret value? Are you using head command to create the secret value ?

Refer to this screenshot for the secret key name

51 (comment)

https://github.com/opentrace-community/opentrace-cloud-functions/issues/51#issuecomment-626281001

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opentrace-community/opentrace-cloud-functions/issues/50#issuecomment-626323222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIDKQLG2PHVMMQPJBAA2E3RQ2PCRANCNFSM4M44KQNQ .

alexissinglaire commented 4 years ago

Hi, can you give screenshot of your secret key name similar to sample.of screenshot I gave you?

If you use head command to create the secret value, then you need to define defaultAlgorithm value as aes-256-gcm.

samsoncsyu7777 commented 4 years ago

It works. Thank you very much.