-
Notifications
You must be signed in to change notification settings - Fork 335
Add option for MLS private keys #2602
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f71c8ee
Add mls secrets to galley chart and settings
pcapriotti 64de626
Store MLS private keys in a map
pcapriotti a56d150
Document mlsPrivateKeyPaths setting
pcapriotti 234be78
Add functions to load private keys in x509 format
pcapriotti d785702
Use x509 private keys
pcapriotti 0e2e402
Do not use a map to store key pairs
pcapriotti 9380907
Expose MLS public keys in an endpoint
pcapriotti c285a98
Add CHANGELOG entries
pcapriotti 06765f8
Add testing private key to CI config
smatting be2ec39
Add mls secret to galley integration
smatting dc3f223
Add purpose to MLS private keys
pcapriotti b168a5c
Cannot use paths as secret keys in helm charts
pcapriotti a1755c9
Add purpose to mlsPrivateKeyPaths in galley chart
pcapriotti edc5da1
Fix yaml formatting of test private key
pcapriotti 3992b94
Add purpose to docs
pcapriotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Expose MLS public keys in a new endpoint `GET /mls/public-keys`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add mlsPrivateKeyPaths setting to galley |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: galley-mls | ||
| labels: | ||
| app: galley | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| type: Opaque | ||
| data: | ||
| {{- if .Values.secrets.mlsPrivateKeys.removal.ed25519 }} | ||
| removal_ed25519.pem: {{ .Values.secrets.mlsPrivateKeys.removal.ed25519 | b64enc | quote }} | ||
| {{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,4 +92,4 @@ serviceAccount: | |
| annotations: {} | ||
| automountServiceAccountToken: true | ||
|
|
||
| secrets: {} | ||
| secrets: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| -----BEGIN PRIVATE KEY----- | ||
| MC4CAQAwBQYDK2VwBCIEIAocCDXsKIAjb65gOUn5vEF0RIKnVJkKR4ebQzuZ709c | ||
| -----END PRIVATE KEY----- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | ||
|
|
||
| -- This file is part of the Wire Server implementation. | ||
| -- | ||
| -- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com> | ||
| -- | ||
| -- This program is free software: you can redistribute it and/or modify it under | ||
| -- the terms of the GNU Affero General Public License as published by the Free | ||
| -- Software Foundation, either version 3 of the License, or (at your option) any | ||
| -- later version. | ||
| -- | ||
| -- This program is distributed in the hope that it will be useful, but WITHOUT | ||
| -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| -- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
| -- details. | ||
| -- | ||
| -- You should have received a copy of the GNU Affero General Public License along | ||
| -- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| module Wire.API.MLS.Keys | ||
| ( MLSKeys (..), | ||
| MLSPublicKeys (..), | ||
| mlsKeysToPublic, | ||
| ) | ||
| where | ||
|
|
||
| import Crypto.PubKey.Ed25519 | ||
| import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
| import Data.ByteArray | ||
| import Data.Json.Util | ||
| import qualified Data.Map as Map | ||
| import Data.Schema | ||
| import qualified Data.Swagger as S | ||
| import Imports | ||
| import Wire.API.MLS.Credential | ||
|
|
||
| data MLSKeys = MLSKeys | ||
| { mlsKeyPair_ed25519 :: Maybe (SecretKey, PublicKey) | ||
| } | ||
|
|
||
| instance Semigroup MLSKeys where | ||
| MLSKeys Nothing <> MLSKeys ed2 = MLSKeys ed2 | ||
| MLSKeys ed1 <> MLSKeys _ = MLSKeys ed1 | ||
|
|
||
| instance Monoid MLSKeys where | ||
| mempty = MLSKeys Nothing | ||
|
|
||
| newtype MLSPublicKeys = MLSPublicKeys | ||
| { unMLSPublicKeys :: Map SignaturePurpose (Map SignatureSchemeTag ByteString) | ||
| } | ||
| deriving (FromJSON, ToJSON, S.ToSchema) via Schema MLSPublicKeys | ||
| deriving newtype (Semigroup, Monoid) | ||
|
|
||
| instance ToSchema MLSPublicKeys where | ||
| schema = | ||
| named "MLSKeys" $ | ||
| MLSPublicKeys <$> unMLSPublicKeys | ||
| .= map_ (map_ base64Schema) | ||
|
|
||
| mlsKeysToPublic1 :: MLSKeys -> Map SignatureSchemeTag ByteString | ||
| mlsKeysToPublic1 (MLSKeys mEd25519key) = | ||
| fold $ Map.singleton Ed25519 . convert . snd <$> mEd25519key | ||
|
|
||
| mlsKeysToPublic :: (SignaturePurpose -> MLSKeys) -> MLSPublicKeys | ||
| mlsKeysToPublic f = flip foldMap [minBound .. maxBound] $ \purpose -> | ||
| MLSPublicKeys (Map.singleton purpose (mlsKeysToPublic1 (f purpose))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.