This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
/
base.js
96 lines (81 loc) · 1.95 KB
/
base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* The base relier. It's the base of all other reliers, or a NullRelier,
* depending on how you want to use it.
*/
'use strict';
define([
'backbone',
'lib/promise'
], function (Backbone, p) {
var Relier = Backbone.Model.extend({
defaults: {},
fetch: function () {
return p(true);
},
/**
* Check if the user visits FxA directly, without
* a relier.
*
* @returns {Boolean}
* `true` if the user visits FxA without using
* a relier
*/
isDirectAccess: function () {
return ! this.has('service');
},
/**
* Check if the relier is using the oauth flow
*/
isOAuth: function () {
return false;
},
/**
* Check if the relier is Firefox Desktop
*/
isFxDesktop: function () {
return false;
},
/**
* Check if the relier is Sync for Firefox Desktop
*/
isSync: function () {
return false;
},
/**
* Check if the relier forces the "customize sync" checkbox to be checked.
*/
isCustomizeSyncChecked: function () {
return false;
},
/**
* Check if the relier wants access to the account encryption keys.
*/
wantsKeys: function () {
return false;
},
/**
* Derive relier-specific keys from the account master keys.
* By default no keys are available.
*/
deriveRelierKeys: function (/* keys */) {
return p({});
},
/**
* Create a resume token to be passed along in the email
* verification links
*/
getResumeToken: function () {
return null;
},
/**
* Indicates whether the relier allows cached credentials
*/
allowCachedCredentials: function () {
return true;
}
});
return Relier;
});