Remove from* variants, move fromString to stringTo (#233)
* Remove from* variants, move fromString to stringTo * Bump
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user