diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-20 17:41:28 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-20 17:41:28 -0500 |
| commit | cd83a32052f9579ca0763ed6f1db9b02e0a27ab9 (patch) | |
| tree | f0a7302c63fb1ec9c8dfab5c5674d0331d769e9d /Biz | |
| parent | 39e602dbc81de3c6e5efd8c33c0d037cd1899ead (diff) | |
feat: implement t-1ne80pJ
Amp-Thread-ID: https://ampcode.com/threads/T-0ad36363-7155-4f3f-be83-030581148792
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Biz')
| -rwxr-xr-x | Biz/Dragons.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs index 7ba7fa0..cfe211e 100755 --- a/Biz/Dragons.hs +++ b/Biz/Dragons.hs @@ -742,7 +742,19 @@ startup quiet = do cfg <- Envy.decodeWithDefaults Envy.defConfig oAuthArgs <- Envy.decodeWithDefaults Envy.defConfig kp <- Acid.openLocalStateFrom (keep cfg) init :: IO (Acid.AcidState Keep) - jwk <- Auth.generateKey -- TODO: store this in a file somewhere + let jwkPath = keep cfg </> "jwk.json" + jwkExists <- Directory.doesFileExist jwkPath + jwk <- + if jwkExists + then do + maybeKey <- Aeson.decodeFileStrict jwkPath + case maybeKey of + Nothing -> panic <| "Could not decode JWK from " <> str jwkPath + Just k -> pure k + else do + k <- Auth.generateKey + Aeson.encodeFile jwkPath k + pure k let url = case homeExample cfg of ForgeURL u -> u CLISubmission -> "<CLISubmission>" |
