the password is used to generate the keys (as long as the user doesn't manually change a specific key)
you can generate the keys from the password using @hiveio/hive-js
javascript library like this..
https://gitlab.syncad.com/hive/hive-js/-/blob/master/doc/README.md#generate-keys
var hivejs = require('@hiveio/hive-js');
var keys = hivejs.auth.generateKeys("username", "password here", ["owner","active","posting","memo"]);
console.log({keys});
there are many other ways to achieve this with different libraries; if you need more help you can always go to HiveDevs discord and ask there.