40 lines
783 B
Markdown
40 lines
783 B
Markdown
|
|
|
|
# Functions
|
|
|
|
<a id="toseed"></a>
|
|
|
|
## toSeed
|
|
|
|
▸ **toSeed**(mnemonic: *`string`*): `Uint8Array`
|
|
|
|
*Defined in [mnemonic/toSeed.ts:24](https://github.com/polkadot-js/common/blob/420f807/packages/util-crypto/src/mnemonic/toSeed.ts#L24)*
|
|
|
|
*__name__*: toSeed
|
|
|
|
*__summary__*: Creates a valid seed from a mnemonic input
|
|
|
|
*__example__*:
|
|
|
|
```javascript
|
|
import { mnemonicGenerate, mnemonicToSeed, mnemonicValidate } from '@polkadot/util-crypto';
|
|
|
|
const mnemonic = mnemonicGenerate(); // => string
|
|
const isValidMnemonic = mnemonicValidate(mnemonic); // => boolean
|
|
|
|
if (isValidMnemonic) {
|
|
console.log(`Seed generated from mnemonic: ${mnemonicToSeed(mnemonic)}`); => u8a
|
|
}
|
|
```
|
|
|
|
**Parameters:**
|
|
|
|
| Name | Type |
|
|
| ------ | ------ |
|
|
| mnemonic | `string` |
|
|
|
|
**Returns:** `Uint8Array`
|
|
|
|
___
|
|
|