Generate private key without UI when setup?

Hi,
I created some custom services using Passbolt APIs and trying to set up some integration tests based on Passbolt for these services.
Since during the integration test I need a new installed Passbolt and I don’t want to have user to click the link and download the key from UI. Same if running these kind of integration tests with Passbolt in Travis or Github Action. The private key is essential for login process during the integration test.
so is there alternative way to get the private key when registering the admin user without using UI?

Thank you!

Hi @kyxyes,

It’s not possible to get the private key without interacting with the UI (e.g. trigger a download) for security reasons.

However you can import an existing key during the setup so what you could do is generate your key on the side (using gnupg or mailvelope, or even passbolt) and then reuse them in your integration tests. This is how we do it for integration tests at passbolt.

If you want to go further there is also a “passbolt_test_data” plugin that you can install and use to load default data with default users and resources, etc… If you have “selenium” mode enabled, you can also reset the state of the database (like reload the default after your tests). I can explain more on that if that’s what you’re after.

Ref. GitHub - passbolt/passbolt_test_data: Passbolt API test data plugin

1 Like

@remy Thanks for your reply!

You mean I can generate a key pair and import the user public key to Passbolt server? Sorry can you clarify this?

You mean I can generate a key pair and import the user public key to Passbolt server? Sorry can you clarify this?

You can import the user private key yes, during the setup.
Similarly you can import the server private key during the installation wizard process.

1 Like