cab6f1bafb
* Implement the mechanics of fxa login on android, but don't show ui for it yet. Also, scopedKeys are not yet implemented. * Hopefully fix the package-lock conflict? * WIP on android scoped keys * Finish implementing login. * created android/user.js to handle android logins
26 lines
671 B
JavaScript
26 lines
671 B
JavaScript
/* global Android */
|
|
import User from '../app/user';
|
|
import { deriveFileListKey } from '../app/fxa';
|
|
|
|
export default class AndroidUser extends User {
|
|
constructor(storage) {
|
|
super(storage);
|
|
}
|
|
|
|
async login() {
|
|
Android.beginOAuthFlow();
|
|
}
|
|
|
|
async finishLogin(accountInfo) {
|
|
const jwks = JSON.parse(accountInfo.keys);
|
|
const ikm = jwks['https://identity.mozilla.com/apps/send'].k;
|
|
const profile = {
|
|
displayName: accountInfo.displayName,
|
|
email: accountInfo.email,
|
|
avatar: accountInfo.avatar,
|
|
access_token: accountInfo.accessToken
|
|
};
|
|
profile.fileListKey = await deriveFileListKey(ikm);
|
|
this.info = profile;
|
|
}
|
|
}
|