NativeScript / NativeScript/NativeScript
crypto broken?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.7k
- Forks
- 1.7k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 35
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 6.8.0
- Cross-platform modules: 6.5.15
- Android Runtime: 6.5.3
- iOS Runtime: 6.5.2
- Plugin(s):
Describe the bug
Trying to use the http-client-auth module for digest authentication brought me an error for missing function crypto.getHash.
Adding a require for crypto or crypto-browserify to my code results in a long exception stacktrace at the require point:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: TypeError: Cannot read property 'split' of undefined
System.err: File: (file: node_modules\pbkdf2\lib\default-encoding.js:6:47)
System.err:
System.err: StackTrace:
System.err: ../node_modules/pbkdf2/lib/default-encoding.js(file: node_modules\pbkdf2\lib\default-encoding.js:6:47)
System.err: at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err: at fn(file: app\webpack\bootstrap:120:0)
System.err: at ../node_modules/pbkdf2/lib/sync.js(file: node_modules\pbkdf2\lib\sync.js:14:22)
System.err: at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err: at fn(file: app\webpack\bootstrap:120:0)
System.err: at ../node_modules/pbkdf2/index.js(file: node_modules\pbkdf2\index.js:24:23)
System.err: at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err: at fn(file: app\webpack\bootstrap:120:0)
System.err: at ../node_modules/crypto-browserify/index.js(file: node_modules\crypto-browserify\index.js:14:8)
System.err: at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err: at fn(file: app\webpack\bootstrap:120:0)
System.err: at ./lib/tnsSrvConn.js(file: app\lib\tnsSrvConn.js:4:15)
System.err: at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err: at fn(file: app\webpack\bootstrap:120:0)
System.err: at ../node_modules/babel-loader/lib/index.js!../node_modules/vue-loader/lib/index.js?!./components/MyComponent.vue?vue&type=script&lang=js&(file:///data/data/com.loytec.lweb804/files/app/bundle.js:1352:73)
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the reported NativeScript versions and inspect app/lib/tnsSrvConn.js together with node_modules/pbkdf2/lib/default-encoding.js and node_modules/crypto-browserify/index.js. Confirm how the missing crypto.getHash and the split-of-undefined exception arise; done means digest authentication can load without the require-time crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- authentication, mobile, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100