Skip to content

Commit

Permalink
Add app delegate command (#606)
Browse files Browse the repository at this point in the history
* Add app delegate command stub

* Add app registration check

* Add lifetime in seconds option

* Read key and UCAN from environment

* Add DID ParseError

* Add UCAN ParseError

* Add proof token check

* Add an error when delegating without UCAN env var

* Add an error when delegating without machine key

Both machine key and UCAN must be set to delegate using
environment variables.

* Print delegated UCAN on success

* Separate user config and env var proof checks

The check from user config might be a root credential, but the
environment variable will not. The user config check may get an index of
apps from the server.

* Check user config UCAN for capability

* Add check for remote option

Check for the remote to support staging, localhost, and other
remotes.

* Add quiet flag

Command only outputs the UCAN with this flag. Quiet mode makes it easier
to use UCANs in a non-interactive use cases.

* Add potency option

Potency can be AppendOnly, Destroy, or Super_User. Defaults to
AppendOnly.

* Change AppendOnly to Append in help and errors
  • Loading branch information
bgins authored Jul 11, 2022
1 parent 6b78568 commit afaae0d
Show file tree
Hide file tree
Showing 13 changed files with 611 additions and 36 deletions.
4 changes: 4 additions & 0 deletions fission-cli/library/Fission/CLI/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import qualified Fission.CLI.Handler as Handler
import Fission.CLI.Handler.Error.Types (Errs)

import Fission.CLI.Parser.Command.App as App
import qualified Fission.CLI.Parser.Command.App.Delegate as App.Delegate
import qualified Fission.CLI.Parser.Command.App.Info as App.Info
import Fission.CLI.Parser.Command.App.Init as App.Init
import Fission.CLI.Parser.Command.App.Up.Types as App.Up
Expand All @@ -38,6 +39,9 @@ interpret baseCfg cmd = do
logDebug @Text "App interpreter"

case cmd of
Delegate App.Delegate.Options {appName, potency, audienceDid, lifetimeInSeconds, quiet} ->
Handler.delegate appName potency audienceDid lifetimeInSeconds quiet

Info App.Info.CommandOnly ->
Handler.appInfo

Expand Down
5 changes: 4 additions & 1 deletion fission-cli/library/Fission/CLI/Handler.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Fission.CLI.Handler
( module Fission.CLI.Handler.App.Info
( module Fission.CLI.Handler.App.Delegate
, module Fission.CLI.Handler.App.Info
, module Fission.CLI.Handler.App.Init
, module Fission.CLI.Handler.App.Publish
--
Expand All @@ -10,6 +11,8 @@ module Fission.CLI.Handler
, module Fission.CLI.Handler.User.Whoami
) where

import Fission.CLI.Handler.App.Delegate

import Fission.CLI.Handler.App.Info
import Fission.CLI.Handler.App.Init
import Fission.CLI.Handler.App.Publish
Expand Down
Loading

0 comments on commit afaae0d

Please sign in to comment.