Skip to content

feat: add otp utils #37

Draft
barelyhuman wants to merge 4 commits into
unjs:mainfrom
barelyhuman:feat/otp
Draft

feat: add otp utils #37
barelyhuman wants to merge 4 commits into
unjs:mainfrom
barelyhuman:feat/otp

Conversation

@barelyhuman
Copy link
Copy Markdown

🔗 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
Comment thread src/otp/base32.ts Outdated
// Simple implementation based of RFC 4648 for base32 encoding and decoding

const pad = "=";
const base32alphaMap = {
Copy link
Copy Markdown
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
Copy Markdown
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