diff options
Diffstat (limited to 'packages/taler-util/src/http-client/officer-account.ts')
-rw-r--r-- | packages/taler-util/src/http-client/officer-account.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/taler-util/src/http-client/officer-account.ts b/packages/taler-util/src/http-client/officer-account.ts index 4b2529e20..76477f398 100644 --- a/packages/taler-util/src/http-client/officer-account.ts +++ b/packages/taler-util/src/http-client/officer-account.ts @@ -1,4 +1,5 @@ import { + EncryptionNonce, LockedAccount, OfficerAccount, OfficerId, @@ -10,6 +11,7 @@ import { encodeCrock, encryptWithDerivedKey, getRandomBytesF, + kdf, stringToBytes } from "@gnu-taler/taler-util"; @@ -53,13 +55,19 @@ export async function unlockOfficerAccount( */ export async function createNewOfficerAccount( password: string, + extraNonce: EncryptionNonce, ): Promise<OfficerAccount & { safe: LockedAccount }> { const { eddsaPriv, eddsaPub } = createEddsaKeyPair(); const key = stringToBytes(password); + const localRnd = getRandomBytesF(24) + const mergedRnd: EncryptionNonce = extraNonce ? + kdf(24, extraNonce, localRnd) : + localRnd; + const protectedPrivKey = await encryptWithDerivedKey( - getRandomBytesF(24), + mergedRnd, key, eddsaPriv, password, |