diff --git a/Cargo.toml b/Cargo.toml index abababda02..98e001514a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,3 @@ members = [ debug = true panic = 'unwind' incremental = false - -[profile.dev] -split-debuginfo = "unpacked" diff --git a/agents/node/vcxagent-core/src/services/service-connections.js b/agents/node/vcxagent-core/src/services/service-connections.js index f157361e65..c6594a56a4 100644 --- a/agents/node/vcxagent-core/src/services/service-connections.js +++ b/agents/node/vcxagent-core/src/services/service-connections.js @@ -2,7 +2,7 @@ const { getMessagesForConnection } = require('../utils/messages') const { updateMessages, Connection, - InviterStateType + ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') const { pollFunction } = require('../common') @@ -50,7 +50,7 @@ module.exports.createServiceConnections = function createServiceConnections ({ l async function _progressConnectionToAcceptedState (connection, attemptsThreshold, timeoutMs) { async function progressToAcceptedState () { - if (await connection.updateState() !== InviterStateType.Completed) { + if (await connection.updateState() !== ConnectionStateType.Finished) { return { result: undefined, isFinished: false } } else { return { result: null, isFinished: true } diff --git a/agents/node/vcxagent-core/src/services/service-cred-holder.js b/agents/node/vcxagent-core/src/services/service-cred-holder.js index d8d3daf118..243e50e97c 100644 --- a/agents/node/vcxagent-core/src/services/service-cred-holder.js +++ b/agents/node/vcxagent-core/src/services/service-cred-holder.js @@ -2,7 +2,7 @@ const {filterOffersByCredentialName} = require('../utils/credentials') const { filterOffersByAttr } = require('../utils/credentials') const { filterOffersBySchema } = require('../utils/credentials') const { - StateType, + HolderStateType, Credential } = require('@hyperledger/node-vcx-wrapper') const { pollFunction } = require('../common') @@ -50,7 +50,7 @@ module.exports.createServiceCredHolder = function createServiceCredHolder ({ log async function waitForCredential (connectionId, holderCredentialId, attemptsThreshold = 10, timeoutMs = 2000) { const connection = await loadConnection(connectionId) const credential = await loadHolderCredential(holderCredentialId) - await _progressCredentialToState(credential, connection, 2, attemptsThreshold, timeoutMs) + await _progressCredentialToState(credential, connection, HolderStateType.Finished, attemptsThreshold, timeoutMs) logger.info('Credential has been received.') await saveHolderCredential(holderCredentialId, credential) return getCredentialData(holderCredentialId) diff --git a/agents/node/vcxagent-core/test/utils/alice.js b/agents/node/vcxagent-core/test/utils/alice.js index f758c12257..fefca01729 100644 --- a/agents/node/vcxagent-core/test/utils/alice.js +++ b/agents/node/vcxagent-core/test/utils/alice.js @@ -1,6 +1,6 @@ /* eslint-env jest */ const { createVcxAgent } = require('../../src/index') -const { InviteeStateType, ProverStateType } = require('@hyperledger/node-vcx-wrapper') +const { ConnectionStateType, ProverStateType } = require('@hyperledger/node-vcx-wrapper') module.exports.createAlice = async function createAlice () { const agentName = `alice-${Math.floor(new Date() / 1000)}` @@ -26,7 +26,7 @@ module.exports.createAlice = async function createAlice () { await vcxAgent.serviceConnections.inviteeConnectionAcceptFromInvitation(connectionId, invite) const connection = await vcxAgent.serviceConnections.getVcxConnection(connectionId) - expect(await connection.getState()).toBe(InviteeStateType.Requested) + expect(await connection.getState()).toBe(ConnectionStateType.Requested) await vcxAgent.agentShutdownVcx() } diff --git a/agents/node/vcxagent-core/test/utils/faber.js b/agents/node/vcxagent-core/test/utils/faber.js index 7f75f5ee49..4be958dd0c 100644 --- a/agents/node/vcxagent-core/test/utils/faber.js +++ b/agents/node/vcxagent-core/test/utils/faber.js @@ -1,7 +1,7 @@ /* eslint-env jest */ const { buildRevocationDetails } = require('../../src') const { createVcxAgent, getSampleSchemaData } = require('../../src') -const { InviterStateType, IssuerStateType, VerifierStateType } = require('@hyperledger/node-vcx-wrapper') +const { ConnectionStateType, IssuerStateType, VerifierStateType } = require('@hyperledger/node-vcx-wrapper') const { getAliceSchemaAttrs, getFaberCredDefName, getFaberProofData } = require('./data') module.exports.createFaber = async function createFaber () { @@ -30,7 +30,7 @@ module.exports.createFaber = async function createFaber () { const invite = await vcxAgent.serviceConnections.inviterConnectionCreate(connectionId, undefined) logger.info(`Faber generated invite:\n${invite}`) const connection = await vcxAgent.serviceConnections.getVcxConnection(connectionId) - expect(await connection.getState()).toBe(InviterStateType.Invited) + expect(await connection.getState()).toBe(ConnectionStateType.Invited) await vcxAgent.agentShutdownVcx() @@ -41,7 +41,7 @@ module.exports.createFaber = async function createFaber () { logger.info('Faber is going to generate invite') await vcxAgent.agentInitVcx() - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(InviterStateType.Responded) + expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(ConnectionStateType.Responded) await vcxAgent.agentShutdownVcx() } diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index fcdcfd60bb..3c0cb50b5f 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -1,14 +1,14 @@ const { createFaber } = require('./faber') const { createAlice } = require('./alice') -const { StateType } = require('@hyperledger/node-vcx-wrapper') +const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFaber () { const alice = await createAlice() const faber = await createFaber() const invite = await faber.createInvite() await alice.acceptInvite(invite) - await faber.updateConnection(StateType.RequestReceived) - await alice.updateConnection(StateType.Accepted) - await faber.updateConnection(StateType.Accepted) + await faber.updateConnection(ConnectionStateType.Responded) + await alice.updateConnection(ConnectionStateType.Finished) + await faber.updateConnection(ConnectionStateType.Finished) return { alice, faber } } diff --git a/ci/indy-pool.dockerfile b/ci/indy-pool.dockerfile index a37b30f11d..7e826933f4 100644 --- a/ci/indy-pool.dockerfile +++ b/ci/indy-pool.dockerfile @@ -33,7 +33,7 @@ ARG python3_orderedset_ver=2.0 ARG python3_psutil_ver=5.4.3 ARG python3_pympler_ver=0.5 -RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ +RUN apt-get update -y && apt-get install -y \ python3-pyzmq=${python3_pyzmq_ver} \ indy-plenum=${indy_plenum_ver} \ indy-node=${indy_node_ver} \ diff --git a/libvcx/src/api_lib/api_c/credential.rs b/libvcx/src/api_lib/api_c/credential.rs index 5302b4c627..ba50f1e736 100644 --- a/libvcx/src/api_lib/api_c/credential.rs +++ b/libvcx/src/api_lib/api_c/credential.rs @@ -1063,21 +1063,6 @@ mod tests { assert!(handle > 0); } - #[test] - #[cfg(feature = "general_test")] - fn test_vcx_credential_send_request() { - let _setup = SetupMocks::init(); - - let handle = credential::credential_create_with_offer("test_send_request", ARIES_CREDENTIAL_OFFER).unwrap(); - assert_eq!(credential::get_state(handle).unwrap(), HolderState::OfferReceived as u32); - - let connection_handle = connection::tests::build_test_connection_inviter_requested(); - - let cb = return_types_u32::Return_U32::new().unwrap(); - assert_eq!(vcx_credential_send_request(cb.command_handle, handle, connection_handle, 0, Some(cb.get_callback())), error::SUCCESS.code_num); - cb.receive(TimeoutUtils::some_medium()).unwrap(); - } - #[test] #[cfg(feature = "general_test")] fn test_vcx_credential_get_new_offers() { diff --git a/libvcx/src/aries/handlers/issuance/holder/holder.rs b/libvcx/src/aries/handlers/issuance/holder/holder.rs index 64ba272f55..8ec9e00046 100644 --- a/libvcx/src/aries/handlers/issuance/holder/holder.rs +++ b/libvcx/src/aries/handlers/issuance/holder/holder.rs @@ -90,9 +90,9 @@ impl Holder { Ok(()) } - pub fn update_state(&mut self, connection: &Connection) -> VcxResult { + pub fn update_state(&mut self, connection: &Connection) -> VcxResult { trace!("Holder::update_state >>> "); - if self.is_terminal_state() { return Ok(self.get_state().into()); } + if self.is_terminal_state() { return Ok(self.get_state()); } let send_message = connection.send_message_closure()?; let messages = connection.get_messages()?; @@ -100,6 +100,6 @@ impl Holder { self.step(msg.into(), Some(&send_message))?; connection.update_message_status(uid)?; } - Ok(self.get_state().into()) + Ok(self.get_state()) } } diff --git a/libvcx/src/aries/handlers/issuance/issuer/issuer.rs b/libvcx/src/aries/handlers/issuance/issuer/issuer.rs index b4d4f4717e..c62b686bac 100644 --- a/libvcx/src/aries/handlers/issuance/issuer/issuer.rs +++ b/libvcx/src/aries/handlers/issuance/issuer/issuer.rs @@ -81,9 +81,9 @@ impl Issuer { Ok(()) } - pub fn update_state(&mut self, connection: &Connection) -> VcxResult { - trace!("Issuer::update_state >>> "); - if self.is_terminal_state() { return Ok(self.get_state().into()); } + pub fn update_state(&mut self, connection: &Connection) -> VcxResult { + trace!("Issuer::update_state >>>"); + if self.is_terminal_state() { return Ok(self.get_state()); } let send_message = connection.send_message_closure()?; let messages = connection.get_messages()?; @@ -91,6 +91,6 @@ impl Issuer { self.step(msg.into(), Some(&send_message))?; connection.update_message_status(uid)?; } - Ok(self.get_state().into()) + Ok(self.get_state()) } } diff --git a/wrappers/node/src/api/common.ts b/wrappers/node/src/api/common.ts index a93a47eb6d..a79c64d84a 100644 --- a/wrappers/node/src/api/common.ts +++ b/wrappers/node/src/api/common.ts @@ -105,33 +105,12 @@ export enum VCXCode { INVALID_REDIRECT_DETAILS = 1104, NO_AGENT_INFO = 1106, } -export enum StateType { - None = 0, - Initialized = 1, - OfferSent = 2, - RequestReceived = 3, - Accepted = 4, - Unfulfilled = 5, - Expired = 6, - Revoked = 7, - Redirected = 8, - Rejected = 9, -} - -export enum InviterStateType { +export enum ConnectionStateType { Null = 0, Invited = 1, Requested = 2, Responded = 3, - Completed = 4 -} - -export enum InviteeStateType { - Null = 0, - Invited = 1, - Requested = 2, - Responded = 3, - Completed = 4 + Finished = 4, } export enum HolderStateType { diff --git a/wrappers/node/src/api/connection.ts b/wrappers/node/src/api/connection.ts index 59327d4e64..5053201edb 100644 --- a/wrappers/node/src/api/connection.ts +++ b/wrappers/node/src/api/connection.ts @@ -3,7 +3,7 @@ import * as ref from 'ref-napi'; import { VCXInternalError } from '../errors'; import { rustAPI } from '../rustlib'; import { createFFICallbackPromise, ICbRef } from '../utils/ffi-helpers'; -import { ISerializedData, StateType } from './common'; +import { ISerializedData } from './common'; import { VCXBaseWithState } from './vcx-base-with-state'; import { PtrBuffer } from './utils'; @@ -105,7 +105,7 @@ export interface IConnectionData { endpoint: string; uuid: string; wallet: string; - state: StateType; + state: number; } /** @@ -335,14 +335,14 @@ export class Connection extends VCXBaseWithState { cb, ); if (rc) { - resolve(StateType.None); + resolve(0); } }, (resolve, reject) => ffi.Callback( 'void', ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: StateType) => { + (handle: number, err: number, _state: number) => { if (err) { reject(err); } @@ -373,14 +373,14 @@ export class Connection extends VCXBaseWithState { (resolve, reject, cb) => { const rc = this._updateStFn(commandHandle, this.handle, cb); if (rc) { - resolve(StateType.None); + resolve(0); } }, (resolve, reject) => ffi.Callback( 'void', ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: StateType) => { + (handle: number, err: number, _state: number) => { if (err) { reject(err); } diff --git a/wrappers/node/src/api/issuer-credential.ts b/wrappers/node/src/api/issuer-credential.ts index 8c36f7689c..3f462ddb8b 100644 --- a/wrappers/node/src/api/issuer-credential.ts +++ b/wrappers/node/src/api/issuer-credential.ts @@ -289,15 +289,6 @@ export class IssuerCredential extends VCXBaseWithState { * Sends the credential to the end user. * * Credential is made up of the data sent during Credential Offer - * ``` - * connection = await connectionCreateConnect() - * issuerCredential = await issuerCredentialCreate() - * await issuerCredential.sendOffer(connection) - * await issuerCredential.updateState() - * assert.equal(await issuerCredential.getState(), StateType.RequestReceived) - * await issuerCredential.sendCredential(connection) - * ``` - * */ public async sendCredential(connection: Connection): Promise { try { @@ -326,15 +317,6 @@ export class IssuerCredential extends VCXBaseWithState { * Gets the credential message for sending to connection. * * Credential is made up of the data sent during Credential Offer - * ``` - * connection = await connectionCreateConnect() - * issuerCredential = await issuerCredentialCreate() - * await issuerCredential.sendOffer(connection) - * await issuerCredential.updateState() - * assert.equal(await issuerCredential.getState(), StateType.RequestReceived) - * await issuerCredential.getCredentialMsg() - * ``` - * */ public async getCredentialMsg(myPwDid: string): Promise { try { @@ -371,16 +353,6 @@ export class IssuerCredential extends VCXBaseWithState { * Revokes credential. * * Credential is made up of the data sent during Credential Offer - * ``` - * connection = await connectionCreateConnect() - * issuerCredential = await issuerCredentialCreate() - * await issuerCredential.sendOffer(connection) - * await issuerCredential.updateState() - * assert.equal(await issuerCredential.getState(), StateType.RequestReceived) - * await issuerCredential.sendCredential(connection) - * await issuerCredential.revokeCredential() - * ``` - * */ public async revokeCredential(): Promise { try { diff --git a/wrappers/node/src/api/proof.ts b/wrappers/node/src/api/proof.ts index 0f9da6bba0..83048b25d8 100644 --- a/wrappers/node/src/api/proof.ts +++ b/wrappers/node/src/api/proof.ts @@ -2,7 +2,7 @@ import * as ffi from 'ffi-napi'; import { VCXInternalError } from '../errors'; import { rustAPI } from '../rustlib'; import { createFFICallbackPromise } from '../utils/ffi-helpers'; -import { ISerializedData, StateType } from './common'; +import { ISerializedData } from './common'; import { Connection } from './connection'; import { VCXBaseWithState } from './vcx-base-with-state'; @@ -78,7 +78,7 @@ export interface IProofData { requested_attrs: string; requested_predicates: string; prover_did: string; - state: StateType; + state: number; name: string; proof_state: ProofState; proof: any; // eslint-disable-line @typescript-eslint/no-explicit-any @@ -169,43 +169,12 @@ export interface IRevocationInterval { export class Proof extends VCXBaseWithState { /** * Get the state of the proof - * - * Example - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.requestProof(connection) - * assert.equal(await proof.getState(), StateType.OfferSent) - * ``` */ get proofState(): ProofState | null { return this._proofState; } /** * Get the attributes of the proof - * - * Example - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.requestProof(connection) - * assert.equal(await proof.getState(), StateType.OfferSent) - * proofData = await proof.getProof(connection) - * await proof.updateState() - * assert.equal(await proof.requestedAttributes(), data.attrs) - * ``` */ get requestedAttributes(): IProofAttr[] { return this._requestedAttributes; @@ -217,23 +186,6 @@ export class Proof extends VCXBaseWithState { /** * Get the name of the proof - * - * Example - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.requestProof(connection) - * assert.equal(await proof.getState(), StateType.OfferSent) - * proofData = await proof.getProof(connection) - * await proof.updateState() - * assert.equal(await proof.name(), data.name) - * ``` */ get name(): string { return this._name; diff --git a/wrappers/node/src/api/vcx-base-with-state.ts b/wrappers/node/src/api/vcx-base-with-state.ts index b23640729a..2263b06199 100644 --- a/wrappers/node/src/api/vcx-base-with-state.ts +++ b/wrappers/node/src/api/vcx-base-with-state.ts @@ -1,7 +1,6 @@ import * as ffi from 'ffi-napi'; import { VCXInternalError } from '../errors'; import { createFFICallbackPromise, ICbRef } from '../utils/ffi-helpers'; -import { StateType } from './common'; import { Connection } from './connection'; import { VCXBase } from './vcx-base'; @@ -21,14 +20,14 @@ export abstract class VCXBaseWithState extends VCXBase { const rc = this._updateStFnV2(commandHandle, this.handle, connection.handle, cb); if (rc) { - resolve(StateType.None); + resolve(0); } }, (resolve, reject) => ffi.Callback( 'void', ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: StateType) => { + (handle: number, err: number, _state: number) => { if (err) { reject(err); } @@ -49,23 +48,23 @@ export abstract class VCXBaseWithState extends VCXBase} + * @returns {Promise} */ - public async getState(): Promise { + public async getState(): Promise { try { const commandHandle = 0; - const stateRes = await createFFICallbackPromise( + const stateRes = await createFFICallbackPromise( (resolve, reject, cb) => { const rc = this._getStFn(commandHandle, this.handle, cb); if (rc) { - resolve(StateType.None); + resolve(0); } }, (resolve, reject) => ffi.Callback( 'void', ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, state: StateType) => { + (handle: number, err: number, state: number) => { if (err) { reject(err); } diff --git a/wrappers/node/test/suite1/ariesvcx-connection.test.ts b/wrappers/node/test/suite1/ariesvcx-connection.test.ts index cc680e5d3d..b132e89c62 100644 --- a/wrappers/node/test/suite1/ariesvcx-connection.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-connection.test.ts @@ -9,7 +9,7 @@ import { } from 'helpers/entities'; import { INVITE_ACCEPTED_MESSAGE } from 'helpers/test-constants'; import { initVcxTestMode, shouldThrow, sleep } from 'helpers/utils'; -import { Connection, StateType, VCXCode, VCXMock, VCXMockMessage } from 'src'; +import { Connection, ConnectionStateType, VCXCode, VCXMock, VCXMockMessage } from 'src'; describe('Connection:', () => { before(() => initVcxTestMode()); @@ -130,45 +130,45 @@ describe('Connection:', () => { }); describe('updateState:', () => { - it(`returns ${StateType.None}: not initialized`, async () => { + it(`returns ${ConnectionStateType.Null}: not initialized`, async () => { const connection = new (Connection as any)(); const state1 = await connection.updateState(); const state2 = await connection.getState(); assert.equal(state1, state2); - assert.equal(state2, StateType.None); + assert.equal(state2, ConnectionStateType.Null); }); - it(`returns ${StateType.Initialized}: not connected`, async () => { + it(`returns ${ConnectionStateType.Null}: not connected`, async () => { const connection = await connectionCreateInviterNull({ id: 'alice' }); await connection.updateState(); - assert.equal(await connection.getState(), StateType.None); + assert.equal(await connection.getState(), ConnectionStateType.Null); }); // todo : restore for aries - it.skip(`returns ${StateType.OfferSent}: connected`, async () => { + it.skip(`returns ${ConnectionStateType.Finished}: connected`, async () => { const connection = await createConnectionInviterRequested(); VCXMock.setVcxMock(VCXMockMessage.AcceptInvite); // todo: must return Aries mock data await connection.updateState(); - assert.equal(await connection.getState(), StateType.Accepted); + assert.equal(await connection.getState(), ConnectionStateType.Finished); }); // todo : restore for aries - it.skip(`returns ${StateType.Accepted}: mocked accepted`, async () => { + it.skip(`returns ${ConnectionStateType.Finished}: mocked accepted`, async () => { const connection = await createConnectionInviterRequested(); VCXMock.setVcxMock(VCXMockMessage.GetMessages); await connection.updateState(); - assert.equal(await connection.getState(), StateType.Accepted); + assert.equal(await connection.getState(), ConnectionStateType.Finished); }); // todo : restore for aries - it.skip(`returns ${StateType.Accepted}: mocked accepted`, async () => { + it.skip(`returns ${ConnectionStateType.Finished}: mocked accepted`, async () => { const connection = await createConnectionInviterRequested(); await connection.updateStateWithMessage(INVITE_ACCEPTED_MESSAGE); - assert.equal(await connection.getState(), StateType.Accepted); + assert.equal(await connection.getState(), ConnectionStateType.Finished); }); // todo : restore for aries - it.skip(`returns ${StateType.Accepted}: mocked accepted in parallel`, async () => { + it.skip(`returns ${ConnectionStateType.Finished}: mocked accepted in parallel`, async () => { const numConnections = 50; const interval = 50; const sleepTime = 100; @@ -184,7 +184,7 @@ describe('Connection:', () => { const states = await Promise.all( connectionsWithTimers.map(({ connection }) => connection.getState()), ); - cond = states.every((state) => state === StateType.Accepted); + cond = states.every((state) => state === ConnectionStateType.Finished); VCXMock.setVcxMock(VCXMockMessage.GetMessages); await sleep(sleepTime); } diff --git a/wrappers/node/test/suite1/ariesvcx-credential.test.ts b/wrappers/node/test/suite1/ariesvcx-credential.test.ts index b58168cf20..518e5b0600 100644 --- a/wrappers/node/test/suite1/ariesvcx-credential.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-credential.test.ts @@ -14,7 +14,7 @@ import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { Credential, CredentialPaymentManager, - StateType, + HolderStateType, VCXCode, VCXMock, VCXMockMessage, @@ -94,9 +94,9 @@ describe('Credential:', () => { const connection = await createConnectionInviterRequested(); const data = await dataCredentialCreateWithOffer(); const credential = await Credential.create(data); - assert.equal(await credential.getState(), 0); + assert.equal(await credential.getState(), HolderStateType.OfferReceived); credential.sendRequest({ connection, payment: 0 }); - assert.equal(await credential.getState(), 1); + assert.equal(await credential.getState(), HolderStateType.RequestSent); }); }); @@ -105,14 +105,14 @@ describe('Credential:', () => { const data = await dataCredentialCreateWithOffer(); const credential = await credentialCreateWithOffer(data); await credential.sendRequest({ connection: data.connection, payment: 0 }); - assert.equal(await credential.getState(), 1); + assert.equal(await credential.getState(), HolderStateType.RequestSent); }); it('success: with message id', async () => { const data = await dataCredentialCreateWithMsgId(); const credential = await credentialCreateWithMsgId(data); await credential.sendRequest({ connection: data.connection, payment: 0 }); - assert.equal(await credential.getState(), 1); + assert.equal(await credential.getState(), HolderStateType.RequestSent); }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts b/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts index 9b49586b6f..a4e3e60c53 100644 --- a/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts @@ -11,7 +11,7 @@ import { } from 'helpers/entities' import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { mapValues } from 'lodash'; -import { DisclosedProof, StateType, VCXCode } from 'src'; +import { DisclosedProof, ProverStateType, VCXCode } from 'src'; describe('DisclosedProof', () => { before(() => initVcxTestMode()); @@ -120,20 +120,20 @@ describe('DisclosedProof', () => { }); describe('updateState:', () => { - it(`returns ${StateType.None}: not initialized`, async () => { + it(`returns ${ProverStateType.Initial}: not initialized`, async () => { const disclosedProof = new (DisclosedProof as any)(); const connection = await createConnectionInviterRequested(); const state1 = await disclosedProof.updateStateV2(connection); const state2 = await disclosedProof.getState(); assert.equal(state1, state2); - assert.equal(state2, StateType.None); + assert.equal(state2, ProverStateType.Initial); }); - it(`returns ${StateType.RequestReceived}: created`, async () => { + it(`returns ${ProverStateType.Initial}: created`, async () => { const disclosedProof = await disclosedProofCreateWithRequest(); const connection = await createConnectionInviterRequested(); await disclosedProof.updateStateV2(connection); - assert.equal(await disclosedProof.getState(), 0); + assert.equal(await disclosedProof.getState(), ProverStateType.Initial); }); }); @@ -142,7 +142,7 @@ describe('DisclosedProof', () => { const data = await dataDisclosedProofCreateWithRequest(); const disclosedProof = await disclosedProofCreateWithRequest(data); await disclosedProof.sendProof(data.connection); - assert.equal(await disclosedProof.getState(), StateType.Accepted); + assert.equal(await disclosedProof.getState(), ProverStateType.PresentationSent); }); }); @@ -159,7 +159,7 @@ describe('DisclosedProof', () => { sourceId: 'disclosedProofTestSourceId', }); await disclosedProof.updateStateV2(connection); - assert.equal(await disclosedProof.getState(), StateType.RequestReceived); + assert.equal(await disclosedProof.getState(), ProverStateType.Finished); }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts b/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts index b4c12ac46f..ed7cfaeb36 100644 --- a/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts @@ -7,7 +7,7 @@ import { issuerCredentialCreate, } from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; -import { Connection, IssuerCredential, StateType, VCXCode } from 'src'; +import { Connection, IssuerCredential, IssuerStateType, VCXCode } from 'src'; describe('IssuerCredential:', () => { before(() => initVcxTestMode()); @@ -120,7 +120,7 @@ describe('IssuerCredential:', () => { const issuerCredential = await issuerCredentialCreate(); const connection = await createConnectionInviterRequested(); await issuerCredential.sendOffer(connection); - assert.equal(await issuerCredential.getState(), 1); + assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSent); }); }); @@ -129,7 +129,7 @@ describe('IssuerCredential:', () => { const connection = await createConnectionInviterRequested(); const issuerCredential = await issuerCredentialCreate(); await issuerCredential.sendOffer(connection); - assert.equal(await issuerCredential.getState(), 1); + assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSent); }); it('throws: not initialized', async () => { diff --git a/wrappers/node/test/suite1/ariesvcx-proof.test.ts b/wrappers/node/test/suite1/ariesvcx-proof.test.ts index d588c4f46f..92e2379be4 100644 --- a/wrappers/node/test/suite1/ariesvcx-proof.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-proof.test.ts @@ -8,7 +8,7 @@ import { DisclosedProof, Proof, ProofState, - StateType, + VerifierStateType, VCXCode, VCXMock, VCXMockMessage, @@ -109,20 +109,13 @@ describe('Proof:', () => { }); describe('updateState:', () => { - it(`returns ${StateType.None}: not initialized`, async () => { + it(`returns ${VerifierStateType.Initial}: created`, async () => { const proof = new Proof(null as any, {} as any); const connection = await createConnectionInviterRequested(); const state1 = await proof.updateStateV2(connection); const state2 = await proof.getState(); assert.equal(state1, state2); - assert.equal(state2, 0); - }); - - it(`returns ${StateType.Initialized}: created`, async () => { - const connection = await createConnectionInviterRequested(); - const proof = await proofCreate(); - await proof.updateStateV2(connection); - assert.equal(await proof.getState(), 0); + assert.equal(state2, VerifierStateType.Initial); }); }); @@ -131,7 +124,7 @@ describe('Proof:', () => { const connection = await createConnectionInviterRequested(); const proof = await proofCreate(); await proof.requestProof(connection); - assert.equal(await proof.getState(), 1); + assert.equal(await proof.getState(), VerifierStateType.PresentationRequestSent); }); it('successfully get request message', async () => {