Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for "REQNACK" response from indy ledger #626

Merged
merged 5 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@multiformats/base-x": "^4.0.1",
"@stablelib/ed25519": "^1.0.2",
"@stablelib/sha256": "^1.0.1",
"@types/indy-sdk": "^1.16.8",
"@types/indy-sdk": "^1.16.11",
"@types/node-fetch": "^2.5.10",
"@types/ws": "^7.4.4",
"abort-controller": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export interface StoreCredentialOptions {
credential: Indy.Cred
credentialDefinition: Indy.CredDef
credentialId?: Indy.CredentialId
revocationRegistryDefinitions?: Indy.RevRegsDefs
revocationRegistryDefinitions?: Indy.RevocRegDef
Annelein marked this conversation as resolved.
Show resolved Hide resolved
}

export interface CreateProofOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ export interface VerifyProofOptions {
proof: Indy.IndyProof
schemas: Indy.Schemas
credentialDefinitions: Indy.CredentialDefs
revocationRegistryDefinitions?: Indy.RevRegsDefs
revocationRegistryDefinitions?: Indy.RevocRegDefs
revocationStates?: Indy.RevStates
}
4 changes: 2 additions & 2 deletions packages/core/src/modules/ledger/IndyPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AriesFrameworkError, IndySdkError } from '../../error'
import { isIndyError } from '../../utils/indyError'

import { LedgerError } from './error/LedgerError'
import { isLedgerRejectResponse } from './ledgerUtil'
import { isLedgerRejectResponse, isLedgerReqnackResponse } from './ledgerUtil'

export interface IndyPoolConfig {
genesisPath?: string
Expand Down Expand Up @@ -122,7 +122,7 @@ export class IndyPool {
public async submitReadRequest(request: Indy.LedgerRequest) {
const response = await this.submitRequest(request)

if (isLedgerRejectResponse(response)) {
if (isLedgerRejectResponse(response) || isLedgerReqnackResponse(response)) {
throw new LedgerError(`Ledger '${this.id}' rejected read transaction request: ${response.reason}`)
}

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/modules/ledger/ledgerUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import type * as Indy from 'indy-sdk'
export function isLedgerRejectResponse(response: Indy.LedgerResponse): response is Indy.LedgerRejectResponse {
return response.op === 'REJECT'
}

export function isLedgerReqnackResponse(response: Indy.LedgerResponse): response is Indy.LedgerReqnackResponse {
return response.op === 'REQNACK'
}
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"events": "^3.3.0"
},
"devDependencies": {
"@types/indy-sdk-react-native": "npm:@types/indy-sdk@^1.16.8",
"@types/indy-sdk-react-native": "npm:@types/indy-sdk@^1.16.11",
"@types/react-native": "^0.64.10",
"indy-sdk-react-native": "^0.1.16",
"react": "17.0.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2237,10 +2237,10 @@
dependencies:
"@types/node" "*"

"@types/indy-sdk-react-native@npm:@types/indy-sdk@^1.16.8", "@types/indy-sdk@^1.16.8":
version "1.16.9"
resolved "https://registry.yarnpkg.com/@types/indy-sdk/-/indy-sdk-1.16.9.tgz#647a77ead1e93c77b2b0ef5f2c399ba2ea461b89"
integrity sha512-X8fdwcGaXfCxayBOb4NUny37JDd9Q3ZDKnm7WBhPRcdOXw3kmsy+WX52751nJQRBcltu883rbqYAIzcZE83XRA==
"@types/indy-sdk-react-native@npm:@types/indy-sdk@^1.16.11", "@types/indy-sdk@^1.16.11":
version "1.16.11"
resolved "https://registry.npmjs.org/@types/indy-sdk/-/indy-sdk-1.16.11.tgz#415df32ae9f16f9e1b3b7428c56890fc994b1181"
integrity sha512-AlNlEo3KqMPeQka4eV/ZU+hqX35Sfz738Dm9nHYMzfnzkQ3+/ZQqkxHiVSuxildxtH8WbYP7GzKUByUn+vS5AQ==
dependencies:
buffer "^6.0.0"

Expand Down