Code Monkey home page Code Monkey logo

keytar-vscode-extension's Introduction

Keytar VS Code Extensions

npm install & npm start here or in electron.

This repository demonstrates a weird Keytar issue where when loaded dynamically using require from a node file, the library seemingly works (doesn't work, but doesn't throw an error either) and just before the process exits, it throws a junk exception:

# Fatal error in , line 0
# Check failed: receiver->IsJSFunction().
# FailureMessage Object: 000000B5BCDBDA20npm
# errno 3221225477

(In the electron repro the file name and line number is okay.)

The require seems to go through and resolves to the correct instance whose methods setPassword and findPassword both work as well, but then it crashes.

Funnily enough, when the last line of code is process.exit(0), it doesn't crash, even though there is no more code in either case. It's almost as if some sort of a destructor ran and in it the library threw the exception and process.exit prevented it from running thus leaking the library.

Of course this workaround doesn't help because the findPassword method still returns undefined.

I have filed a Keytar GitHub issue for this problem linking to this repro.


In microsoft/vscode#68738 it is shown how to use VS Code's bundled Keytar which might be an acceptable workaround / fallback mechanism.

This is prototyped in code - instead of scaffolding and committing the extensions, I do that on the fly using Yeoman so that it's code doesn't go out of date or interfere with understanding of the core of the workaround.

async function activate() {
	const keytar = require('keytar');
	await keytar.setPassword('TEST', 'Tom', 'PASSW0RD');
	const password = await keytar.getPassword('TEST', 'Tom');
}

To-Do

Finalize patching the generated extension's package.json

To have a * for an activation event and for its activate to be the above.

keytar-vscode-extension's People

Contributors

tomashubelbauer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.