You're right: I want to do exactly this: given seed and passphrase: get xpriv
from BIP32:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawikiMaster key generation:
Generate a seed byte sequence S of a chosen length (between 128 and 512 bits; 256 bits is advised) from a (P)RNG.
Calculate I = HMAC-SHA512(Key = "Bitcoin seed", Data = S)
Split I into two 32-byte sequences, I_L and I_R.
Use parse256(I_L) as master secret key, and I_R as master chain code.
xpriv is essentially a serialization of the master secret key (I_L) and the master chain code (I_R).
So the function you gave me seems the right one BUT I have 2 problems:
1) if I do in node.js
var Mnemonic = require('bitcore-mnemonic');
var bitcore = require('bitcore');
I have the following error:
Error: More than one instance of bitcore found with versions: v0.13.4 and v0.13.14.
Please make sure to require bitcore and check that submodules do not also include their own bitcore dependency.
2) I don't understand the keyword "prototype" so I can't try your function.
Can you please indicate me how can I can use this function in my code