Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RNV does not create encrypt destination folder #930

Closed
pauliusguzas opened this issue Oct 28, 2022 · 3 comments
Closed

RNV does not create encrypt destination folder #930

pauliusguzas opened this issue Oct 28, 2022 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pauliusguzas
Copy link
Collaborator

pauliusguzas commented Oct 28, 2022

Describe the bug
When encrypting data on new project, rnv asks to define where encrypted data will be stored (default is ./secrets) but renative doesn’t create that folder and you need to create it manually to make encrypt work

To Reproduce

  1. Have rnv project ready which doesn't have encrypt configured
  2. Run npx rnv crypto encrypt
  3. RNV asks to define destination of encrypted data
  4. Click "enter" - default will be selected
  5. RNV shows error that ./secrets can't be found

Expected behavior
RNV creates destination folder

Desktop (please complete the following information):

  • OS: macOS 12.4
  • Node Version v16.14.2
  • RNV Version 0.36.2-canary.4
@pauliusguzas pauliusguzas added the bug Something isn't working label Oct 28, 2022
@pauliusguzas pauliusguzas added this to the 0.37 (Faust) milestone Jun 13, 2023
@mihaiblaga89 mihaiblaga89 self-assigned this Jun 15, 2023
@mihaiblaga89 mihaiblaga89 modified the milestones: 0.37, 1.0 Jun 27, 2023
@pauliusguzas
Copy link
Collaborator Author

on 1.0.0-canary.4 rnv doesn't show error in the end of the logs that .secrets can't be found

pauliusguzas@MacBook-Pro-de-Flexn template-starter % rnv crypto encrypt

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│        ██████╗ ███████╗███╗   ██╗ █████╗ ████████╗██╗██╗   ██╗███████╗       │
│        ██╔══██╗██╔════╝████╗  ██║██╔══██╗╚══██╔══╝██║██║   ██║██╔════╝       │
│        ██████╔╝█████╗  ██╔██╗ ██║███████║   ██║   ██║██║   ██║█████╗         │
│        ██╔══██╗██╔══╝  ██║╚██╗██║██╔══██║   ██║   ██║╚██╗ ██╔╝██╔══╝         │
│        ██║  ██║███████╗██║ ╚████║██║  ██║   ██║   ██║ ╚████╔╝ ███████╗       │
│        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═══╝  ╚══════╝       │
│                                                                              │
│        Version: 1.0.0-canary.4                                               │
│        https://renative.org                                                  │
│        🚀 Firing up!...                                                      │
│        $ rnv crypto encrypt                                                  │
│        Start Time: 10/13/2023, 11:28:46 AM                                   │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

