Implement the mechanics of fxa login on android, but don't show ui fo… (#1000)
* 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
This commit is contained in:
parent
ffac4ae5b1
commit
cab6f1bafb
17 changed files with 592 additions and 304 deletions
26
android/user.js
Normal file
26
android/user.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue