Skip to content

prepwork for EKM integration during setup #385

@tomholub

Description

@tomholub

this is a subset of #279 and a part of #275

EKM = Email Key Manager https://flowcrypt.com/docs/technical/enterprise/email-deployment-overview.html

OrgRule definitions https://flowcrypt.com/docs/business/org-rules.html

As a part of #275 and after #276 and #277 , immediately after authentication when we receive the OIDC and OrgRules, we should check if orgRules.usesKeyManager() == true.

  • if not, skip following steps (and instead show regular setup flow)

  • if yes, follow the flow below

  • 1) check if orgRules.mustAutoImportOrAutogenPrvWithKeyManager() == true and if not, show an error that this combination of rules (key_manager_url set but PRV_AUTOIMPORT_OR_AUTOGEN is missing) is not supported on this platform

  • 2) check if orgRules.mustAutogenPassPhraseQuietly() == false. If not, show an error that this combination of OrgRules (PRV_AUTOIMPORT_OR_AUTOGEN + PASS_PHRASE_QUIET_AUTOGEN) is not supported on this platform

  • 3) check if orgRules.forbidStoringPassPhrase() == true. If not, show an error that this combination of OrgRules (PRV_AUTOIMPORT_OR_AUTOGEN + missing FORBID_STORING_PASS_PHRASE) is not supported on this platform.

  • 4) check if orgRules.mustSubmitToAttester() == false. If not, show an error that this combination of OrgRules (PRV_AUTOIMPORT_OR_AUTOGEN + ENFORCE_ATTESTER_SUBMIT) is not supported on this platform.

  • 5) check if orgRules.forbidCreatingPrivateKey() == true. If not, show an error that this combination of OrgRules (PRV_AUTOIMPORT_OR_AUTOGEN + missing NO_PRV_CREATE) is not supported on this platform.

  • 6) get the EKM URL from key_manager_url OrgRule (already includes https://, but may or may not include a trailing slash

  • 7) please normalize the URL to contain a trailing slash before you use the URL

  • 8) call GET <ekm>/v1/keys/private. Into authorization header please put Bearer <ID_TOKEN>. On error, offer retry

Now this last step that follows differs from #279 to allow a smaller PR at first:

  • 9) show a toast that says ignoring <n> keys returned by EKM <url> (not implemented), then proceed to regular setup flow as before

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions