Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Revert "added uid to principal in signed key"
Browse files Browse the repository at this point in the history
This reverts commit 91bfb79.

Conflicts:
	routes/sign.js
	test/run/signer_tests.js
  • Loading branch information
zaach committed Nov 22, 2013
1 parent 8f8f6c2 commit 3490257
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
5 changes: 1 addition & 4 deletions bin/signer.js
Expand Up @@ -20,15 +20,12 @@ process.on('message', function (message) {
if (!message.email || typeof(message.email) !== 'string') {
return process.send({ err: { message: 'bad email' } })
}
if (!message.uid || typeof(message.uid) !== 'string') {
return process.send({ err: { message: 'bad uid' } })
}
try {
var now = Date.now()
jwcrypto.cert.sign(
{
publicKey: jwcrypto.loadPublicKeyFromObject(message.publicKey),
principal: { email: message.email, uid: message.uid },
principal: { email: message.email },
//TODO: kA, etc
},
{
Expand Down
3 changes: 1 addition & 2 deletions routes/sign.js
Expand Up @@ -66,8 +66,7 @@ module.exports = function (log, isA, error, signer, domain) {

signer.enqueue(
{
uid: sessionToken.uid,
email: Buffer(sessionToken.email, 'hex').toString(),
email: sessionToken.uid + '@' + domain,
publicKey: publicKey,
duration: duration
},
Expand Down
31 changes: 1 addition & 30 deletions test/run/signer_tests.js
@@ -1,17 +1,6 @@
/* 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/. */

var fs = require('fs')
var path = require('path')
var test = require('tap').test
var CC = require('compute-cluster')
var jwcrypto = require('jwcrypto')
require('jwcrypto/lib/algs/rs')

var config = require('../../config')
var publicKey = jwcrypto.loadPublicKey(fs.readFileSync(config.get('publicKeyFile')))

var signer = new CC({ module: path.join(__dirname, '../../bin/signer.js')})
signer.on('error', function () {}) // don't die

Expand All @@ -27,7 +16,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
duration: 100
},
function (err, result) {
Expand All @@ -44,7 +32,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
publicKey: {},
duration: 100
},
Expand All @@ -62,7 +49,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
publicKey: {
algorithm: 'RS',
n: '1234'
Expand All @@ -83,7 +69,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
publicKey: {
algorithm: 'RS',
n: '7',
Expand All @@ -105,7 +90,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
publicKey: validKey,
duration: -1
},
Expand All @@ -123,7 +107,6 @@ test(
signer.enqueue(
{
email: 'test@example.com',
uid: 'xxx',
publicKey: validKey,
duration: '2'
},
Expand All @@ -140,7 +123,6 @@ test(
function (t) {
signer.enqueue(
{
uid: 'xxx',
publicKey: validKey,
duration: 100
},
Expand All @@ -157,22 +139,13 @@ test(
function (t) {
signer.enqueue(
{
uid: 'xxx',
email: 'test@example.com',
publicKey: validKey,
duration: 100
},
function (err, result) {
t.ok(result.cert, 'got cert')
jwcrypto.verify(
result.cert,
publicKey,
function (err, payload) {
t.equal(payload.principal.email, 'test@example.com', 'emails match')
t.equal(payload.principal.uid, 'xxx', 'uids match')
t.end()
}
)
t.end()
}
)
}
Expand All @@ -184,7 +157,6 @@ test(
signer.enqueue(
{
crash: true,
uid: 'xxx',
email: 'test@example.com',
publicKey: validKey,
duration: 100
Expand Down Expand Up @@ -218,7 +190,6 @@ test(
for (var i = 0; i < count; i++) {
signer.enqueue(
{
uid: 'xxx',
email: 'test@example.com',
publicKey: validKey,
duration: 100
Expand Down

0 comments on commit 3490257

Please sign in to comment.