diff --git a/src/components/Modals/ImportKey/index.tsx b/src/components/Modals/ImportKey/index.tsx index f9de790..4ad0a85 100644 --- a/src/components/Modals/ImportKey/index.tsx +++ b/src/components/Modals/ImportKey/index.tsx @@ -34,13 +34,23 @@ export const ImportKeyModal = ({ toastError("You don't have an identity yet."); return; } + let key = identityKey; + if (key.startsWith("identityNo:")) { + const indexOfSeparator = key.indexOf(';'); + key = key.substring(indexOfSeparator + 1); + } confirm({ description: 'This operation updates the identity key and you might lose access to your addresses.', }).then(() => { - KeyStore.updateIdentityKey(identityNo, identityKey); - toastSuccess('Successfully imported identity key.'); - onClose(); + try { + KeyStore.updateIdentityKey(identityNo, key); + toastSuccess('Successfully imported identity key.'); + } catch (e) { + toastError("Invalid identity key"); + } finally { + onClose(); + } }); }; diff --git a/src/components/Modals/ShareIdentity/index.tsx b/src/components/Modals/ShareIdentity/index.tsx index 458e7b3..9517c03 100644 --- a/src/components/Modals/ShareIdentity/index.tsx +++ b/src/components/Modals/ShareIdentity/index.tsx @@ -47,7 +47,7 @@ export const ShareIdentityModal = ({ try { const sharedKey = IdentityKey.getSharedKey(identityKey, selectedChains); - setSharedKey(sharedKey); + setSharedKey(`identityNo:${identityNo};`.concat(sharedKey)); } catch (e: any) { toastError(`Failed to get the identity key. Error: ${e.message}`); } @@ -62,17 +62,6 @@ export const ShareIdentityModal = ({ Share Identity - - {`Identity No: ${identityNo}`} - toastSuccess('Identity no copied to clipboard.')} - > - - - - - Specify the chains that the receiver of the identity key will be able to access: @@ -110,9 +99,7 @@ export const ShareIdentityModal = ({ - {'This identity key has to be sent alongside the identity no.'} -
- {"Without it, the receiver won't have access to your addresses"} + {'This identity key will be sent alongside the identity no.'}