Skip to content

Commit

Permalink
chore: cleanup certification/fapi/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jan 14, 2023
1 parent f78eaa7 commit 646493d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions certification/fapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { readFileSync } from 'node:fs';
import * as path from 'node:path';
import { randomBytes, randomUUID } from 'node:crypto';
import { randomUUID } from 'node:crypto';
import * as https from 'node:https';
import { promisify } from 'node:util';
import { URL } from 'node:url';
Expand Down Expand Up @@ -266,8 +266,6 @@ fapi.interactionResult = function patchedInteractionResult(...args) {
return orig.call(this, ...args);
};

function uuid(e){return e?(e^randomBytes(1)[0]%16>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,uuid)} // eslint-disable-line

const directives = helmet.contentSecurityPolicy.getDefaultDirectives();
delete directives['form-action'];
const pHelmet = promisify(helmet({
Expand Down Expand Up @@ -319,7 +317,7 @@ fapi.use(async (ctx, next) => {
return next();
});
fapi.use((ctx, next) => {
const id = ctx.get('x-fapi-interaction-id') || uuid();
const id = ctx.get('x-fapi-interaction-id') || randomUUID();
ctx.set('x-fapi-interaction-id', id);
return next();
});
Expand Down

0 comments on commit 646493d

Please sign in to comment.