How to use the otpauth.HOTP function in otpauth

To help you get started, we’ve selected a few otpauth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitshares / beet-js / src / lib / BeetConnection.js View on Github external
}
                } else {
                    this.identityhash = res.identityhash;
                    this.appstore = await BeetClientDB.apps.add({
                        apphash: this.apphash,
                        identityhash: this.identityhash,
                        chain: this.chain,
                        appName: this.appName,
                        secret: this.secret.toString('hex'),
                        next_id: next_id
                    });
                    this.authenticated = res.authenticate;
                    this.linked = res.link;
                    this.identity = await BeetClientDB.apps.where("identityhash").equals(this.identityhash).first();
                    console.debug("app fetched", this.identity);
                    this.otp = new OTPAuth.HOTP({
                        issuer: "Beet",
                        label: "BeetAuth",
                        algorithm: "SHA1",
                        digits: 32,
                        counter: 0,
                        secret: OTPAuth.Secret.fromHex(this.identity.secret)
                    });
                    this.identity = Object.assign(this.identity, res.requested);
                    console.groupEnd();
                    resolve(this.identityhash);
                }
            }).catch(rej => {
                console.debug("link rejected", rej);

otpauth

One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers

MIT
Latest version published 25 days ago

Package Health Score

80 / 100
Full package analysis