Comments (3)
I was able to reproduce a similar error.
With the following code:
// @deno-types="https://deno.land/x/otpauth/types/index.d.ts"
import * as OTPAuth from 'https://deno.land/x/otpauth/dist/otpauth.esm.js';
let totp = OTPAuth.URI.parse('otpauth://totp/ACME:AzureDiamond?issuer=ACME&secret=NB2W45DFOIZA&algorithm=SHA1&digits=6&period=30');
console.log(totp);
When I run:
deno bundle ./app.ts ./app.bundle.js
deno run ./app.bundle.js
I get the following error:
error: Uncaught ReferenceError: parse is not defined
let totp = parse('otpauth://totp/ACME:AzureDiamond?issuer=ACME&secret=NB2W45DFOIZA&algorithm=SHA1&digits=6&period=30');
^
at file:///home/hectorm/Projects/deno-otpauth/app.bundle.js:1512:12
However, if I change the way the module is imported, it works correctly.
// @deno-types="https://deno.land/x/otpauth/types/index.d.ts"
import { URI } from 'https://deno.land/x/otpauth/dist/otpauth.esm.js';
let totp = URI.parse('otpauth://totp/ACME:AzureDiamond?issuer=ACME&secret=NB2W45DFOIZA&algorithm=SHA1&digits=6&period=30');
console.log(totp);
Could you confirm whether the way OTPAuth is being imported is what is causing your error?
from otpauth.
Yes, if i run this example with OTPAuth i see the error.
Screenshot with bundle and error
https://user-images.githubusercontent.com/75129392/102188550-c9992300-3ef8-11eb-9058-2e0bc3fc5111.jpg
Screenshot with bundle without error
https://user-images.githubusercontent.com/75129392/102188666-f2211d00-3ef8-11eb-8d06-3fdf0617afc6.jpg
please note the first line in the screenshot!
from otpauth.
In the first screenshot you should import the library like this (however, it will probably fail with the parse is not defined
error):
import * as OTPAuth from './otpauth.js';
Anyway in my previous message I meant that you should try to change in your own code the way OTPAuth is imported based on the two examples I indicated. I suspect that it's a bug in Deno.
If you provide me with a test project that reproduces the problem it would be helpful.
from otpauth.
Related Issues (20)
- Problem with Vercel Edge Runtime HOT 7
- Installation instruction for nodejs or yarn HOT 1
- Unable to resolve module node:crypto HOT 2
- Problem on Deno HOT 5
- Doubt about delta HOT 3
- Invalid Token HOT 6
- QR Code HOT 1
- How to validate with google authenticator? HOT 1
- Token validation returns null if the token is of Number type and not string HOT 2
- This does not work in Zos and IBMi environments. HOT 12
- Invalid 'issuer' parameter HOT 8
- Add "browser" field to package.json HOT 2
- Use SubtleCrypto in browser HOT 1
- How to solve this ? HOT 1
- Better approach in `uintToBuf` implementation HOT 3
- Package doesn't work for devices other than iOS HOT 5
- TOTP validation not working HOT 3
- More flexibility to the URL generation HOT 2
- Webpack 4 - Error on Compilation HOT 1
- Time sync token HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otpauth.