Skip to content
This repository was archived by the owner on Dec 11, 2018. It is now read-only.

Repository files navigation

elm-crypto

Web Cryptography API for Elm.

It wraps RandomSource.getRandomValues API to generator cryptographically secure pseudorandom number in Elm.

Usage

Random generation function return a Task. Depending on your use case, you might want to convert the task to an Cmd or otherwise use it.

update : Msg -> Model -> (Model, Cmd Msg)
update action model =
  case action of
    Toss ->
      let
        resultToCmd : Result Crypto.Error Bool -> Msg
        resultToCmd result = case result of
          Ok boolean -> Catch boolean
          Err error -> Failed error

        cmd = Task.attempt resultToCmd Crypto.bool
      in (model, cmd)
    Catch coin -> ({ model | coin = Just coin }, Cmd.none)
Build Status
Build Status
References


elm-crypto is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0). See COPYRIGHT for details.

About

Web Cryptography API for Elm

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages