-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into master
- Loading branch information
Showing
11 changed files
with
890 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable no-else-return */ | ||
/* eslint-disable no-restricted-syntax */ | ||
const log = require('../lib/log'); | ||
|
||
class IdService { | ||
static loginPhrases = [this.generateLoginPhrase(), this.generateLoginPhrase()]; | ||
|
||
/** | ||
* [generateLoginPhrase] | ||
*/ | ||
static async generateLoginPhrase() { | ||
const timestamp = new Date().getTime(); | ||
const phrase = timestamp + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); | ||
return phrase; | ||
} | ||
|
||
/** | ||
* [getLoginPhrase] | ||
*/ | ||
static async getLoginPhrase() { | ||
return this.loginPhrases[1]; | ||
} | ||
|
||
/** | ||
* [updateLoginPhrase] | ||
*/ | ||
static async updateLoginPhrase() { | ||
this.loginPhrases.push(this.generateLoginPhrase()); | ||
this.loginPhrases.shift(); | ||
} | ||
} | ||
// eslint-disable-next-line func-names | ||
module.exports = IdService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.