@shopify/remix-oxygen
Advanced tools
Comparing version 0.0.0-next-e90bc58-20250123223040 to 0.0.0-next-e9310c6-20250220201442
import { createCookieFactory, createCookieSessionStorageFactory, createSessionStorageFactory, createMemorySessionStorageFactory, createRequestHandler as createRequestHandler$1 } from '@remix-run/server-runtime'; | ||
export { MaxPartSizeExceededError, createSession, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
export { MaxPartSizeExceededError, createSession, data, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
@@ -10,4 +10,4 @@ // src/implementations.ts | ||
const key = await createKey(secret, ["sign"]); | ||
const data = encoder.encode(value); | ||
const signature = await crypto.subtle.sign("HMAC", key, data); | ||
const data2 = encoder.encode(value); | ||
const signature = await crypto.subtle.sign("HMAC", key, data2); | ||
const hash = btoa(String.fromCharCode(...new Uint8Array(signature))).replace( | ||
@@ -24,5 +24,5 @@ /=+$/, | ||
const key = await createKey(secret, ["verify"]); | ||
const data = encoder.encode(value); | ||
const data2 = encoder.encode(value); | ||
const signature = byteStringToUint8Array(atob(hash)); | ||
const valid = await crypto.subtle.verify("HMAC", key, signature, data); | ||
const valid = await crypto.subtle.verify("HMAC", key, signature, data2); | ||
return valid ? value : false; | ||
@@ -29,0 +29,0 @@ }; |
import * as _remix_run_server_runtime from '@remix-run/server-runtime'; | ||
import { ServerBuild } from '@remix-run/server-runtime'; | ||
export { ActionFunction, ActionFunctionArgs, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorResponse, HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderFunction, LoaderFunctionArgs, MaxPartSizeExceededError, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, ServerRuntimeMetaArgs as MetaArgs, ServerRuntimeMetaDescriptor as MetaDescriptor, ServerRuntimeMetaFunction as MetaFunction, PageLinkDescriptor, RequestHandler, SerializeFrom, ServerBuild, ServerEntryModule, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, createSession, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
export { ActionFunction, ActionFunctionArgs, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorResponse, HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderFunction, LoaderFunctionArgs, MaxPartSizeExceededError, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, ServerRuntimeMetaArgs as MetaArgs, ServerRuntimeMetaDescriptor as MetaDescriptor, ServerRuntimeMetaFunction as MetaFunction, PageLinkDescriptor, RequestHandler, SerializeFrom, ServerBuild, ServerEntryModule, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, createSession, data, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
@@ -5,0 +5,0 @@ declare const createCookie: _remix_run_server_runtime.CreateCookieFunction; |
import { createCookieFactory, createCookieSessionStorageFactory, createSessionStorageFactory, createMemorySessionStorageFactory, createRequestHandler } from '@remix-run/server-runtime'; | ||
export { MaxPartSizeExceededError, createSession, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
export { MaxPartSizeExceededError, createSession, data, defer, isCookie, isSession, json, redirect, redirectDocument } from '@remix-run/server-runtime'; | ||
@@ -4,0 +4,0 @@ var c=new TextEncoder,l=async(e,t)=>{let r=await y(t,["sign"]),n=c.encode(e),s=await crypto.subtle.sign("HMAC",r,n),o=btoa(String.fromCharCode(...new Uint8Array(s))).replace(/=+$/,"");return e+"."+o},g=async(e,t)=>{let r=e.lastIndexOf("."),n=e.slice(0,r),s=e.slice(r+1),o=await y(t,["verify"]),a=c.encode(n),i=m(atob(s));return await crypto.subtle.verify("HMAC",o,i,a)?n:!1};async function y(e,t){return await crypto.subtle.importKey("raw",c.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t)}function m(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}var u=createCookieFactory({sign:l,unsign:g}),C=createCookieSessionStorageFactory(u),S=createSessionStorageFactory(u),k=createMemorySessionStorageFactory(S);var A=Error.prototype.toString;Error.prototype.toString=function(){return this.stack||A.call(this)};function E({build:e,mode:t,poweredByHeader:r=!0,getLoadContext:n}){let s=createRequestHandler(e,t);return async o=>{let a=o.method;if((a==="GET"||a==="HEAD")&&o.body)return new Response(`${a} requests cannot have a body`,{status:400});let i=new URL(o.url);if(i.pathname.includes("//"))return new Response(null,{status:301,headers:{location:i.pathname.replace(/\/+/g,"/")}});let p=n?await n(o):void 0,d=await s(o,p);return r&&d.headers.append("powered-by","Shopify, Hydrogen"),d}}function v(e){let t=e.headers;return {requestGroupId:t.get("request-id"),buyerIp:t.get("oxygen-buyer-ip"),cookie:t.get("cookie"),purpose:t.get("purpose")}} |
@@ -8,3 +8,3 @@ { | ||
"type": "module", | ||
"version": "0.0.0-next-e90bc58-20250123223040", | ||
"version": "0.0.0-next-e9310c6-20250220201442", | ||
"license": "MIT", | ||
@@ -15,2 +15,7 @@ "main": "dist/index.cjs", | ||
"sideEffects": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Shopify/hydrogen.git", | ||
"directory": "packages/remix-oxygen" | ||
}, | ||
"scripts": { | ||
@@ -45,3 +50,3 @@ "build": "tsup --clean", | ||
"devDependencies": { | ||
"@remix-run/server-runtime": "^2.15.2", | ||
"@remix-run/server-runtime": "^2.15.3", | ||
"@shopify/oxygen-workers-types": "^4.1.2" | ||
@@ -48,0 +53,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
63997
412
1