Skip to content

Commit

Permalink
Merge pull request #7 from ajp8164/master
Browse files Browse the repository at this point in the history
Remove core from name
  • Loading branch information
Andy Phillipson committed Sep 29, 2017
2 parents fa9120f + fa79438 commit 8566192
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*.sw[a-z]
coverage
node_modules
btccore-mnemonic.js
btccore-mnemonic.min.js
btc-mnemonic.js
btc-mnemonic.min.js
tests.js

lib/errors/index.js
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing

Please see [CONTRIBUTING.md](https://github.com/owstack/btccore/blob/master/CONTRIBUTING.md) on the main btccore repo.
Please see [CONTRIBUTING.md](https://github.com/owstack/btc/blob/master/CONTRIBUTING.md) on the main btc repo.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Btccore BIP39 Mnemonics
Btc BIP39 Mnemonics
=======

[![NPM Package](https://img.shields.io/npm/v/btccore-mnemonic.svg?style=flat-square)](https://www.npmjs.org/package/btccore-mnemonic)
[![Build Status](https://img.shields.io/travis/owstack/btccore-mnemonic.svg?branch=master&style=flat-square)](https://travis-ci.org/owstack/btccore-mnemonic)
[![Coverage Status](https://img.shields.io/coveralls/owstack/btccore-mnemonic.svg?style=flat-square)](https://coveralls.io/r/owstack/btccore-mnemonic)
[![NPM Package](https://img.shields.io/npm/v/btc-mnemonic.svg?style=flat-square)](https://www.npmjs.org/package/btc-mnemonic)
[![Build Status](https://img.shields.io/travis/owstack/btc-mnemonic.svg?branch=master&style=flat-square)](https://travis-ci.org/owstack/btc-mnemonic)
[![Coverage Status](https://img.shields.io/coveralls/owstack/btc-mnemonic.svg?style=flat-square)](https://coveralls.io/r/owstack/btc-mnemonic)

A module for [btccore](https://github.com/owstack/btccore) that implements [Mnemonic code for generating deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
A module for [btc](https://github.com/owstack/btc) that implements [Mnemonic code for generating deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).

## Attribution

Expand All @@ -16,25 +16,25 @@ This repository was created by copy forking [bitcore-mnemonic commit 532fbe1](ht
This library is distributed in both the npm and bower packaging systems.

```sh
npm install btccore-mnemonic
bower install btccore-mnemonic
npm install btc-mnemonic
bower install btc-mnemonic
```

There are many examples of how to use it on the developer guide [section for mnemonic](http://btccore.io/guide/module/mnemonic/index.html). For example, the following code would generate a new random mnemonic code and convert it to a `HDPrivateKey`.
There are many examples of how to use it on the developer guide [section for mnemonic](http://btc.io/guide/module/mnemonic/index.html). For example, the following code would generate a new random mnemonic code and convert it to a `HDPrivateKey`.

```javascript
var Mnemonic = require('btccore-mnemonic');
var Mnemonic = require('btc-mnemonic');
var code = new Mnemonic(Mnemonic.Words.SPANISH);
code.toString(); // natal hada sutil año sólido papel jamón combate aula flota ver esfera...
var xpriv = code.toHDPrivateKey();
```

## Contributing

See [CONTRIBUTING.md](https://github.com/owstack/btccore/blob/master/CONTRIBUTING.md) on the main btccore repo for information about how to contribute.
See [CONTRIBUTING.md](https://github.com/owstack/btc/blob/master/CONTRIBUTING.md) on the main btc repo for information about how to contribute.

## License

Code released under [the MIT license](https://github.com/owstack/btccore/blob/master/LICENSE).
Code released under [the MIT license](https://github.com/owstack/btc/blob/master/LICENSE).

Copyright 2017 Open Wallet Stack. Btccore is a trademark maintained by Open Wallet Stack.
Copyright 2017 Open Wallet Stack.
10 changes: 5 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "btccore-mnemonic",
"main": "./btccore-mnemonic.min.js",
"name": "btc-mnemonic",
"main": "./btc-mnemonic.min.js",
"version": "0.0.1",
"homepage": "https://github.com/owstack/btccore-mnemonic",
"description": "BIP39 mnemonics support for Btccore.",
"homepage": "https://github.com/owstack/btc-mnemonic",
"description": "BIP39 mnemonics support.",
"moduleType": [
"globals"
],
"keywords": [
"bitcoin",
"btccore",
"btc",
"btc",
"satoshi",
"mnemonic"
Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ Mnemonics is implemented as a separate module and you must add it to your depend
For node projects:

```
npm install btccore-mnemonic --save
npm install btc-mnemonic --save
```

For client-side projects:

```
bower install btccore-mnemonic --save
bower install btc-mnemonic --save
```

## Mnemonic generation
For creating a new random mnemonic code you just create a new instance.

```javascript
var Mnemonic = require('btccore-mnemonic');
var Mnemonic = require('btc-mnemonic');
var code = new Mnemonic();

code.toString(); // 'select scout crash enforce riot rival spring whale hollow radar rule sentence'
Expand All @@ -30,7 +30,7 @@ code.toString(); // 'select scout crash enforce riot rival spring whale hollow r
The `Mnemonic` class can use any list of 2048 unique words to generate the mnemonic code. For convenience the class provides default word lists for the following languages: English (default), Chinese, French, Japanese and Spanish. Those word list are published under `Mnemonic.Words.LANGUAGE`, take a look at the following example:

```javascript
var Mnemonic = require('btccore-mnemonic');
var Mnemonic = require('btc-mnemonic');
var code = new Mnemonic(Mnemonic.Words.SPANISH);
code.toString(); // natal hada sutil año sólido papel jamón combate aula flota ver esfera...

Expand All @@ -42,7 +42,7 @@ var customCode = new Mnemonic(myWordList);
The Mnemonic class provides a static method to check if a mnemonic string is valid. If you generated the mnemonic code using any of the default word list, the class will identify it, otherwise you must provide the word list used.

```javascript
var Mnemonic = require('btccore-mnemonic');
var Mnemonic = require('btc-mnemonic');

var code = 'select scout crash enforce riot rival spring whale hollow radar rule sentence';
var valid = Mnemonic.isValid(code);
Expand All @@ -55,7 +55,7 @@ var validCutom = Mnemonic.isValid(code, customWordlist);
A mnemonic encodes entropy that can be used for creating a seed and later a [HDPrivateKey](hierarchical.md). During the seed generation process a passphrase can be used. The code for doing so looks like this:

```javascript
var Mnemonic = require('btccore-mnemonic');
var Mnemonic = require('btc-mnemonic');
var code = new Mnemonic('select scout crash enforce riot rival spring whale hollow radar rule sentence');

var xpriv1 = code.toHDPrivateKey(); // no passphrase
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
var owsTasks = require('ows-build');
owsTasks('btccore', 'mnemonic');
owsTasks('btc', 'mnemonic');
4 changes: 2 additions & 2 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var spec = {
name: 'Mnemonic',
message: 'Internal Error on btccore-mnemonic module {0}',
message: 'Internal Error on btc-mnemonic module {0}',
errors: [{
name: 'InvalidEntropy',
message: 'Entropy length must be an even multiple of 11 bits: {0}'
Expand All @@ -15,4 +15,4 @@ var spec = {
}]
};

module.exports = require('btccore-lib').errors.extend(spec);
module.exports = require('btc-lib').errors.extend(spec);
20 changes: 10 additions & 10 deletions lib/mnemonic.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use strict';

var btccore = require('btccore-lib');
var BN = btccore.crypto.BN;
var btc = require('btc-lib');
var BN = btc.crypto.BN;
var unorm = require('unorm');
var _ = btccore.deps._;
var _ = btc.deps._;

var pbkdf2 = require('./pbkdf2');
var errors = require('./errors');

var Hash = btccore.crypto.Hash;
var Random = btccore.crypto.Random;
var Hash = btc.crypto.Hash;
var Random = btc.crypto.Random;

var $ = btccore.util.preconditions;
var $ = btc.util.preconditions;


/**
Expand Down Expand Up @@ -55,7 +55,7 @@ var Mnemonic = function(data, wordlist) {
} else if (_.isNumber(data)) {
ent = data;
} else if (data) {
throw new btccore.errors.InvalidArgument('data', 'Must be a Buffer, a string or an integer');
throw new btc.errors.InvalidArgument('data', 'Must be a Buffer, a string or an integer');
}
ent = ent || 128;

Expand All @@ -77,7 +77,7 @@ var Mnemonic = function(data, wordlist) {
throw new errors.InvalidMnemonic(phrase);
}
if (ent % 32 !== 0 || ent < 128) {
throw new btccore.errors.InvalidArgument('ENT', 'Values must be ENT > 128 and ENT % 32 == 0');
throw new btc.errors.InvalidArgument('ENT', 'Values must be ENT > 128 and ENT % 32 == 0');
}

phrase = phrase || Mnemonic._mnemonic(ent, wordlist);
Expand Down Expand Up @@ -204,7 +204,7 @@ Mnemonic.fromSeed = function(seed, wordlist) {
*/
Mnemonic.prototype.toHDPrivateKey = function(passphrase, network) {
var seed = this.toSeed(passphrase);
return btccore.HDPrivateKey.fromSeed(seed, network);
return btc.HDPrivateKey.fromSeed(seed, network);
};

/**
Expand Down Expand Up @@ -292,6 +292,6 @@ Mnemonic._entropyChecksum = function(entropy) {
return checksum;
};

Mnemonic.btccore = btccore;
Mnemonic.btc = btc;

module.exports = Mnemonic;
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "btccore-mnemonic",
"name": "btc-mnemonic",
"version": "0.0.1",
"description": "BIP39 Mnemonics support for Btccore.",
"description": "BIP39 Mnemonics support.",
"main": "index.js",
"scripts": {
"lint": "gulp lint",
Expand All @@ -11,18 +11,18 @@
},
"repository": {
"type": "git",
"url": "https://github.com/owstack/btccore-mnemonic.git"
"url": "https://github.com/owstack/btc-mnemonic.git"
},
"keywords": [
"bitcoin",
"btccore",
"btc",
"mnemonic",
"crypto",
"cryptography",
"encryption"
],
"dependencies": {
"btccore-lib": "https://github.com/owstack/btccore-lib",
"btc-lib": "https://github.com/owstack/btc-lib",
"unorm": "^1.3.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/mnemonic.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var chai = require('chai');
var should = chai.should();

var Mnemonic = require('..');
var errors = require('btccore-lib').errors;
var errors = require('btc-lib').errors;
var bip39_vectors = require('./data/fixtures.json');

describe('Mnemonic', function() {
Expand Down

0 comments on commit 8566192

Please sign in to comment.