From 38fe473f076d782a66ebda7cabeef6789484e8f6 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Thu, 30 Sep 2021 22:44:20 +0200 Subject: [PATCH] Removed Schemas.Manifest --- src/PKPass.ts | 21 ++++++++++----------- src/schemas/index.ts | 3 --- src/signature.ts | 6 +++--- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/PKPass.ts b/src/PKPass.ts index 9ce1ee3..bcd16e6 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -481,19 +481,18 @@ export default class PKPass extends Bundle { } private [createManifestSymbol]() { - return Object.entries(this[filesSymbol]).reduce( - (acc, [fileName, buffer]) => { - const hashFlow = forge.md.sha1.create(); + return Object.entries(this[filesSymbol]).reduce<{ + [key: string]: string; + }>((acc, [fileName, buffer]) => { + const hashFlow = forge.md.sha1.create(); - hashFlow.update(buffer.toString("binary")); + hashFlow.update(buffer.toString("binary")); - return { - ...acc, - [fileName]: hashFlow.digest().toHex(), - }; - }, - {}, - ); + return { + ...acc, + [fileName]: hashFlow.digest().toHex(), + }; + }, {}); } private [closePassSymbol]() { diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 712a50c..2b9301a 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -21,9 +21,6 @@ import { Semantics } from "./SemanticTags"; const schemaDebug = debug("Schema"); -export interface Manifest { - [key: string]: string; -} /* export interface Certificates { wwdr?: string; diff --git a/src/signature.ts b/src/signature.ts index 3f3405a..113ad42 100644 --- a/src/signature.ts +++ b/src/signature.ts @@ -5,12 +5,12 @@ import type * as Schemas from "./schemas"; * Generates the PKCS #7 cryptografic signature for the manifest file. * * @method create - * @params {Object} manifest - Manifest content. - * @returns {Buffer} + * @params manifest - Manifest content. + * @returns */ export function create( - manifest: Schemas.Manifest, + manifest: { [key: string]: string }, certificates: Schemas.CertificatesSchema, ): Buffer { const signature = forge.pkcs7.createSignedData();