From faac764c0765aa8d03fec218a02555366291b059 Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Fri, 17 Feb 2023 12:15:58 +0100 Subject: [PATCH] Add src/Internal/Credentials.elm --- src/Internal/Credentials.elm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Internal/Credentials.elm diff --git a/src/Internal/Credentials.elm b/src/Internal/Credentials.elm new file mode 100644 index 0000000..1e107ad --- /dev/null +++ b/src/Internal/Credentials.elm @@ -0,0 +1,32 @@ +module Internal.Credentials exposing (..) +{-| The Credentials type is the keychain that stores all tokens, values, +numbers and other types that need to be remembered. + +This file combines the internal functions with the API endpoints to create a fully functional Credentials keychain. +-} + +import Internal.Values.Credentials as Internal + +{-| +You can consider the `Credentials` type as a large ring of keys, +and Elm will figure out which key to use. +If you pass the `Credentials` into any function, then the library will look for +the right keys and tokens to get the right information. +-} +type alias Credentials = Internal.Credentials + +{-| Get a Credentials type based on an unknown access token. + +This is an easier way to connect to a Matrix homeserver, but your access may end +when the access token expires, is revoked or something else happens. +-} +fromAccessToken : { homeserver : String, accessToken : String } -> Credentials +fromAccessToken = + Internal.fromAccessToken + +{-| Get a Credentials type using a username and password. -} +fromLoginCredentials : { username : String, password : String, homeserver : String } -> Credentials +fromLoginCredentials = + Internal.fromLoginCredentials + +