Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
49ff4df2
Commit
49ff4df2
authored
13 years ago
by
Shane Tomlinson
Browse files
Options
Downloads
Plain Diff
Merge branch 'fixbuild' into dev
parents
3924a9fc
bc2fd188
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
browserid/static/dialog/resources/browserid-identities.js
+15
-4
15 additions, 4 deletions
browserid/static/dialog/resources/browserid-identities.js
browserid/static/dialog/resources/storage.js
+57
-47
57 additions, 47 deletions
browserid/static/dialog/resources/storage.js
with
72 additions
and
51 deletions
browserid/static/dialog/resources/browserid-identities.js
+
15
−
4
View file @
49ff4df2
...
...
@@ -35,17 +35,24 @@
*
* ***** END LICENSE BLOCK ***** */
var
jwk
=
require
(
"
./jwk
"
);
var
jwt
=
require
(
"
./jwt
"
);
var
vep
=
require
(
"
./vep
"
);
var
BrowserIDIdentities
=
(
function
()
{
var
jwk
,
jwt
,
vep
;
function
prepareDeps
()
{
if
(
!
jwk
)
{
jwk
=
require
(
"
./jwk
"
);
jwt
=
require
(
"
./jwt
"
);
vep
=
require
(
"
./vep
"
);
}
}
"
use strict
"
;
function
getIssuedIdentities
()
{
var
emails
=
getEmails
();
var
issued_identities
=
{};
_
(
emails
).
each
(
function
(
email_obj
,
email_address
)
{
try
{
prepareDeps
();
email_obj
.
pub
=
jwk
.
PublicKey
.
fromSimpleObject
(
email_obj
.
pub
);
}
catch
(
x
)
{
delete
emails
[
email_address
];
...
...
@@ -147,6 +154,7 @@ var BrowserIDIdentities = (function() {
stageIdentity
:
function
(
email
,
password
,
onSuccess
,
onFailure
)
{
var
self
=
this
;
// FIXME: keysize
prepareDeps
();
var
keypair
=
jwk
.
KeyPair
.
generate
(
vep
.
params
.
algorithm
,
64
);
self
.
stagedEmail
=
email
;
...
...
@@ -271,6 +279,7 @@ var BrowserIDIdentities = (function() {
*/
syncIdentity
:
function
(
email
,
onSuccess
,
onFailure
)
{
// FIXME use true key sizes
prepareDeps
();
//var keypair = jwk.KeyPair.generate(vep.params.algorithm, vep.params.keysize);
var
keypair
=
jwk
.
KeyPair
.
generate
(
vep
.
params
.
algorithm
,
64
);
Identities
.
certifyIdentity
(
email
,
keypair
,
onSuccess
,
onFailure
);
...
...
@@ -288,6 +297,7 @@ var BrowserIDIdentities = (function() {
*/
addIdentity
:
function
(
email
,
onSuccess
,
onFailure
)
{
var
self
=
this
;
prepareDeps
();
var
keypair
=
jwk
.
KeyPair
.
generate
(
vep
.
params
.
algorithm
,
64
);
self
.
stagedEmail
=
email
;
...
...
@@ -353,6 +363,7 @@ var BrowserIDIdentities = (function() {
if
(
storedID
)
{
// parse the secret key
prepareDeps
();
var
sk
=
jwk
.
SecretKey
.
fromSimpleObject
(
storedID
.
priv
);
var
tok
=
new
jwt
.
JWT
(
null
,
new
Date
(),
network
.
origin
);
assertion
=
vep
.
bundleCertsAndAssertion
([
storedID
.
cert
],
tok
.
sign
(
sk
));
...
...
This diff is collapsed.
Click to expand it.
browserid/static/dialog/resources/storage.js
+
57
−
47
View file @
49ff4df2
...
...
@@ -33,57 +33,67 @@
*
* ***** END LICENSE BLOCK ***** */
var
jwk
=
require
(
"
./jwk
"
);
var
getEmails
=
function
()
{
try
{
var
emails
=
JSON
.
parse
(
window
.
localStorage
.
emails
);
if
(
emails
!=
null
)
return
emails
;
}
catch
(
e
)
{
}
(
function
()
{
var
jwk
;
// if we had a problem parsing or the emails are null
clearEmails
();
return
{};
};
function
prepareDeps
()
{
if
(
!
jwk
)
{
jwk
=
require
(
"
./jwk
"
);
}
}
var
_storeEmails
=
function
(
emails
)
{
window
.
localStorage
.
emails
=
JSON
.
stringify
(
emails
);
};
window
.
getEmails
=
function
()
{
try
{
var
emails
=
JSON
.
parse
(
window
.
localStorage
.
emails
);
if
(
emails
!=
null
)
return
emails
;
}
catch
(
e
)
{
}
// if we had a problem parsing or the emails are null
clearEmails
();
return
{};
};
var
addEmail
=
function
(
email
,
obj
)
{
var
emails
=
getEmails
();
emails
[
email
]
=
obj
;
_storeEmails
(
emails
);
};
var
_storeEmails
=
function
(
emails
)
{
window
.
localStorage
.
emails
=
JSON
.
stringify
(
emails
);
};
var
remove
Email
=
function
(
email
)
{
var
emails
=
getEmails
();
delete
emails
[
email
];
_storeEmails
(
emails
);
};
window
.
add
Email
=
function
(
email
,
obj
)
{
var
emails
=
getEmails
();
emails
[
email
]
=
obj
;
_storeEmails
(
emails
);
};
var
clearEmails
=
function
()
{
_storeEmails
({});
};
window
.
removeEmail
=
function
(
email
)
{
var
emails
=
getEmails
();
delete
emails
[
email
];
_storeEmails
(
emails
);
};
var
storeTemporaryKeypair
=
function
(
keypair
)
{
window
.
localStorage
.
tempKeypair
=
JSON
.
stringify
({
publicKey
:
keypair
.
publicKey
.
toSimpleObject
(),
secretKey
:
keypair
.
secretKey
.
toSimpleObject
()
});
};
window
.
clearEmails
=
function
()
{
_storeEmails
({});
};
var
retrieveTemporaryKeypair
=
function
()
{
var
raw_kp
=
JSON
.
parse
(
window
.
localStorage
.
tempKeypair
);
window
.
localStorage
.
tempKeypair
=
null
;
if
(
raw_kp
)
{
var
kp
=
new
jwk
.
KeyPair
();
kp
.
publicKey
=
jwk
.
PublicKey
.
fromSimpleObject
(
raw_kp
.
publicKey
);
kp
.
secretKey
=
jwk
.
SecretKey
.
fromSimpleObject
(
raw_kp
.
secretKey
);
return
kp
;
}
else
{
return
null
;
}
};
\ No newline at end of file
window
.
storeTemporaryKeypair
=
function
(
keypair
)
{
window
.
localStorage
.
tempKeypair
=
JSON
.
stringify
({
publicKey
:
keypair
.
publicKey
.
toSimpleObject
(),
secretKey
:
keypair
.
secretKey
.
toSimpleObject
()
});
};
window
.
retrieveTemporaryKeypair
=
function
()
{
var
raw_kp
=
JSON
.
parse
(
window
.
localStorage
.
tempKeypair
);
window
.
localStorage
.
tempKeypair
=
null
;
if
(
raw_kp
)
{
prepareDeps
();
var
kp
=
new
jwk
.
KeyPair
();
kp
.
publicKey
=
jwk
.
PublicKey
.
fromSimpleObject
(
raw_kp
.
publicKey
);
kp
.
secretKey
=
jwk
.
SecretKey
.
fromSimpleObject
(
raw_kp
.
secretKey
);
return
kp
;
}
else
{
return
null
;
}
};
}());
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment