Skip to content

Commit

Permalink
Bump nvmrc back down to 14 and update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Aug 25, 2021
1 parent ac8d6c8 commit ca90720
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15
14
8 changes: 4 additions & 4 deletions packages/remix-node/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Headers, Request, Response, fetch } from "./fetch";

declare global {
namespace NodeJS {
type GlobalSignFunc = (data: string, secret: string) => Promise<string>;
type GlobalSignFunc = (value: string, secret: string) => Promise<string>;
type GlobalUnsignFunc = (
encrypted: string,
signed: string,
secret: string
) => Promise<string | false>;

Expand All @@ -18,8 +18,8 @@ declare global {
Response: typeof Response;
fetch: typeof fetch;

// TODO: Once node v15 hits LTS we should remove these globals and provide
// the webcrypto API instead.
// TODO: Once node v16 is available on AWS we should remove these globals
// and provide the webcrypto API instead.
sign: GlobalSignFunc;
unsign: GlobalUnsignFunc;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/remix-node/sessions/fileStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function createFileSessionStorage({
let content = JSON.stringify({ data, expires });

while (true) {
// TODO: Once node v16 is available on AWS we should use the webcrypto
// API's crypto.getRandomValues() function here instead.
let randomBytes = crypto.randomBytes(8);
// This storage manages an id space of 2^64 ids, which is far greater
// than the maximum number of files allowed on an NTFS or ext4 volume
Expand Down
6 changes: 3 additions & 3 deletions packages/remix-server-runtime/cookieSigning.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Once node v15 hits LTS we should use the globally provided webcrypto "crypto"
// variable and re-enable this code-path in "./cookies.ts" instead of referencing the
// sign and unsign globals.
// TODO: Once node v16 is available on AWS we should use the globally provided
// webcrypto "crypto" variable and re-enable this code-path in "./cookies.ts"
// instead of referencing the sign and unsign globals.

// const encoder = new TextEncoder();

Expand Down
4 changes: 3 additions & 1 deletion packages/remix-server-runtime/cookies.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { CookieParseOptions, CookieSerializeOptions } from "cookie";
import { parse, serialize } from "cookie";

// TODO: Once node v15 hits LTS `import { sign, unsign } from "./cookieSigning";`
// TODO: Once node v16 is available on AWS we should use these instead of the
// global `sign` and `unsign` functions.
//import { sign, unsign } from "./cookieSigning";

export type { CookieParseOptions, CookieSerializeOptions };

Expand Down

0 comments on commit ca90720

Please sign in to comment.