From 6272a5a97ce33e7f420f5223e96ee0911cdd9ad7 Mon Sep 17 00:00:00 2001 From: Adi Bhagavath Date: Thu, 20 Jun 2024 11:42:23 +0530 Subject: [PATCH] Add keytype as param for createDid Signed-off-by: Adi Bhagavath --- packages/did/src/Did.chain.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/did/src/Did.chain.ts b/packages/did/src/Did.chain.ts index b5d200b6..df3507ca 100644 --- a/packages/did/src/Did.chain.ts +++ b/packages/did/src/Did.chain.ts @@ -32,6 +32,7 @@ import type { PalletDidDidDetailsDidPublicKey, PalletDidDidDetailsDidPublicKeyDetails, PalletDidServiceEndpointsDidEndpoint, + RawDidLinkedInfo } from '@cord.network/augment-api' import { @@ -515,21 +516,23 @@ export async function fetchFromMnemonic(mnemonic: string): Promise */ export async function createDid( submitterAccount: CordKeyringPair, - theMnemonic?: string, + keytype?: string, + _mnemonic?: string, didServiceEndpoint?: DidServiceEndpoint[] ): Promise<{ mnemonic: string document: DidDocument }> { const api = ConfigService.get('api') + const keyType = keytype ?? 'sr25519'; - const mnemonic = theMnemonic? theMnemonic : mnemonicGenerate(24) + const mnemonic = _mnemonic? _mnemonic : mnemonicGenerate(24) const { authentication, keyAgreement, assertionMethod, capabilityDelegation, - } = Keys.generateKeypairs(mnemonic,"ed25519") + } = Keys.generateKeypairs(mnemonic,keyType) // Get tx that will create the DID on chain and DID-URI that can be used to resolve the DID Document. const didCreationTx = await getStoreTx( { @@ -555,7 +558,7 @@ export async function createDid( await Chain.signAndSubmitTx(didCreationTx, submitterAccount) const didUri = getDidUriFromKey(authentication) - const encodedDid = await api.call.didApi.query(toChain(didUri)) + const encodedDid : Option = await api.call.didApi.query(toChain(didUri)) const { document } = linkedInfoFromChain(encodedDid) if (!document) {