Skip to content

Commit

Permalink
feat(indy-vdr): use @hyperledger packages (#1252)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <[email protected]>
  • Loading branch information
genaris authored Feb 2, 2023
1 parent b5eb08e commit acdb20a
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 31 deletions.
6 changes: 3 additions & 3 deletions packages/indy-vdr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
},
"dependencies": {
"@aries-framework/core": "0.3.3",
"indy-vdr-test-shared": "^0.1.3"
"@hyperledger/indy-vdr-shared": "^0.1.0-dev.4"
},
"devDependencies": {
"indy-vdr-test-nodejs": "^0.1.3",
"rimraf": "~4.0.7",
"@hyperledger/indy-vdr-nodejs": "^0.1.0-dev.4",
"rimraf": "^4.0.7",
"typescript": "~4.9.4"
}
}
2 changes: 1 addition & 1 deletion packages/indy-vdr/src/dids/IndyVdrSovDidResolver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetNymResponseData, IndyEndpointAttrib } from './didSovUtil'
import type { DidResolutionResult, ParsedDid, DidResolver, AgentContext } from '@aries-framework/core'

import { GetAttribRequest, GetNymRequest } from 'indy-vdr-test-shared'
import { GetAttribRequest, GetNymRequest } from '@hyperledger/indy-vdr-shared'

import { IndyVdrError, IndyVdrNotFoundError } from '../error'
import { IndyVdrPoolService } from '../pool'
Expand Down
2 changes: 1 addition & 1 deletion packages/indy-vdr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { IndyVdrSovDidResolver } from './dids'

try {
// eslint-disable-next-line import/no-extraneous-dependencies
require('indy-vdr-test-nodejs')
require('@hyperledger/indy-vdr-nodejs')
} catch (error) {
throw new Error('Error registering nodejs bindings for Indy VDR')
}
11 changes: 6 additions & 5 deletions packages/indy-vdr/src/pool/IndyVdrPool.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Logger, AgentContext, Key } from '@aries-framework/core'
import type { IndyVdrRequest, IndyVdrPool as indyVdrPool } from 'indy-vdr-test-shared'
import type { IndyVdrRequest, IndyVdrPool as indyVdrPool } from '@hyperledger/indy-vdr-shared'

import { TypedArrayEncoder } from '@aries-framework/core'
import {
GetTransactionAuthorAgreementRequest,
GetAcceptanceMechanismsRequest,
PoolCreate,
indyVdr,
} from 'indy-vdr-test-shared'
} from '@hyperledger/indy-vdr-shared'

import { IndyVdrError } from '../error'

Expand Down Expand Up @@ -146,7 +146,9 @@ export class IndyVdrPool {
acceptanceMechanismType: poolTaa.acceptanceMechanism,
})

request.setTransactionAuthorAgreementAcceptance({ acceptance })
request.setTransactionAuthorAgreementAcceptance({
acceptance: JSON.parse(acceptance),
})
}

private async getTransactionAuthorAgreement(): Promise<AuthorAgreement | null> {
Expand All @@ -172,8 +174,7 @@ export class IndyVdrPool {
// If TAA is not null, we can be sure AcceptanceMechanisms is also not null
const authorAgreement = taaData as Omit<AuthorAgreement, 'acceptanceMechanisms'>

// FIME: remove cast when https://github.com/hyperledger/indy-vdr/pull/142 is released
const acceptanceMechanisms = acceptanceMechanismResponse.result.data as unknown as AcceptanceMechanisms
const acceptanceMechanisms = acceptanceMechanismResponse.result.data as AcceptanceMechanisms
this.authorAgreement = {
...authorAgreement,
acceptanceMechanisms,
Expand Down
4 changes: 2 additions & 2 deletions packages/indy-vdr/src/pool/IndyVdrPoolService.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IndyVdrPoolConfig } from './IndyVdrPool'
import type { AgentContext } from '@aries-framework/core'
import type { GetNymResponse } from 'indy-vdr-test-shared'
import type { GetNymResponse } from '@hyperledger/indy-vdr-shared'

import { Logger, InjectionSymbols, injectable, inject, CacheModuleConfig } from '@aries-framework/core'
import { GetNymRequest } from 'indy-vdr-test-shared'
import { GetNymRequest } from '@hyperledger/indy-vdr-shared'

import { IndyVdrError, IndyVdrNotFoundError, IndyVdrNotConfiguredError } from '../error'
import { isSelfCertifiedDid, DID_INDY_REGEX } from '../utils/did'
Expand Down
2 changes: 1 addition & 1 deletion packages/indy-vdr/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IndyVdrPoolService } from '../src/pool/IndyVdrPoolService'
import type { AgentContext, Key } from '@aries-framework/core'

import { KeyType } from '@aries-framework/core'
import { AttribRequest, NymRequest } from 'indy-vdr-test-shared'
import { AttribRequest, NymRequest } from '@hyperledger/indy-vdr-shared'

import { indyDidFromPublicKeyBase58 } from '../src/utils/did'

Expand Down
2 changes: 1 addition & 1 deletion packages/indy-vdr/tests/indy-vdr-pool.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Key } from '@aries-framework/core'

