Skip to content

Commit

Permalink
fix: verification result is not compatible with v2
Browse files Browse the repository at this point in the history
  • Loading branch information
microshine committed Sep 1, 2022
1 parent bb58fd0 commit 868e256
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SignedData.ts
Expand Up @@ -92,6 +92,7 @@ export interface SignedDataVerifyErrorParams {
signatureVerified?: boolean | null;
signerCertificate?: Certificate | null;
signerCertificateVerified?: boolean | null;
certificatePath?: Certificate[];
}

export interface SignedDataVerifyResult {
Expand All @@ -105,14 +106,15 @@ export interface SignedDataVerifyResult {
certificatePath: Certificate[];
}

export class SignedDataVerifyError extends Error {
export class SignedDataVerifyError extends Error implements SignedDataVerifyResult {

public date: Date;
public code: number;
public signatureVerified: boolean | null;
public signerCertificate: Certificate | null;
public signerCertificateVerified: boolean | null;
public timestampSerial: ArrayBuffer | null;
public certificatePath: Certificate[];

constructor({
message,
Expand All @@ -122,6 +124,7 @@ export class SignedDataVerifyError extends Error {
signerCertificate = null,
signerCertificateVerified = null,
timestampSerial = null,
certificatePath = [],
}: SignedDataVerifyErrorParams) {
super(message);
this.name = "SignedDataVerifyError";
Expand All @@ -132,6 +135,7 @@ export class SignedDataVerifyError extends Error {
this.signatureVerified = signatureVerified;
this.signerCertificate = signerCertificate;
this.signerCertificateVerified = signerCertificateVerified;
this.certificatePath = certificatePath;

}
}
Expand Down Expand Up @@ -666,7 +670,7 @@ export class SignedData extends PkiObject implements ISignedData {
date: checkDate,
code: 15,
message: "Error during verification: TSTInfo verification is failed",
signatureVerified: null,
signatureVerified: false,
signerCertificate: signerCert,
timestampSerial,
signerCertificateVerified: true
Expand Down

0 comments on commit 868e256

Please sign in to comment.