Skip to content

Commit

Permalink
fixing integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maycon-mello committed Oct 3, 2024
1 parent 10740d2 commit 7a5090e
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions packages/wasm/src/services/edv/service.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
// @ts-nocheck
import { InitializeEDVParams, serviceName } from './configs';
import {InitializeEDVParams, serviceName} from './configs';
import EDVHTTPStorageInterface from '@docknetwork/universal-wallet/storage/edv-http-storage';
import HMAC from './hmac';
import { Ed25519VerificationKey2018 } from '@digitalbazaar/ed25519-verification-key-2018';
import { X25519KeyAgreementKey2020 } from '@digitalbazaar/x25519-key-agreement-key-2020';
import { getKeypairFromDoc } from '@docknetwork/universal-wallet/methods/keypairs';
import { logger } from '@docknetwork/wallet-sdk-data-store/src/logger';
import { didService } from '@docknetwork/wallet-sdk-wasm/src/services/dids/service';
import { keyringService } from '@docknetwork/wallet-sdk-wasm/src/services/keyring';
import {Ed25519VerificationKey2018} from '@digitalbazaar/ed25519-verification-key-2018';
import {X25519KeyAgreementKey2020} from '@digitalbazaar/x25519-key-agreement-key-2020';
import {getKeypairFromDoc} from '@docknetwork/universal-wallet/methods/keypairs';
import {logger} from '@docknetwork/wallet-sdk-data-store/src/logger';
import {didService} from '@docknetwork/wallet-sdk-wasm/src/services/dids/service';
import {keyringService} from '@docknetwork/wallet-sdk-wasm/src/services/keyring';

/**
* EDVService
*/
export class EDVService {
storageInterface: EDVHTTPStorageInterface;

// Queue for insert method calls
private insertQueue: Promise<any> = Promise.resolve();

rpcMethods = [
Expand Down Expand Up @@ -47,7 +46,7 @@ export class EDVService {
hmac,
};

const { controller } = verificationKey;
const {controller} = verificationKey;
const invocationSigner = getKeypairFromDoc(verificationKey);
invocationSigner.sign = invocationSigner.signer().sign;

Expand Down Expand Up @@ -107,7 +106,7 @@ export class EDVService {
});
const hmacKey = await HMAC.exportKey(await HMAC.generateKey());

return { verificationKey, agreementKey, hmacKey };
return {verificationKey, agreementKey, hmacKey};
}

find(params: any) {
Expand All @@ -118,14 +117,12 @@ export class EDVService {
return this.storageInterface.update(params);
}

// Queueing insert method calls
insert(params: any) {
this.insertQueue = this.insertQueue.then(() => {
return this.storageInterface.insert(params)
.catch((error) => {
logger.error('Insert failed:', error);
throw error;
});
return this.storageInterface.insert(params).catch(error => {
logger.error('Insert failed:', error);
throw error;
});
});
return this.insertQueue;
}
Expand Down

0 comments on commit 7a5090e

Please sign in to comment.