"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/keytar/lib/keytar.js" (8 Mar 2017, 2061 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 (function() {
    2   var keytar;
    3 
    4   keytar = require('../build/Release/keytar.node');
    5 
    6   module.exports = {
    7     getPassword: function(service, account) {
    8       if (!((service != null ? service.length : void 0) > 0)) {
    9         throw new Error("Service is required.");
   10       }
   11       if (!((account != null ? account.length : void 0) > 0)) {
   12         throw new Error("Account is required.");
   13       }
   14       return keytar.getPassword(service, account);
   15     },
   16     addPassword: function(service, account, password) {
   17       if (!((service != null ? service.length : void 0) > 0)) {
   18         throw new Error("Service is required.");
   19       }
   20       if (!((account != null ? account.length : void 0) > 0)) {
   21         throw new Error("Account is required.");
   22       }
   23       if (!((password != null ? password.length : void 0) > 0)) {
   24         throw new Error("Password is required.");
   25       }
   26       return keytar.addPassword(service, account, password);
   27     },
   28     deletePassword: function(service, account) {
   29       if (!((service != null ? service.length : void 0) > 0)) {
   30         throw new Error("Service is required.");
   31       }
   32       if (!((account != null ? account.length : void 0) > 0)) {
   33         throw new Error("Account is required.");
   34       }
   35       return keytar.deletePassword(service, account);
   36     },
   37     replacePassword: function(service, account, password) {
   38       if (!((service != null ? service.length : void 0) > 0)) {
   39         throw new Error("Service is required.");
   40       }
   41       if (!((account != null ? account.length : void 0) > 0)) {
   42         throw new Error("Account is required.");
   43       }
   44       if (!((password != null ? password.length : void 0) > 0)) {
   45         throw new Error("Password is required.");
   46       }
   47       keytar.deletePassword(service, account);
   48       return keytar.addPassword(service, account, password);
   49     },
   50     findPassword: function(service) {
   51       if (!((service != null ? service.length : void 0) > 0)) {
   52         throw new Error("Service is required.");
   53       }
   54       return keytar.findPassword(service);
   55     }
   56   };
   57 
   58 }).call(this);