[ task ] registerEngine:engine-core[1]
[ task ] configureRuntimeDefaults[1] appId:undefined
[ task ] checkAndMigrateProject[1]
[ task ] loadPluginTemplates[1]
[ task ] _parsePluginTemplateDependencies[1] scope:root
[ task ] parseRenativeConfigs[1]
[ task ] getWorkspaceDirPath[1]
[ task ] _generatePlatformTemplatePaths[1]
[ task ] checkAndBootstrapIfRequired[1]
[ task ] loadIntegrations[1]
[ task ] loadEngines[1]
[ task ] loadEnginePluginDeps[1]
[ task ] loadEnginePackageDeps[1]
[ task ] findSuitableTask[1]
[ info ] Current Engine: engine-core path: undefined
[ task ] registerMissingPlatformEngines[1]
[ task ] registerEngine:engine-rn[1]
[ task ] registerEngine:engine-rn-tvos[1]
[ task ] registerEngine:engine-rn-next[1]
[ task ] registerEngine:engine-rn-web[1]
[ task ] registerEngine:engine-rn-electron[1]
[ task ] initializeTask[1] crypto encrypt
[ task ] => [crypto encrypt]
[ task ] [crypto encrypt] checkIfProjectAndNodeModulesExists[1]
[ hook ] [crypto encrypt] executePipe ('crypto:encrypt:before')
[ task ] [crypto encrypt] taskRnvCryptoEncrypt[1]
[ task ] => [crypto encrypt] => [project configure]
[ hook ] [project configure] executePipe ('project:configure:before')
[ task ] [project configure] taskRnvProjectConfigure[1]
[ task ] [project configure] checkAndMigrateProject[2]
[ task ] [project configure] loadPluginTemplates[2]
[ task ] [project configure] _parsePluginTemplateDependencies[2] scope:root
[ task ] [project configure] parseRenativeConfigs[2]
[ task ] [project configure] getWorkspaceDirPath[2]
[ task ] [project configure] _generatePlatformTemplatePaths[2]
[ task ] => [project configure] => [workspace configure]
[ task ] [workspace configure] taskRnvWorkspaceConfigure[1]
[ task ] <= [project configure] <= workspace configure
[ task ] [project configure] checkIfTemplateConfigured[1]
[ task ] => [project configure] => [install]
[ hook ] [install] executePipe ('install:before')
[ task ] [install] taskRnvInstall[1] requiresInstall:false:true
[ hook ] [install] executePipe ('install:after')
[ task ] <= [project configure] <= install
[ task ] [project configure] checkCrypto[1]
[ warn ] [project configure] This project uses encrypted files but you don't have them installed
[ task ] [project configure] configureRuntimeDefaults[2] appId:template
[ task ] [project configure] applyTemplate[1] undefined=>undefined
[ task ] [project configure] configureRuntimeDefaults[3] appId:template
[ task ] => [project configure] => [install]
[ hook ] [install] executePipe ('install:before')
[ task ] [install] taskRnvInstall[2] requiresInstall:false:true
[ hook ] [install] executePipe ('install:after')
[ task ] <= [project configure] <= install
[ task ] => [project configure] => [app configure]
[ hook ] [app configure] executePipe ('app:configure:before')
[ task ] [app configure] taskRnvAppConfigure[1]
[ task ] [app configure] listAppConfigsFoldersSync[1] ignoreHiddenConfigs:true
[ task ] [app configure] loadPluginTemplates[3]
[ task ] [app configure] _parsePluginTemplateDependencies[3] scope:root
[ task ] [app configure] parseRenativeConfigs[3]
[ task ] [app configure] getWorkspaceDirPath[3]
[ task ] [app configure] _generatePlatformTemplatePaths[3]
[ task ] [app configure] getWorkspaceDirPath[4]
[ task ] [app configure] generateLocalConfig[1] resetAppId:false
[ info ] [app configure] Current App Config: template
[ hook ] [app configure] executePipe ('app:configure:after')
[ task ] <= [project configure] <= app configure
[ task ] [project configure] versionCheck[1]
[ task ] [project configure] versionCheck:rnvRunner:1.0.0-canary.4,rnvProject:1.0.0-canary.4[1]
[ task ] [project configure] configureEngines[1]
[ task ] [project configure] resolvePluginDependants[1]
[ task ] [project configure] configurePlugins[1]
[ info ] [project configure] Missing dependency @react-native-community/cli-platform-ios v(11.3.7) in package.json. This is template. NO ACTION
[ task ] [project configure] configureRuntimeDefaults[4] appId:template
[ task ] [project configure] copyRuntimeAssets[1]
[ task ] [project configure] configureTemplateFiles[1]
[ task ] [project configure] checkAndCreateGitignore[1]
[ task ] [project configure] generateRuntimeConfig[1]
[ task ] [project configure] overrideTemplatePlugins[1]
[ task ] [project configure] parsePlugins[1]
[ task ] [project configure] parseFonts[1]
[ task ] [project configure] parsePlugins[2]
[ hook ] [project configure] executePipe ('project:configure:after')
[ task ] <= [crypto encrypt] <= project configure
[ info ] [crypto encrypt] It seems you are running encrypt for the first time. Directory /Users/pauliusguzas/.rnv/@rnv/template-starter does not exist yet.
RNV will create it for you, make sure you add whatever you want encrypted in it and then run the command again
? Once ready, Continue? Yes
? You haven't passed a key with --key or set an env variable named CRYPTO_RNV_RNV_TEMPLATE_STARTER for the encryption
key. Would you like to generate one? Yes
[ success ] [crypto encrypt] The files were encrypted with key NruKspk&BNrRQmC&L53S. Make sure you keep it safe! Pass it with --key on decryption or set it as following env variable:

export CRYPTO_RNV_RNV_TEMPLATE_STARTER="NruKspk&BNrRQmC&L53S"


