MAJOR: Updates for Authenticated Web UI and CLI #30

Open
coolaj86 wants to merge 77 commits from next into master
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 2a28dca257 - Show all commits

View File

@ -85,11 +85,11 @@ if ('undefined' !== typeof fetch) {
common._sign = function (opts) { common._sign = function (opts) {
var p; var p;
if ('POST' === opts.method || opts.json) { if ('POST' === opts.method || opts.json) {
p = Keypairs.signJws({ jwk: opts.key, payload: opts.json || {} }).then(function (jws) { p = Keypairs.signJws({ jwk: opts.key || common._key, payload: opts.json || {} }).then(function (jws) {
opts.json = jws; opts.json = jws;
}); });
} else { } else {
p = Keypairs.signJwt({ jwk: opts.key , claims: { iss: false, exp: '60s' } }).then(function (jwt) { p = Keypairs.signJwt({ jwk: opts.key || common._key, claims: { iss: false, exp: '60s' } }).then(function (jwt) {
if (!opts.headers) { opts.headers = {}; } if (!opts.headers) { opts.headers = {}; }
opts.headers.Authorization = 'Bearer ' + jwt; opts.headers.Authorization = 'Bearer ' + jwt;
}); });