Skip to content
Snippets Groups Projects
Commit d4213217 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

Change crypto type

parent 6d95fb69
No related branches found
No related tags found
1 merge request!93Draft: Add support for mobile device
import { ICryptoService } from "./ICryptoService";
import { AESGCMOutput, ICryptoService, RSAKeys } from "./ICryptoService";
export interface Proxy {
injectCustomImplementation: (service: ICryptoService) => void;
}
declare const service: ICryptoService;
declare class CryptoServiceProxy implements ICryptoService, Proxy {
private _target;
constructor();
injectCustomImplementation(service: ICryptoService): void;
encryptAESGCM(data: string | ArrayBuffer): Promise<AESGCMOutput>;
decryptAESGCM(data: ArrayBuffer, key: ArrayBuffer, iv: ArrayBuffer): Promise<string>;
decryptAESGCM(data: ArrayBuffer, key: ArrayBuffer, iv: ArrayBuffer, returnBuffer: true): Promise<ArrayBuffer>;
verifyRSASignature(publicKeyPEM: string, data: ArrayBuffer, signature: ArrayBuffer): Promise<boolean>;
generateRSAKeys(): Promise<RSAKeys>;
encryptRSA(publicKeyPEM: string, data: ArrayBuffer): Promise<ArrayBuffer>;
decryptRSA(privateKeyPEM: string, data: ArrayBuffer): Promise<ArrayBuffer>;
signRSA(privateKeyPEM: string, data: ArrayBuffer): Promise<ArrayBuffer>;
SHA1(value: string | ArrayBuffer, encoding?: string): Promise<ArrayBuffer>;
SHA256(value: string | ArrayBuffer, encoding?: string): Promise<ArrayBuffer>;
SHA384(value: string | ArrayBuffer, encoding?: string): Promise<ArrayBuffer>;
SHA512(value: string | ArrayBuffer, encoding?: string): Promise<ArrayBuffer>;
MD5(value: string | ArrayBuffer, encoding?: string): Promise<ArrayBuffer>;
}
declare const service: CryptoServiceProxy;
export default service;
......@@ -97,16 +97,12 @@ class VerificationService extends EventEmitter {
let statusVerified;
let statusPosition = -1;
if (verificationMethod === VERIFICATION_METHOD_MERKLE_TREE) {
({
verified: statusVerified,
statusPosition,
} = yield this.verifyStatusesMerkleTree(statusData.statusRaw, statusBatchData));
({ verified: statusVerified, statusPosition } =
yield this.verifyStatusesMerkleTree(statusData.statusRaw, statusBatchData));
}
else if (verificationMethod === VERIFICATION_METHOD_SHA256_BATCH) {
({
verified: statusVerified,
statusPosition,
} = yield this.verifyStatusSHA256Batch(statusData.statusRaw, statusBatchData));
({ verified: statusVerified, statusPosition } =
yield this.verifyStatusSHA256Batch(statusData.statusRaw, statusBatchData));
}
batchVerificationDetails = {
verified: statusVerified,
......
......@@ -138,6 +138,6 @@ class CryptoServiceProxy implements ICryptoService, Proxy {
}
}
const service: ICryptoService = new CryptoServiceProxy();
const service = new CryptoServiceProxy();
export default service;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment