aboutsummaryrefslogtreecommitdiff
path: root/packages/exchange-backoffice-ui/src/account.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/exchange-backoffice-ui/src/account.ts')
-rw-r--r--packages/exchange-backoffice-ui/src/account.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/exchange-backoffice-ui/src/account.ts b/packages/exchange-backoffice-ui/src/account.ts
index 05f0f8984..bd3c2003e 100644
--- a/packages/exchange-backoffice-ui/src/account.ts
+++ b/packages/exchange-backoffice-ui/src/account.ts
@@ -16,7 +16,7 @@ export interface Account {
}
/**
- * Restore previous session and unlock account
+ * Restore previous session and unlock account with password
*
* @param salt string from which crypto params will be derived
* @param key secured private key
@@ -55,7 +55,7 @@ declare const opaque_SigningKey: unique symbol;
export type SigningKey = Uint8Array & { [opaque_SigningKey]: true };
/**
- * Create new account (secured private key) under session
+ * Create new account (secured private key)
* secured with the given password
*
* @param sessionId
@@ -64,8 +64,8 @@ export type SigningKey = Uint8Array & { [opaque_SigningKey]: true };
*/
export async function createNewAccount(
password: string,
-): Promise<LockedAccount> {
- const { eddsaPriv } = createEddsaKeyPair();
+): Promise<Account & { safe: LockedAccount }> {
+ const { eddsaPriv, eddsaPub } = createEddsaKeyPair();
const key = stringToBytes(password);
@@ -76,9 +76,11 @@ export async function createNewAccount(
password,
);
- const protectedPriv = encodeCrock(protectedPrivKey);
+ const signingKey = eddsaPriv as SigningKey;
+ const accountId = encodeCrock(eddsaPub) as AccountId;
+ const safe = encodeCrock(protectedPrivKey) as LockedAccount;
- return protectedPriv as LockedAccount;
+ return { accountId, signingKey, safe };
}
export class UnwrapKeyError extends Error {