Beispiel #1
0
    def generate_credentials(self):
        """Create new credentials for authentication.

        Credentials that have been authenticated shall be saved and loaded with
        load_credentials before playing anything. If credentials are lost,
        authentication must be performed again.
        """
        identifier, seed = new_credentials()
        return '{0}:{1}'.format(identifier, seed.decode().upper())
Beispiel #2
0
    def _setup_credentials(self):
        credentials = self.service.credentials

        # If service has credentials, use those. Otherwise generate new.
        if self.service.credentials is None:
            identifier, seed = new_credentials()
            credentials = '{0}:{1}'.format(identifier, seed.decode().upper())
        else:
            split = credentials.split(':')
            identifier = split[0]
            seed = split[1]
        return AuthData(identifier, seed, credentials)
Beispiel #3
0
 def _setup_credentials(self) -> LegacyCredentials:
     # If service has credentials, use those. Otherwise generate new.
     if self.service.credentials is None:
         return new_credentials()
     return LegacyCredentials.parse(self.service.credentials)