UNPKG

563 BJavaScriptView Raw
1import { randomAsU8a } from '../../random/index.js';
2import { ed25519PairFromSeed } from './fromSeed.js';
3/**
4 * @name ed25519PairFromRandom
5 * @summary Creates a new public/secret keypair.
6 * @description
7 * Returns a new generate object containing a `publicKey` & `secretKey`.
8 * @example
9 * <BR>
10 *
11 * ```javascript
12 * import { ed25519PairFromRandom } from '@polkadot/util-crypto';
13 *
14 * ed25519PairFromRandom(); // => { secretKey: [...], publicKey: [...] }
15 * ```
16 */
17export function ed25519PairFromRandom() {
18 return ed25519PairFromSeed(randomAsU8a());
19}