nevermined_sdk_py.nevermined.auth module¶
-
class
nevermined_sdk_py.nevermined.auth.
Auth
(keeper, storage_path)¶ Bases:
object
Nevermined auth class. Provide basic management of a user auth token. This token can be used to emulate sign-in behaviour. The token can be stored and associated with an expiry time. This is useful in front-end applications that interact with a 3rd-party wallet apps. The advantage of using the auth token is to reduce the number of confirmation prompts requiring user action.
The auth token works with a provider service such as Gateway which also uses this ocean module to handle auth tokens.
Token format is “signature-timestamp”.
-
DEFAULT_EXPIRATION_TIME
= 2592000¶
-
DEFAULT_MESSAGE
= 'Nevermined Protocol Authentication'¶
-
check
(token)¶ - Parameters
token – hex str consist of signature and timestamp
- Returns
hex str ethereum address
-
get
(account)¶ - Parameters
account – Account instance signing the token
- Returns
hex str the token generated/signed by account
-
is_stored
(account)¶ - Parameters
account – Account instance
- Returns
bool whether this account has a stored token
-
static
is_token_valid
(token)¶
-
restore
(account)¶ - Parameters
account – Account instance to fetch the saved token
- Returns
hex str the token retreived from storage None if no token found for this account
-
store
(account)¶ - Parameters
account – Account instance signing the token
- Returns
token that was generated and stored for this account
-