mybase 1.1.43 → 1.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -49,7 +49,6 @@ class OTPGenerator {
|
|
|
49
49
|
const nonce = this.extractNonce(otp);
|
|
50
50
|
return new Timespan_1.Timespan(Date.now() - nonce);
|
|
51
51
|
}
|
|
52
|
-
// Helper to generate OTP based on a specific nonce
|
|
53
52
|
generateOTPWithNonce(nonce) {
|
|
54
53
|
const hash = crypto.createHmac('sha256', this.passkey).update(nonce.toString()).digest('hex');
|
|
55
54
|
const otp = [...hash.slice(0, this.length)].map(char => String.fromCharCode((parseInt(char, 16) % 26) + 97)).join('');
|
|
@@ -24,8 +24,7 @@ export class OTPGenerator {
|
|
|
24
24
|
return new Timespan(Date.now() - nonce)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
private generateOTPWithNonce(nonce: number): string {
|
|
27
|
+
public generateOTPWithNonce(nonce: number): string { // lets keep it public for testing
|
|
29
28
|
const hash = crypto.createHmac('sha256', this.passkey).update(nonce.toString()).digest('hex');
|
|
30
29
|
const otp = [...hash.slice(0, this.length)].map(char => String.fromCharCode((parseInt(char, 16) % 26) + 97)).join('');
|
|
31
30
|
return `${otp}${nonce.toString(16).padStart(13, '0')}`;
|