Error: ENOENT: no such file or directory, open '/Users/pauliusguzas/Desktop/renative/renative/packages/template-starter/secrets/privateConfigs.enc'
    at Object.openSync (node:fs:601:3)
    at Object.writeFileSync (node:fs:2249:35)
    at fsWriteFileSync (/Users/pauliusguzas/Desktop/renative/renative/packages/core/src/system/fs.ts:20:8)
    at /Users/pauliusguzas/Desktop/renative/renative/packages/engine-core/src/tasks/task.rnv.crypto.encrypt.ts:161:24
    at step (/Users/pauliusguzas/Desktop/renative/renative/node_modules/tslib/tslib.js:195:27)
    at Object.next (/Users/pauliusguzas/Desktop/renative/renative/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/Users/pauliusguzas/Desktop/renative/renative/node_modules/tslib/tslib.js:166:62) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/pauliusguzas/Desktop/renative/renative/packages/template-starter/secrets/privateConfigs.enc'
}

 $ rnv crypto encrypt - Done! 🚀
┌──────────────────────────────────────────────────────────────────────────────┐
│  🚀  SUMMARY | 10/13/2023, 11:28:53 AM                                       │
│  $ rnv crypto encrypt                                                        │
├──────────────────────────────────────────────────────────────────────────────┤
│  ReNative Version: 1.0.0-canary.4                                            │
│  Project Name ($package.name): @rnv/template-starter                         │
│  Project Version ($package.version): 1.0.0-canary.4                          │
│  Workspace ($.workspaceID): rnv                                              │
│  Engine: engine-core                                                         │
│  App Config (-c): template                                                   │
│  Build Scheme (-s): debug                                                    │
│  Supported Platforms: ios, android, androidtv, firetv,                       │
│  androidwear, web, webtv, tizen, tvos, webos, macos, windows,                │
│  tizenwatch, tizenmobile, kaios, chromecast                                  │
│  Env Info: darwin | x64 | node v18.16.0                                      │
│  Executed Time: 0h:0m:6s:950ms                                               │
│                                                                              │
│ [ warn ] [project configure] This project uses encrypted files but you don't have them installed
│ [ success ] [crypto encrypt] The files were encrypted with key NruKspk&BNrRQmC&L53S. Make sure you keep it safe! Pass it with --key on decryption or set it as following env variable:

export CRYPTO_RNV_RNV_TEMPLATE_STARTER="NruKspk&BNrRQmC&L53S"


│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
pauliusguzas@MacBook-Pro-de-Flexn template-starter %

@ElenaDiachenko ElenaDiachenko self-assigned this Nov 20, 2023
@pauliusguzas
Copy link
Collaborator Author

In canary.8 noticed also that rnv doesn't create decrypt destination folder and contents, if user runs rnv crypto encrypt when there is no encrypted and decryped data this error appears:

[Error: ENOENT: no such file or directory, lstat '/Users/pauliusguzas/.rnv/@rnv/template-starter'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/pauliusguzas/.rnv/@rnv/template-starter'
}

 $ rnv crypto encrypt - Done! 🚀
┌──────────────────────────────────────────────────────────────────────────────┐
│  🚀  SUMMARY | 11/21/2023, 9:55:34 AM                                        │
│  $ rnv crypto encrypt                                                        │
├──────────────────────────────────────────────────────────────────────────────┤
│  ReNative Version: 1.0.0-canary.8                                            │
│  Project Name ($package.name): @rnv/template-starter                         │
│  Project Version ($package.version): 1.0.0-canary.8                          │
│  Workspace ($.workspaceID): rnv                                              │
│  Engine: engine-core                                                         │
│  App Config (-c): template                                                   │
│  Build Scheme (-s): debug                                                    │
│  Supported Platforms: ios, android, androidtv, firetv,                       │
│  androidwear, web, webtv, tizen, tvos, webos, macos, windows,                │
│  tizenwatch, tizenmobile, kaios, chromecast                                  │
│  Master Template: @rnv/template-starter                                      │
│  Env Info: darwin | x64 | node v18.16.0                                      │
│  Executed Time: 0h:0m:2s:62ms                                                │
│                                                                              │
│ [ warn ] [project configure] This project uses encrypted files but you don't have them installed
│ [ success ] [crypto encrypt] The files were encrypted with key FUi0F1lK^GqxXcm5IZly. Make sure you keep it safe! Pass it with --key on decryption or set it as following env variable:

export CRYPTO_RNV_RNV_TEMPLATE_STARTER="FUi0F1lK^GqxXcm5IZly"


│ You are trying to run global rnv command in your current project.
│ This might lead to unexpected behaviour.
│ Run your rnv command with npx prefix:
│ npx rnv crypto encrypt
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
pauliusguzas@MBP-de-Flexn template-starter %

@pauliusguzas
Copy link
Collaborator Author

pauliusguzas commented Dec 12, 2023

Same issue in 1.0.0-rc.3 as in main description, secrets folder isn't created, test on template-starter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants