@friendsofshopware/app-server-sdk
Advanced tools
Comparing version 0.0.27 to 0.0.28
export { AppServer } from "./app.js"; | ||
export { InMemoryShopRepository, SimpleShop } from "./repository.js"; | ||
export { HttpClient, HttpClientResponse } from "./http-client.js"; | ||
export { AbstractHmacSigner, WebCryptoHmacSigner } from "./signer.js"; |
@@ -1,2 +0,2 @@ | ||
export class HmacSigner { | ||
export class AbstractHmacSigner { | ||
async signResponse(response, secret) { | ||
@@ -6,10 +6,9 @@ response.headers.set("shopware-app-signature", await this.sign(await response.text(), secret)); | ||
async verifyGetRequest(request, secret) { | ||
// @ts-ignore | ||
const params = new URLSearchParams(request.query); | ||
const signature = params.get("shopware-shop-signature"); | ||
params.delete("shopware-shop-signature"); | ||
return await this.verify(signature, params.toString(), secret); | ||
const url = new URL(request.url); | ||
const signature = url.searchParams.get("shopware-shop-signature"); | ||
url.searchParams.delete("shopware-shop-signature"); | ||
return await this.verify(signature, url.searchParams.toString(), secret); | ||
} | ||
} | ||
export class WebCryptoHmacSigner extends HmacSigner { | ||
export class WebCryptoHmacSigner extends AbstractHmacSigner { | ||
constructor() { | ||
@@ -16,0 +15,0 @@ super(); |
@@ -5,3 +5,3 @@ { | ||
"name": "@friendsofshopware/app-server-sdk", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "Shopware App Server SDK", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
import { Registration } from "./registration.js"; | ||
import { HmacSigner } from "./signer.js"; | ||
import { AbstractHmacSigner } from "./signer.js"; | ||
import { ShopRepositoryInterface } from "./repository.js"; | ||
@@ -8,6 +8,6 @@ import { ContextResolver } from "./context-resolver.js"; | ||
repository: ShopRepositoryInterface; | ||
signer: HmacSigner; | ||
signer: AbstractHmacSigner; | ||
registration: Registration; | ||
contextResolver: ContextResolver; | ||
constructor(cfg: AppConfigurationInterface, repository: ShopRepositoryInterface, signer: HmacSigner); | ||
constructor(cfg: AppConfigurationInterface, repository: ShopRepositoryInterface, signer: AbstractHmacSigner); | ||
} | ||
@@ -14,0 +14,0 @@ export interface AppConfigurationInterface { |
@@ -6,1 +6,2 @@ export { AppServer } from "./app.js"; | ||
export { HttpClient, HttpClientResponse } from "./http-client.js"; | ||
export { AbstractHmacSigner, WebCryptoHmacSigner } from "./signer.js"; |
@@ -1,2 +0,2 @@ | ||
export declare abstract class HmacSigner { | ||
export declare abstract class AbstractHmacSigner { | ||
abstract sign(message: string, secret: string): Promise<string>; | ||
@@ -7,3 +7,3 @@ abstract verify(signature: string, data: string, secret: string): Promise<boolean>; | ||
} | ||
export declare class WebCryptoHmacSigner extends HmacSigner { | ||
export declare class WebCryptoHmacSigner extends AbstractHmacSigner { | ||
private encoder; | ||
@@ -10,0 +10,0 @@ private keyCache; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22908
570