Skip to content
This repository has been archived by the owner on Dec 11, 2018. It is now read-only.
/ elm-crypto Public archive

Web Cryptography API for Elm

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

libreirc/elm-crypto

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

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published