Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add otp utils #37

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

feat: add otp utils #37

wants to merge 4 commits into from

Conversation

barelyhuman
Copy link

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds helpers for TOTP generation using uncrypto as the base

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

βž• Additional Notes

The unbuild setup builds but still has a commonjs resolver error which I'm assuming is from the upstream repo, so fixing that first, the PR is in draft till then

@barelyhuman barelyhuman marked this pull request as draft January 12, 2024 10:22
@pi0 pi0 changed the title feat(otp): implement otp helpers for totp feat: add otp utils Jan 12, 2024
// Simple implementation based of RFC 4648 for base32 encoding and decoding

const pad = "=";
const base32alphaMap = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might try to compress it using an array.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doable, though the reference and number of operation would remain similar during encode, saves a bit more during decode so I've pushed the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants