Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const once = (fn) => {
let called = false;
return (...args) => {
if (!called) {
called = true;
return fn(...args);
}
};
};

module.exports = { once }
3 changes: 2 additions & 1 deletion sign.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const timespan = require('./lib/timespan');
const PS_SUPPORTED = require('./lib/psSupported');
const validateAsymmetricKey = require('./lib/validateAsymmetricKey');
const { once } = require('./lib/utils');
const jws = require('jws');
const {includes, isBoolean, isInteger, isNumber, isPlainObject, isString, once} = require('lodash')
const {includes, isBoolean, isInteger, isNumber, isPlainObject, isString} = require('lodash')
const { KeyObject, createSecretKey, createPrivateKey } = require('crypto')

const SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none'];
Expand Down