Skip to content

Commit

Permalink
fix: Split client/server signup entities
Browse files Browse the repository at this point in the history
- Helps with knowing what goes where
- Avoids decrypting pre-encrypted data
- Fixes a huge security flaw where both master shards
  were sent to the server

BREAKING CHANGE: createSignupEntities return value
  • Loading branch information
franky47 committed May 10, 2020
1 parent 11ef960 commit 2dbb25a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ export async function createSignupEntities(username: string, password: string) {
const unlockedKeychain = createKeychain()
const lockedKeychain = await lockKeychain(unlockedKeychain, keychainKey)
return {
...srpEntities,
masterSalt,
shards,
keychainKey: encryptedKeychainKey,
keychain: {
...lockedKeychain
client: {
masterKey,
keychainKey,
unlockedKeychain,
masterKeyShard: shards[0]
},
server: {
...srpEntities,
masterSalt,
masterKeyShard: shards[1],
keychainKey: encryptedKeychainKey,
keychain: {
...lockedKeychain
}
}
}
}

0 comments on commit 2dbb25a

Please sign in to comment.