From fc6cf6169868e60c189e4b243330c3717ff159f3 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 26 May 2022 13:58:07 +0200 Subject: ... --- hosts/surtr/email/spm/provision/Spm/Provision.hs | 46 ------------------------ 1 file changed, 46 deletions(-) delete mode 100644 hosts/surtr/email/spm/provision/Spm/Provision.hs (limited to 'hosts/surtr/email/spm/provision') diff --git a/hosts/surtr/email/spm/provision/Spm/Provision.hs b/hosts/surtr/email/spm/provision/Spm/Provision.hs deleted file mode 100644 index ff18baa0..00000000 --- a/hosts/surtr/email/spm/provision/Spm/Provision.hs +++ /dev/null @@ -1,46 +0,0 @@ -module Spm.Provision - ( main - ) where - -import Prelude -import Options.Applicative -import Control.Monad - -import qualified Data.Text.IO as Text - -import qualified Data.UUID as UUID -import qualified Data.UUID.V4 as UUID - -import Crypto.JOSE.JWK - -import qualified Data.ByteString.Lazy.Char8 as CLBS -import qualified Data.Aeson as JSON - -import Control.Lens - - -data Command - = InstanceId - | JwkSet - deriving stock (Eq, Ord, Read, Show) - -cmdInstanceId :: IO () -cmdInstanceId = Text.putStrLn . UUID.toText =<< UUID.nextRandom - -cmdJwkSet :: IO () -cmdJwkSet = do - k' <- genJWK (OKPGenParam Ed25519) - kid <- UUID.nextRandom - let k = k' & jwkKid ?~ UUID.toText kid - & jwkUse ?~ Sig - & jwkKeyOps ?~ [Sign, Verify] - CLBS.putStrLn . JSON.encode . JWKSet $ pure k - -opts :: Parser (IO ()) -opts = subparser $ - command "instance-id" (info (pure cmdInstanceId) idm) - <> command "jwk-set" (info (pure cmdJwkSet) idm) - - -main :: IO () -main = join $ execParser (info opts idm) -- cgit v1.2.3