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

Commit bb61597

Browse files
committed
Rename module: Random.Secure -> Crypto
Closes #7
1 parent 049fa74 commit bb61597

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

elm-package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"src"
88
],
99
"exposed-modules": [
10-
"Random.Secure"
10+
"Crypto"
1111
],
1212
"native-modules": true,
1313
"dependencies": {

example/CoinFlip.elm

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Task exposing (Task)
55
import Html exposing (..)
66
import Html.Events exposing (..)
77

8-
import Random.Secure as Crypto
8+
import Crypto
99

1010
type alias Model =
1111
{

src/Random/Secure.elm renamed to src/Crypto.elm

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Random.Secure exposing (Error(..), int, ints, bool, bools, float, floats)
1+
module Crypto exposing (Error(..), int, ints, bool, bools, float, floats)
22

33
{-| A library for generating cryptographically random values.
44
@@ -28,7 +28,7 @@ implementation.
2828
2929
-}
3030

31-
import Native.SecureRandom
31+
import Native.Crypto
3232
import Task exposing (Task)
3333

3434
{-| A type which represents an error.
@@ -56,7 +56,7 @@ Moreover, the quality of the produced output is dependent on
5656
-}
5757
int : Int -> Int -> Task Error Int
5858
int from to =
59-
Native.SecureRandom.getRandomInt ()
59+
Native.Crypto.getRandomInt ()
6060
|> Task.map (compressInt from to)
6161

6262
{-| Generate a list of random 32-bit integers in a given range.
@@ -66,7 +66,7 @@ int from to =
6666
ints : Int -> Int -> Int -> Task Error (List Int)
6767
ints from to n =
6868
-- TODO: Cause invalid argument error when the parametes doesn't make sense.
69-
Native.SecureRandom.getRandomInts (min 0 n)
69+
Native.Crypto.getRandomInts (min 0 n)
7070
|> Task.map (List.map (compressInt from to))
7171

7272
{-| Generate a random boolean value.
@@ -78,14 +78,14 @@ ints from to n =
7878
-}
7979
bool : Task Error Bool
8080
bool =
81-
Native.SecureRandom.getRandomInt ()
81+
Native.Crypto.getRandomInt ()
8282
|> Task.map (\x -> x % 2 == 0)
8383

8484
{-| Generate a list of random boolean values.
8585
-}
8686
bools : Int -> Task Error (List Bool)
8787
bools n =
88-
Native.SecureRandom.getRandomInts (min 0 n)
88+
Native.Crypto.getRandomInts (min 0 n)
8989
|> Task.map (List.map (\x -> x % 2 == 0))
9090

9191
{-| Generate a random floating point number in a given range.
@@ -94,7 +94,7 @@ bools n =
9494
-}
9595
float : Float -> Float -> Task Error Float
9696
float from to =
97-
Native.SecureRandom.getRandomInt ()
97+
Native.Crypto.getRandomInt ()
9898
|> Task.map (compressFloat from to)
9999

100100
{-| Generate a list of random floating point numbers in a given range.
@@ -103,7 +103,7 @@ float from to =
103103
-}
104104
floats : Float -> Float -> Int -> Task Error (List Float)
105105
floats from to n =
106-
Native.SecureRandom.getRandomInts (min 0 n)
106+
Native.Crypto.getRandomInts (min 0 n)
107107
|> Task.map (List.map (compressFloat from to))
108108

109109
compressInt : Int -> Int -> Int -> Int

src/Native/SecureRandom.js renamed to src/Native/Crypto.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _libreirc$elm_crypto$Native_SecureRandom = function() {
1+
var _libreirc$elm_crypto$Native_Crypto = function() {
22
'use strict';
33

44

@@ -10,7 +10,7 @@ function fallback() {
1010
return _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
1111
callback(
1212
_elm_lang$core$Native_Scheduler.fail(
13-
_libreirc$elm_crypto$Random_Secure$NoGetRandomValues
13+
_libreirc$elm_crypto$Crypto$NoGetRandomValues
1414
)
1515
);
1616
});
@@ -51,7 +51,7 @@ function makeFn(retrieve) {
5151

5252
callback(
5353
_elm_lang$core$Native_Scheduler.fail(
54-
A2(_libreirc$elm_crypto$Random_Secure$Exception, errorName, errorMessage)
54+
A2(_libreirc$elm_crypto$Crypto$Exception, errorName, errorMessage)
5555
)
5656
);
5757
return;

0 commit comments

Comments
 (0)