A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch back to my own crypto libraries

+78 -25
+2 -2
elm.json
··· 29 29 "elm-community/list-extra": "8.1.0", 30 30 "elm-community/maybe-extra": "5.0.0", 31 31 "elm-explorations/markdown": "1.0.0", 32 + "icidasset/elm-binary": "2.1.0", 33 + "icidasset/elm-sha": "2.0.1", 32 34 "justgage/tachyons-elm": "4.1.3", 33 - "ktonon/elm-crypto": "1.1.2", 34 - "ktonon/elm-word": "2.1.2", 35 35 "mpizenberg/elm-pointer-events": "4.0.0", 36 36 "noahzgordon/elm-color-extra": "1.0.2", 37 37 "rtfeldman/elm-css": "16.0.0",
+13 -3
src/Applications/UI/Authentication.elm
··· 3 3 import Alien 4 4 import Authentication exposing (Method(..)) 5 5 import Base64 6 + import Binary 6 7 import Chunky exposing (..) 7 8 import Classes as C 8 9 import Color exposing (Color) 9 10 import Color.Ext as Color 10 11 import Common exposing (Switch(..)) 11 12 import Conditional exposing (..) 12 - import Crypto.Hash 13 13 import Css exposing (pct, px, solid, transparent) 14 14 import Html.Events.Extra.Mouse as Mouse 15 15 import Html.Styled as Html exposing (Html, a, button, em, fromUnstyled, img, span, text) ··· 19 19 import Material.Icons.Av as Icons 20 20 import Material.Icons.Navigation as Icons 21 21 import Return3 as Return exposing (..) 22 + import SHA 22 23 import Svg exposing (Svg) 23 24 import Tachyons.Classes as T 24 25 import UI.Kit ··· 185 186 ( Unauthenticated 186 187 -- 187 188 , [ ( "method", Authentication.encodeMethod method ) 188 - , ( "passphrase", Json.Encode.string <| Crypto.Hash.sha256 passphrase ) 189 + , ( "passphrase", Json.Encode.string <| hashPassphrase passphrase ) 189 190 ] 190 191 |> Json.Encode.object 191 192 |> Alien.broadcast Alien.SignIn ··· 227 228 returnCommandWithModel 228 229 (Authenticated method) 229 230 (passphrase 230 - |> Crypto.Hash.sha256 231 + |> hashPassphrase 231 232 |> Json.Encode.string 232 233 |> Alien.broadcast Alien.UpdateEncryptionKey 233 234 |> Ports.toBrain ··· 261 262 262 263 _ -> 263 264 return model 265 + 266 + 267 + hashPassphrase : String -> String 268 + hashPassphrase phrase = 269 + phrase 270 + |> Binary.fromStringAsUtf8 271 + |> SHA.sha256 272 + |> Binary.toHex 273 + |> String.toLower 264 274 265 275 266 276
+9 -2
src/Applications/UI/Sources/Form.elm
··· 81 81 update msg model = 82 82 case msg of 83 83 AddSource -> 84 + let 85 + context = 86 + model.context 87 + 88 + cleanContext = 89 + { context | data = Dict.map (always String.trim) context.data } 90 + in 84 91 returnRepliesWithModel 85 92 { model | step = Where, context = defaultContext } 86 93 [ Reply.GoToPage (Page.Sources Sources.Index) 87 - , Reply.AddSourceToCollection model.context 94 + , Reply.AddSourceToCollection cleanContext 88 95 ] 89 96 90 97 Bypass -> ··· 126 133 model.context 127 134 128 135 updatedData = 129 - Dict.insert key (String.trim value) context.data 136 + Dict.insert key value context.data 130 137 131 138 newContext = 132 139 { context | data = updatedData }
+28 -2
src/Library/Cryptography/Hmac.elm
··· 85 85 |> hash 86 86 87 87 88 + 89 + -- PADDING 90 + 91 + 88 92 padding : Int -> ( Bits, Bits ) 89 93 padding blockSize = 90 - ( Binary.concat (List.repeat blockSize <| Binary.fromHex "36") 91 - , Binary.concat (List.repeat blockSize <| Binary.fromHex "5C") 94 + case blockSize of 95 + 64 -> 96 + padding64 97 + 98 + 128 -> 99 + padding128 100 + 101 + _ -> 102 + ( Binary.concat (List.repeat blockSize <| Binary.fromHex "36") 103 + , Binary.concat (List.repeat blockSize <| Binary.fromHex "5C") 104 + ) 105 + 106 + 107 + padding64 : ( Bits, Bits ) 108 + padding64 = 109 + ( Binary.concat (List.repeat 64 <| Binary.fromHex "36") 110 + , Binary.concat (List.repeat 64 <| Binary.fromHex "5C") 111 + ) 112 + 113 + 114 + padding128 : ( Bits, Bits ) 115 + padding128 = 116 + ( Binary.concat (List.repeat 128 <| Binary.fromHex "36") 117 + , Binary.concat (List.repeat 128 <| Binary.fromHex "5C") 92 118 )
+12 -4
src/Library/Sources/Services/AmazonS3/Parser.elm
··· 23 23 24 24 filePathsDecoder : Decoder (List String) 25 25 filePathsDecoder = 26 - path [ "Contents" ] (list <| path [ "Key" ] (single string)) 26 + string 27 + |> single 28 + |> path [ "Key" ] 29 + |> list 30 + |> path [ "Contents" ] 27 31 28 32 29 33 markerDecoder : Decoder Marker ··· 40 44 b 41 45 ) 42 46 ) 43 - (maybe <| path [ "IsTruncated" ] (single string)) 44 - (maybe <| path [ "NextContinuationToken" ] (single string)) 47 + (maybe <| path [ "IsTruncated" ] <| single string) 48 + (maybe <| path [ "NextContinuationToken" ] <| single string) 45 49 46 50 47 51 ··· 59 63 60 64 errorMessagesDecoder : Decoder (List String) 61 65 errorMessagesDecoder = 62 - path [ "Error" ] (list <| path [ "Message" ] (single string)) 66 + string 67 + |> single 68 + |> path [ "Message" ] 69 + |> list 70 + |> path [ "Error" ]
+14 -12
src/Library/Sources/Services/AmazonS3/Presign.elm
··· 1 1 module Sources.Services.AmazonS3.Presign exposing (presignedUrl) 2 2 3 - import Crypto.HMAC 4 - import Crypto.Hash 3 + import Binary exposing (Bits) 4 + import Cryptography.HMAC as HMAC 5 5 import DateFormat as Date 6 6 import Dict 7 7 import Dict.Ext as Dict 8 8 import Hex 9 9 import Maybe.Extra as Maybe 10 10 import Regex 11 + import SHA 11 12 import Sources exposing (SourceData) 12 13 import Sources.Processing exposing (HttpMethod, httpMethod) 13 14 import String.Ext as String 14 15 import Time 15 16 import Url 16 17 import Url.Builder as Url 17 - import Word.Bytes as Bytes 18 - import Word.Hex as Hex 19 18 20 19 21 20 ··· 154 153 , String.join "/" [ date, region, "s3", "aws4_request" ] 155 154 156 155 -- 157 - , Crypto.Hash.sha256 request 156 + , request 157 + |> Binary.fromStringAsUtf8 158 + |> SHA.sha256 159 + |> Binary.toHex 160 + |> String.toLower 158 161 ] 159 162 160 163 -- Signature 161 164 signature = 162 165 ("AWS4" ++ Dict.fetchUnknown "secretKey" aws) 163 - |> Bytes.fromUTF8 166 + |> Binary.fromStringAsUtf8 164 167 |> hmacSha256 date 165 168 |> hmacSha256 region 166 169 |> hmacSha256 "s3" 167 170 |> hmacSha256 "aws4_request" 168 171 |> hmacSha256 stringToSign 169 - |> Hex.fromByteList 172 + |> Binary.toHex 173 + |> String.toLower 170 174 in 171 175 String.concat 172 176 [ protocol ··· 196 200 query 197 201 198 202 199 - hmacSha256 : String -> List Int -> List Int 200 - hmacSha256 message key = 201 - Crypto.HMAC.digestBytes Crypto.HMAC.sha256 202 - key 203 - (Bytes.fromUTF8 message) 203 + hmacSha256 : String -> Bits -> Bits 204 + hmacSha256 = 205 + HMAC.encrypt64 SHA.sha256