import { IndyWallet, KeyType, SigningProviderRegistry, TypedArrayEncoder } from '@aries-framework/core'
import { GetNymRequest, NymRequest, SchemaRequest, CredentialDefinitionRequest } from 'indy-vdr-test-shared'
import { GetNymRequest, NymRequest, SchemaRequest, CredentialDefinitionRequest } from '@hyperledger/indy-vdr-shared'

import { agentDependencies, genesisTransactions, getAgentConfig, getAgentContext } from '../../core/tests/helpers'
import testLogger from '../../core/tests/logger'
Expand Down
44 changes: 27 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,23 @@
resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340"
integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==

"@hyperledger/indy-vdr-nodejs@^0.1.0-dev.4":
version "0.1.0-dev.4"
resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-nodejs/-/indy-vdr-nodejs-0.1.0-dev.4.tgz#b5d2090b30c4a51e4e4f15a024054aada0d3550e"
integrity sha512-SwvcoOONhxD9LaX7vunNi1KFKmDb8wmutkBI+Hl6JMX3R+0QgpyQx5M3cfp+V34fBS8pqzKbq9lQmo+pDu3IWg==
dependencies:
"@hyperledger/indy-vdr-shared" "0.1.0-dev.4"
"@mapbox/node-pre-gyp" "^1.0.10"
ffi-napi "^4.0.3"
ref-array-di "^1.2.2"
ref-napi "^3.0.3"
ref-struct-di "^1.1.1"

"@hyperledger/[email protected]", "@hyperledger/indy-vdr-shared@^0.1.0-dev.4":
version "0.1.0-dev.4"
resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-shared/-/indy-vdr-shared-0.1.0-dev.4.tgz#ad9ff18ea285cf3c8ba0b4a5bff03c02f57898e4"
integrity sha512-M6AnLQNryEqcWiH8oNNI/ovkFOykFg7zlO4oM+1xMbHbNzAe6ShBYQDB189zTQAG4RUkuA8yiLHt90g/q6N8dg==

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
Expand Down Expand Up @@ -6139,23 +6156,6 @@ indy-sdk@^1.16.0-dev-1636:
nan "^2.11.1"
node-gyp "^8.0.0"

indy-vdr-test-nodejs@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/indy-vdr-test-nodejs/-/indy-vdr-test-nodejs-0.1.3.tgz#97eaf38b1035bfabcd772a8399f23d766dfd493e"
integrity sha512-E6r86QGbswa+hBgMJKVWJycqvvmOgepFMDaAvuZQtxQK1Z2gghco6m/9EOAPYaJRs0MMEEhzUGhvtSpCzeZ6sg==
dependencies:
"@mapbox/node-pre-gyp" "^1.0.10"
ffi-napi "^4.0.3"
indy-vdr-test-shared "0.1.3"
ref-array-di "^1.2.2"
ref-napi "^3.0.3"
ref-struct-di "^1.1.1"

[email protected], indy-vdr-test-shared@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/indy-vdr-test-shared/-/indy-vdr-test-shared-0.1.3.tgz#3b5ee9492ebc3367a027670aa9686c493de5929c"
integrity sha512-fdgV388zi3dglu49kqrV+i40w+18uJkv96Tk4nziLdP280SLnZKKnIRAiq11Hj8aHpnZmwMloyQCsIyQZDZk2g==

infer-owner@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467"
Expand Down Expand Up @@ -11035,6 +11035,16 @@ type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"

type@^1.0.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0"
integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==

type@^2.7.2:
version "2.7.2"
resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0"
integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==

typed-array-length@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb"
Expand Down

0 comments on commit acdb20a

Please sign in to comment.