Commit a8d817d0 authored by Amaury Martiny's avatar Amaury Martiny
Browse files

feat: Add generateKeyPair

parent 7a4a0e9e
import { generateKeypair } from './generateKeypair';
describe('generateKeypair', () => {
it('should work', () => {
const keypair = generateKeypair();
expect(keypair.address).toBeDefined();
});
});
import { Keyring } from '@polkadot/keyring';
import { KeyringPair } from '@polkadot/keyring/types';
import { mnemonicGenerate } from '@polkadot/util-crypto';
/**
* Generate a valid public/private keypair offline
*/
export function generateKeypair(): KeyringPair {
const keyring = new Keyring();
return keyring.addFromMnemonic(mnemonicGenerate());
}
export * from './generateKeypair';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment