Shield by Openfort is a secure service dedicated to the protection of sensitive data. It ensures the confidentiality and security of data management by offering a robust framework for storing secrets and encryption parameters.
A share is a crucial part of a user's private key. Shares can be stored in different ways based on their entropy:
- Plain (Entropy: None): The share is stored directly without encryption.
- Encrypted by User (Entropy: User): The share is externaly encrypted and its parameters can be stored:
- Salt: A string used to introduce randomness into the encryption process.
- Iterations: The number of iterations used in the encryption algorithm.
- Length: The length of the resulting encrypted data.
- Digest: The hashing algorithm used (e.g., SHA-256).
- Encrypted by Project (Entropy: Project): The share is encrypted using a project-wide encryption key. This key is split into two parts:
- Part 1: Stored securely in the database.
- Part 2 (Encryption Part): Provided to the client via the API when a project is created or when the endpoint to generate it is called.
A project serves as a container for a group of users and its shares and authentication methods. Projects are identified by an API Key and secured by an API Secret. The project handles encryption in a consistent manner for all its shares:
- Project Encryption Key: Projects can generate an encryption key in two ways:
- During Creation: Using the
GenerateEncryptionKeyfield in theCreateProjectrequest. - After Creation: By calling the
/project/encryption-keyendpoint. This endpoint not only generates an encryption key but also encrypts all stored shares with "None" entropy.
- During Creation: Using the
Project Entropy: When a project encrypts shares, the following happens:
- A random encryption key is generated and split into two parts:
- Part 1: Stored in the database.
- Part 2 (Encryption Part): Provided through the API and required for any operation involving the share (except deletion).
Providing the Encryption Part: There are two ways to provide this encryption part when interacting with shares:
- Direct Provision:
- Register/Update Share: Include the
encryption_partfield in the request body. - Get Share: Use the
X-Encryption-Partheader.
- Using an Encryption Session:
- Session Creation: Call the
/project/encryption-sessionendpoint with theencryption_partto create a session. This session is one-time use and returns asession_id. - Register/Update Share: Use the
encryption_sessionfield in the request body. - Get Share: Use the
X-Encryption-Sessionheader.
Users are automatically associated with a project based on the provided API key. To authenticate users (using access tokens), the project must register a provider. There are two types of providers:
- Openfort Provider:
- The project integrates with Openfort to validate user credentials.
- When using this provider:
- Specify
X-Auth-Provider: openfortin the request. - If Openfort authentication is using Third Party provide
X-Openfort-ProviderandX-Openfort-Token-Typeheaders for user authentication details.
- Specify
- Custom Provider:
- The project provides OIDC-compatible information, such as a JWK URL or a PEM certificate and key type.
- When using this provider:
- Specify
X-Auth-Provider: customin the request.
- Specify
Important Notes:
- The
X-Auth-Providerheader is mandatory for the Shares API to specify which authentication method is being used. - For Openfort,
X-Openfort-ProviderandX-Openfort-Token-Typeare required headers to detail the specific authentication context.
-
Endpoint:
POST /shares -
Request:
- Type:
RegisterShareRequest- Mandatory header
Authorizationwith access token andX-API-Keywith project's api key - Mandatory header
X-Auth-Providerand optionalX-Openfort-ProviderandX-Openfort-Token-Typefor user authentication - Optional headers
X-Encryption-PartandX-Encryption-Sessionto specify encryption details.
- Mandatory header
- Example:
{ "secret": "some_secret_value", "entropy": "user", "salt": "some_salt_value", "iterations": 1000, "length": 256, "digest": "sha256", "encryption_part": "part_value", "encryption_session": "session_value" }
- Type:
-
Response:
- Success: HTTP
201 Createdwith no body content. - Failure:
400 Bad Requestif the request body is invalid.500 Internal Server Errorfor any server-side issues.
- Success: HTTP
-
How it Works:
- The client sends a
RegisterShareRequestJSON payload. - The handler reads and validates the request data.
- If valid, the handler registers the share using the
ShareApplicationservice and returns201 Created. This endpoint can also be called with API Key, API Secret, and an extra headerX-User-IDto register a share in name of a user.
- The client sends a
-
Endpoint:
PUT /shares -
Request:
- Mandatory header
Authorizationwith access token andX-API-Keywith project's api key - Mandatory header
X-Auth-Providerand optionalX-Openfort-ProviderandX-Openfort-Token-Typefor user authentication - Optional headers
X-Encryption-PartandX-Encryption-Sessionto specify encryption details. - Type:
UpdateShareRequest - Example:
{ "secret": "updated_secret_value", "entropy": "project", "salt": "updated_salt_value", "iterations": 2000, "length": 512, "digest": "sha512", "encryption_part": "updated_part_value", "encryption_session": "updated_session_value" }
- Mandatory header
-
Response:
- Type:
UpdateShareResponse - Example:
{ "secret": "updated_secret_value", "entropy": "project", "salt": "updated_salt_value", "iterations": 2000, "length": 512, "digest": "sha512", "encryption_part": "updated_part_value", "encryption_session": "updated_session_value" } - Success: HTTP
200 OKwith the updated share details. - Failure:
400 Bad Requestif the request body is invalid.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends an
UpdateShareRequestJSON payload. - The handler updates the share using the provided data.
- Upon successful update, the handler returns the updated share details.
- The client sends an
-
Endpoint:
DELETE /shares -
Request:
- No request body required.
- Mandatory header
Authorizationwith access token andX-API-Keywith project's api key - Mandatory header
X-Auth-Providerand optionalX-Openfort-ProviderandX-Openfort-Token-Typefor user authentication - Optional headers
X-Encryption-PartandX-Encryption-Sessionto specify encryption details.
-
Response:
- Success: HTTP
204 No Contentindicating the share was successfully deleted. - Failure:
404 Not Foundif the share does not exist.500 Internal Server Errorfor any server-side issues.
- Success: HTTP
-
How it Works:
- The client sends a request to delete the share.
- The handler calls the
ShareApplicationservice to delete the share. - If the deletion is successful, it returns
204 No Content.
-
Endpoint:
GET /shares -
Request:
- No request body required.
- Mandatory header
Authorizationwith access token andX-API-Keywith project's api key - Mandatory header
X-Auth-Providerand optionalX-Openfort-ProviderandX-Openfort-Token-Typefor user authentication - Optional headers
X-Encryption-PartandX-Encryption-Sessionto specify encryption details.
-
Response:
- Type:
GetShareResponse - Example:
{ "secret": "some_secret_value", "entropy": "user", "salt": "some_salt_value", "iterations": 1000, "length": 256, "digest": "sha256", "encryption_part": "part_value", "encryption_session": "session_value" } - Success: HTTP
200 OKwith the share details. - Failure:
404 Not Foundif the share is not found.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a request to retrieve share details.
- The handler fetches and returns the share details in the response.
-
Endpoint:
POST /register -
Request:
- Type:
CreateProjectRequest - Example:
{ "name": "My Project", "generate_encryption_key": true }
- Type:
-
Response:
- Type:
CreateProjectResponse - Example:
{ "id": "project_id", "name": "My Project", "api_key": "generated_api_key", "api_secret": "generated_api_secret", "encryption_part": "generated_encryption_part" } - Success: HTTP
201 Createdwith the project details. - Failure:
400 Bad Requestif the request body is invalid.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a
CreateProjectRequestJSON payload. - The handler processes the request to create a new project.
- The project details, including API keys and optionally an encryption part, are returned in the response.
- The client sends a
-
Endpoint:
GET /project -
Request:
- No request body required.
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret
-
Response:
- Type:
GetProjectResponse - Example:
{ "id": "project_id", "name": "My Project" } - Success: HTTP
200 OKwith the project details. - Failure:
404 Not Foundif the project is not found.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a request to retrieve the project details.
- The handler fetches and returns the project information in the response.
-
Endpoint:
POST /project/providers -
Request:
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret - Type:
AddProvidersRequest - Example:
{ "providers": { "openfort": { "publishable_key": "openfort_publishable_key" }, "custom": { "jwk": "custom_jwk", "pem": "custom_pem", "key_type": "rsa" } } }
- Mandatory headers
-
Response:
- Type:
AddProvidersResponse - Example:
{ "providers": [ { "provider_id": "openfort_provider_id", "type": "openfort" }, { "provider_id": "custom_provider_id", "type": "custom" } ] } - Success: HTTP
200 OKwith the list of added providers. - Failure:
400 Bad Requestif the request body is invalid.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends an
AddProvidersRequestJSON payload. - The handler processes the request to add providers to the project.
- The response includes details of the added providers.
- The client sends an
-
Endpoint:
GET /project/providers -
Request:
- No request body required.
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret
-
Response:
- Type:
GetProvidersResponse - Example:
{ "providers": [ { "provider_id": "openfort_provider_id", "type": "openfort" }, { "provider_id": "custom_provider_id", "type": "custom" } ] } - Success: HTTP
200 OKwith the list of providers. - Failure:
500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a request to retrieve all providers associated with the project.
- The handler fetches and returns the list of providers in the response.
-
Endpoint:
GET /project/providers/{provider} -
Request:
- No request body required.
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret
-
Response:
- Type:
GetProviderResponse - Example:
{ "provider_id": "custom_provider_id", "type": "custom", "jwk": "custom_jwk", "pem": "custom_pem", "key_type": "rsa" } - Success: HTTP
200 OKwith the provider details. - Failure:
404 Not Foundif the provider is not found.500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a request to retrieve details of a specific provider by its ID.
- The handler fetches and returns the provider details.
-
Endpoint:
PUT /project/providers/{provider} -
Request:
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret - Type:
UpdateProviderRequest - Example:
{ "publishable_key": "new_publishable_key", "jwk": "new_jwk", "pem": "new_pem", "key_type": "ecdsa" }
- Mandatory headers
-
Response:
- Success: HTTP
200 OKindicating the provider was updated successfully. - Failure:
400 Bad Requestif the request body is invalid.500 Internal Server Errorfor any server-side issues.
- Success: HTTP
-
How it Works:
- The client sends an
UpdateProviderRequestJSON payload with updated details for the provider. - The handler processes the request to update the provider’s configuration.
- If successful, the handler returns a
200 OK.
- The client sends an
-
Endpoint:
DELETE /project/providers/{provider} -
Request:
- No request body required.
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret
-
Response:
- Success: HTTP
200 OKindicating the provider was successfully deleted. - Failure:
404 Not Foundif the provider does not exist.500 Internal Server Errorfor any server-side issues.
- Success: HTTP
-
How it Works:
- The client sends a request to delete a provider by its ID.
- The handler calls the
ProjectApplicationservice to remove the provider from the project. - Upon successful deletion, it returns
200 OK.
-
Endpoint:
POST /project/encrypt -
Request:
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret - Type:
EncryptBodyRequest - Example:
{ "encryption_part": "encryption_part_value" }
- Mandatory headers
-
Response:
- Success: HTTP
200 OKindicating the shares were successfully encrypted. - Failure:
500 Internal Server Errorfor any server-side issues.
- Success: HTTP
-
How it Works:
- The client sends an
EncryptBodyRequestJSON payload to encrypt all project shares. - The handler processes the request and returns
200 OKif encryption is successful.
- The client sends an
-
Endpoint:
POST /project/encryption-session -
Request:
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret - Type:
RegisterEncryptionSessionRequest - Example:
{ "encryption_part": "encryption_part_value" }
- Mandatory headers
-
Response:
- Type:
RegisterEncryptionSessionResponse - Example:
{ "session_id": "generated_session_id" } - Success: HTTP
200 OKwith the session ID. - Failure:
500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a
RegisterEncryptionSessionRequestJSON payload to register a session. - The handler processes the request and returns the generated session ID.
- The client sends a
-
Endpoint:
POST /project/encryption-key -
Request:
- No request body required.
- Mandatory headers
X-API-Keywith project's api key andX-API-Secretwith project's api secret
-
Response:
- Type:
RegisterEncryptionKeyResponse - Example:
{ "encryption_part": "generated_encryption_part" } - Success: HTTP
200 OKwith the registered encryption part. - Failure:
500 Internal Server Errorfor any server-side issues.
- Type:
-
How it Works:
- The client sends a request to register a new encryption key for the project.
- The handler processes the request and returns the generated encryption part.
