Skip to content

Commit

Permalink
Merge pull request #24 from VirgilSecurity/v0.3.4
Browse files Browse the repository at this point in the history
v0.3.4
  • Loading branch information
snanovskyi authored Oct 15, 2019
2 parents 0338285 + 8caa587 commit cc57925
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "virgil-pythia",
"version": "0.3.3",
"version": "0.3.4",
"description": "Virgil Pythia SDK allows developers to implement Pythia protocol to create breach-proof passwords, immune to offline and online attacks.",
"main": "./dist/pythia.cjs.js",
"module": "./dist/pythia.es.js",
Expand All @@ -23,7 +23,7 @@
"axios": "^0.19.0"
},
"peerDependencies": {
"virgil-sdk": "6.0.0-alpha.4"
"virgil-sdk": "^6.0.0-alpha.5"
},
"devDependencies": {
"@types/chai": "^4.1.7",
Expand Down Expand Up @@ -51,6 +51,6 @@
"typescript": "^3.5.1",
"uuid": "^3.3.2",
"virgil-crypto": "4.0.0-alpha.13",
"virgil-sdk": "6.0.0-alpha.4"
"virgil-sdk": "^6.0.0-alpha.5"
}
}
29 changes: 15 additions & 14 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
export class PythiaError extends Error {
constructor(message: string) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(message: string, name: string = 'PythiaError', DerivedClass: any = PythiaError) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'PythiaError';
Object.setPrototypeOf(this, DerivedClass.prototype);
this.name = name;
}
}

export class PythiaClientError extends Error {
export class PythiaClientError extends PythiaError {
readonly code?: number;
readonly httpStatus?: number;

constructor(message: string, code?: number, httpStatus?: number) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'PythiaClientError';
super(message, 'PythiaClientError', PythiaClientError);
this.code = code;
this.httpStatus = httpStatus;
}
}

export class ProofVerificationFailedError extends Error {
export class ProofVerificationFailedError extends PythiaError {
constructor() {
super('Transformed password proof verification has failed');
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'ProofVerificationFailedError';
super(
'Transformed password proof verification has failed',
'ProofVerificationFailedError',
ProofVerificationFailedError,
);
}
}

export class UnexpectedBreachProofPasswordVersionError extends Error {
export class UnexpectedBreachProofPasswordVersionError extends PythiaError {
constructor(expectedVersion: number, actualVersion: number) {
super(
`Unexpected Breach-proof password version. Expected ${expectedVersion}, got ${actualVersion}`,
'UnexpectedBreachProofPasswordVersionError',
UnexpectedBreachProofPasswordVersionError,
);
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'UnexpectedBreachProofPasswordVersionError';
}
}

0 comments on commit cc57925

Please sign in to comment.