Remove from* variants, move fromString to stringTo (#233)

* Remove from* variants, move fromString to stringTo

* Bump
This commit is contained in:
Jaco Greeff
2018-10-18 10:30:14 +02:00
committed by GitHub
parent 35579c4d70
commit 57eddba598
56 changed files with 69 additions and 378 deletions
+2 -2
View File
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import stringToU8a from '@polkadot/util/string/toU8a';
import u8aConcat from '@polkadot/util/u8a/concat';
import u8aFixLength from '@polkadot/util/u8a/fixLength';
import u8aFromString from '@polkadot/util/u8a/fromString';
import naclEncrypt from '@polkadot/util-crypto/nacl/encrypt';
import { PKCS8_DIVIDER, PKCS8_HEADER } from './defaults';
@@ -21,7 +21,7 @@ export default function encode (secretKey: Uint8Array, passphrase?: string): Uin
return encoded;
}
const { encrypted, nonce } = naclEncrypt(encoded, u8aFixLength(u8aFromString(passphrase), 256, true));
const { encrypted, nonce } = naclEncrypt(encoded, u8aFixLength(stringToU8a(passphrase), 256, true));
return u8aConcat(nonce, encrypted);
}