import * as sidetreeCrypto from '@sidetree/crypto' ; import { UNIVERSAL_WALLET_CONTEXT_URL , placeHolderImage } from '../constants' ; export const toKeyPair = async ( mnemonic , index , type = 'Ed25519' , hdPath ? ) : Promise < any > => { const keypair = await sidetreeCrypto . toKeyPair ( mnemonic , index , type , hdPath ) ; const jsonWebKeyPair = await keypair . export ( { type : 'JsonWebKey2020' , privateKey : true } ) ; return { ... jsonWebKeyPair , '@context' : [ UNIVERSAL_WALLET_CONTEXT_URL ] , id : jsonWebKeyPair . id , name : 'Sidetree Key' , image : placeHolderImage , description : 'Generated by @sidetree/wallet.' , tags : [ ] } ; } ;