Преглед изворни кода

stop building lesspass/core for browser

pull/342/head
Guillaume Vincent пре 8 година
родитељ
комит
8980726f96
10 измењених фајлова са 47 додато и 145 уклоњено
  1. +0
    -13
      dist/lesspass.min.js
  2. +1
    -1
      index.js
  3. +15
    -37
      package.json
  4. +12
    -47
      readme.md
  5. +1
    -1
      tests/api.tests.js
  6. +1
    -1
      tests/deriveEncryptedLogin.tests.js
  7. +1
    -1
      tests/getPasswordTemplate.tests.js
  8. +0
    -31
      tests/index.html
  9. +15
    -12
      tests/node.js
  10. +1
    -1
      tests/prettyPrint.js

+ 0
- 13
dist/lesspass.min.js
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


src/lesspass.js → index.js Прегледај датотеку

@@ -1,6 +1,6 @@
import crypto from 'crypto';

module.exports = {
export default {
encryptLogin: _encryptLogin,
renderPassword: _renderPassword,
_deriveEncryptedLogin,

+ 15
- 37
package.json Прегледај датотеку

@@ -2,63 +2,41 @@
"name": "lesspass",
"version": "4.0.0",
"author": "Guillaume Vincent <guillaume@oslab.fr>",
"description": "lesspass javascript module to generate idempotent passwords",
"main": "lib/lesspass.js",
"description": "LessPass javascript module to generate idempotent passwords",
"main": "index",
"repository": "lesspass/core",
"homepage": "https://github.com/lesspass/core#readme",
"bugs": "https://github.com/lesspass/core/issues",
"scripts": {
"test-node": "cd tests && babel-node --presets es2015 node.js && cd ..",
"test": "ava --require babel-core/register",
"browserify": "browserify src/lesspass.js --standalone lesspass | uglifyjs > dist/lesspass.min.js",
"babelify": "babel src/lesspass.js -o lib/lesspass.js",
"build": "rm -rf dist lib && mkdir dist lib && npm run browserify && npm run babelify",
"prepublish": "npm test && npm run build"
"prepublish": "npm test"
},
"files": [
"*.md",
"lib"
],
"keywords": [
"password",
"crypto",
"lesspass"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com:lesspass/core.git"
},
"engines": {
"node": ">=4.2.6"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/lesspass/core/issues"
},
"homepage": "https://github.com/lesspass/core#readme",
"devDependencies": {
"ava": "^0.15.2",
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-preset-es2015": "^6.9.0",
"babelify": "^7.3.0",
"browserify": "^13.0.1",
"karma": "^1.1.0",
"karma-ava": "0.0.1",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"uglify-js": "^2.6.4"
"ava": "^0.16.0",
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-preset-es2015": "^6.16.0"
},
"babel": {
"presets": [
"es2015"
]
},
"browserify": {
"transform": [
"babelify"
]
},
"ava": {
"files": [
"tests/*.js",
"!tests/karma.conf.js",
"!tests/node.js"
],
"source": [
"src/*.js"
]
}
}

+ 12
- 47
readme.md Прегледај датотеку

@@ -4,26 +4,22 @@

core library for LessPass password manager in javascript used to generate unique password.

It works with the browser and NodeJs

## Requirements

- node 4.x.x
- node v4.6.x

## Install

npm install lesspass

## Usage

### Node

var lesspass = require('lesspass');

var login = 'contact@lesspass.com';
var masterPassword = 'password';
var site = 'lesspass.com';
var options = {
import LessPass from 'lesspass';
const site = 'lesspass.com';
const login = 'contact@lesspass.com';
const masterPassword = 'password';
const options = {
counter: 1,
length: 12,
lowercase: true,
@@ -31,42 +27,11 @@ It works with the browser and NodeJs
numbers: true,
symbols: true
};
lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
console.log(generatedPassword); //azYS7,olOL2]
});



### Browser

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="../dist/lesspass.min.js"></script>
<script>
var site = 'lesspass.com';
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var options = {
counter: 1,
length: 12,
lowercase: true,
uppercase: true,
numbers: true,
symbols: true
};
lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
console.log(generatedPassword); //azYS7,olOL2]
LessPass.encryptLogin(login, masterPassword)
.then(encryptedLogin => {
var generatedPassword = LessPass.renderPassword(encryptedLogin, site, options);
console.log(generatedPassword); //azYS7,olOL2]
});
</script>
</body>
</html>


see [tests/api.tests.js](tests/api.tests.js) for more examples


+ 1
- 1
tests/api.tests.js Прегледај датотеку

@@ -1,5 +1,5 @@
import test from 'ava';
import lesspass from '../src/lesspass';
import lesspass from '../index';

test('encrypt login with pbkdf2 8192 iterations and sha256', t => {
return lesspass.encryptLogin('test@example.org', 'password').then(encryptedLogin => {


+ 1
- 1
tests/deriveEncryptedLogin.tests.js Прегледај датотеку

@@ -1,5 +1,5 @@
import test from 'ava';
import lesspass from '../src/lesspass';
import lesspass from '../index';

test('should derive encrypted login with default length', t => {
const encryptedLogin = '9f505f3a95fe0485da3242cb81c9fe25c2f400d8399737655a8dad2b52778d88';


+ 1
- 1
tests/getPasswordTemplate.tests.js Прегледај датотеку

@@ -1,5 +1,5 @@
import test from 'ava';
import lesspass from '../src/lesspass';
import lesspass from '../index';

test('should get default template', t => {
t.is('vcVCns', lesspass._getPasswordTemplate({


+ 0
- 31
tests/index.html Прегледај датотеку

@@ -1,31 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="../dist/lesspass.min.js"></script>
<script>
var site = 'lesspass.com';
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var options = {
counter: 1,
length: 12,
lowercase: true,
uppercase: true,
numbers: true,
symbols: true
};

lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
if (generatedPassword === 'azYS7,olOL2]') {
document.body.innerHTML = "generatePassword ok";
} else {
document.body.innerHTML = "generatePassword not ok " + generatedPassword + ' not equals azYS7,olOL2]';
}
});
</script>
</body>
</html>

+ 15
- 12
tests/node.js Прегледај датотеку

@@ -1,10 +1,10 @@
var lesspass = require('../lib/lesspass');
var assert = require('assert');
import lesspass from '../index';
import assert from 'assert';

var site = 'lesspass.com';
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var options = {
const site = 'lesspass.com';
const login = 'contact@lesspass.com';
const masterPassword = 'password';
const options = {
counter: 1,
length: 12,
lowercase: true,
@@ -12,9 +12,12 @@ var options = {
numbers: true,
symbols: true
};
lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
assert.equal(generatedPassword, 'azYS7,olOL2]');
}).catch(function (err) {
console.log(err);
});
lesspass.encryptLogin(login, masterPassword)
.then(encryptedLogin => {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
assert.equal(generatedPassword, 'azYS7,olOL2]');
console.log('test node ES6 ok');
})
.catch(err => {
console.log(err);
});

+ 1
- 1
tests/prettyPrint.js Прегледај датотеку

@@ -1,5 +1,5 @@
import test from 'ava';
import lesspass from '../src/lesspass';
import lesspass from '../index';

test('should print different password if templates different', t => {
const encryptedLogin = '78ae5892055ab59fdd54489ae30928d322841a27590b65cf875fcfdd083f7c32';


Loading…
Откажи
Сачувај