Skip to content

Commit

Permalink
refactor: upgrade credo-ts
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
  • Loading branch information
sairanjit committed Mar 14, 2024
1 parent 1ed69c1 commit 4f41ce3
Show file tree
Hide file tree
Showing 14 changed files with 765 additions and 392 deletions.
24 changes: 12 additions & 12 deletions packages/ssi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
"release": "release-it"
},
"dependencies": {
"@aries-framework/anoncreds": "0.4.2",
"@aries-framework/anoncreds-rs": "0.4.2",
"@aries-framework/askar": "0.4.2",
"@aries-framework/core": "0.4.2",
"@aries-framework/indy-vdr": "0.4.2",
"@aries-framework/push-notifications": "^0.6.0",
"@aries-framework/question-answer": "0.4.2",
"@aries-framework/react-hooks": "0.5.0",
"@aries-framework/react-native": "0.4.2"
"@credo-ts/anoncreds": "0.5.0",
"@credo-ts/askar": "0.5.0",
"@credo-ts/core": "0.5.0",
"@credo-ts/indy-vdr": "0.5.0",
"@credo-ts/push-notifications": "0.7.0",
"@credo-ts/question-answer": "0.5.0",
"@credo-ts/react-hooks": "0.6.0",
"@credo-ts/react-native": "0.5.0"
},
"peerDependencies": {
"@hyperledger/anoncreds-react-native": "^0.1.0",
"@hyperledger/aries-askar-react-native": "^0.1.1",
"@hyperledger/indy-vdr-react-native": "^0.1.0"
"@hyperledger/anoncreds-react-native": "0.2.1",
"@hyperledger/aries-askar-react-native": "0.2.0",
"@hyperledger/indy-vdr-react-native": "0.2.0"
},
"devDependencies": {
"@types/node": "^18.18.8",
"@types/react": "^18.0.24",
"rimraf": "3.0.2",
"typescript": "~5.2.2"
Expand Down
42 changes: 21 additions & 21 deletions packages/ssi/src/agent/agent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InitConfig } from '@aries-framework/core'
import type { AgentModulesInput } from '@aries-framework/core/build/agent/AgentModules'
import type { IndyVdrPoolConfig } from '@aries-framework/indy-vdr'
import type { InitConfig } from '@credo-ts/core'
import type { AgentModulesInput } from '@credo-ts/core/build/agent/AgentModules'
import type { IndyVdrPoolConfig } from '@credo-ts/indy-vdr'

import {
AnonCredsCredentialFormatService,
Expand All @@ -10,12 +10,9 @@ import {
LegacyIndyProofFormatService,
V1CredentialProtocol,
V1ProofProtocol
} from '@aries-framework/anoncreds'
import { AnonCredsRsModule } from '@aries-framework/anoncreds-rs'
import { AskarModule } from '@aries-framework/askar'
} from '@credo-ts/anoncreds'
import { AskarModule } from '@credo-ts/askar'
import {
JwkDidRegistrar,
JwkDidResolver,
Agent,
DidsModule,
WebDidResolver,
Expand All @@ -30,17 +27,18 @@ import {
WsOutboundTransport,
ConnectionsModule,
MediatorPickupStrategy,
JsonLdCredentialFormatService
} from '@aries-framework/core'
JsonLdCredentialFormatService,
DifPresentationExchangeProofFormatService
} from '@credo-ts/core'
import {
IndyVdrAnonCredsRegistry,
IndyVdrIndyDidResolver,
IndyVdrModule,
IndyVdrSovDidResolver
} from '@aries-framework/indy-vdr'
import { PushNotificationsFcmModule } from '@aries-framework/push-notifications'
import { QuestionAnswerModule } from '@aries-framework/question-answer'
import { agentDependencies } from '@aries-framework/react-native'
} from '@credo-ts/indy-vdr'
import { PushNotificationsFcmModule } from '@credo-ts/push-notifications'
import { QuestionAnswerModule } from '@credo-ts/question-answer'
import { agentDependencies } from '@credo-ts/react-native'
import { anoncreds } from '@hyperledger/anoncreds-react-native'
import { ariesAskar } from '@hyperledger/aries-askar-react-native'
import { indyVdr } from '@hyperledger/indy-vdr-react-native'
Expand All @@ -53,19 +51,17 @@ export const getAgentModules = (
askar: new AskarModule({
ariesAskar
}),
anoncredsRs: new AnonCredsRsModule({
anoncreds
}),
anoncreds: new AnonCredsModule({
registries: [new IndyVdrAnonCredsRegistry()]
registries: [new IndyVdrAnonCredsRegistry()],
anoncreds
}),
mediationRecipient: new MediationRecipientModule({
mediatorPickupStrategy: MediatorPickupStrategy.PickUpV2,
mediatorInvitationUrl: mediatorInvitationUrl
}),
dids: new DidsModule({
registrars: [new JwkDidRegistrar()],
resolvers: [new WebDidResolver(), new JwkDidResolver(), new IndyVdrSovDidResolver(), new IndyVdrIndyDidResolver()]
registrars: [],
resolvers: [new WebDidResolver(), new IndyVdrSovDidResolver(), new IndyVdrIndyDidResolver()]
}),
indyVdr: new IndyVdrModule({
indyVdr,
Expand Down Expand Up @@ -93,7 +89,11 @@ export const getAgentModules = (
indyProofFormat: new LegacyIndyProofFormatService()
}),
new V2ProofProtocol({
proofFormats: [new LegacyIndyProofFormatService(), new AnonCredsProofFormatService()]
proofFormats: [
new LegacyIndyProofFormatService(),
new AnonCredsProofFormatService(),
new DifPresentationExchangeProofFormatService()
]
})
]
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi/src/basicMessages/basicMessages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent } from '@aries-framework/core'
import type { Agent } from '@credo-ts/core'

/**
* Sends a basic message to the connection with the given connection id.
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi/src/connections/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
OutOfBandInvitation,
ReceiveOutOfBandInvitationConfig,
Routing
} from '@aries-framework/core'
} from '@credo-ts/core'

/**
* Creates an invitation with RFC 0160: Connection Protocol and returns it together with out-of-band record and invitationUrl.
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi/src/credentials/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
DeleteCredentialOptions,
ProposeCredentialOptions,
SendCredentialProblemReportOptions
} from '@aries-framework/core'
} from '@credo-ts/core'

/**
* Retrieves all credential exchange records from the agent.
Expand Down
4 changes: 2 additions & 2 deletions packages/ssi/src/genericRecords/genericRecords.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Agent, Query } from '@aries-framework/core'
import type { Agent, Query } from '@credo-ts/core'
import type {
GenericRecord,
SaveGenericRecordOption
} from '@aries-framework/core/build/modules/generic-records/repository/GenericRecord'
} from '@credo-ts/core/build/modules/generic-records/repository/GenericRecord'

/**
* Retrieves all credential exchange records from the agent.
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
useQuestionAnswer,
useQuestionAnswerByConnectionId,
useQuestionAnswerById
} from '@aries-framework/react-hooks'
} from '@credo-ts/react-hooks'

export {
useBasicMessages,
Expand Down
39 changes: 22 additions & 17 deletions packages/ssi/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { InitConfig } from '@aries-framework/core'
import type { InitConfig } from '@credo-ts/core'
import type {
GenericRecord,
SaveGenericRecordOption
} from '@aries-framework/core/build/modules/generic-records/repository/GenericRecord'
} from '@credo-ts/core/build/modules/generic-records/repository/GenericRecord'

// Anoncreds
import {
Expand All @@ -29,11 +29,10 @@ import {
AnonCredsCredentialFormatService,
V1ProofProtocol,
AnonCredsCredentialInfo
} from '@aries-framework/anoncreds'
import { AnonCredsCredentialMetadataKey } from '@aries-framework/anoncreds/build/utils/metadata'
} from '@credo-ts/anoncreds'
import { AnonCredsCredentialMetadataKey } from '@credo-ts/anoncreds/build/utils/metadata'
// Core
import { AnonCredsRsModule } from '@aries-framework/anoncreds-rs'
import { AskarModule } from '@aries-framework/askar'
import { AskarModule } from '@credo-ts/askar'
import {
LogLevel,
ConsoleLogger,
Expand Down Expand Up @@ -70,36 +69,40 @@ import {
ConnectionsModule,
Agent,
BasicMessageRepository,
AriesFrameworkError,
CredoError,
ConnectionStateChangedEvent,
CredentialStateChangedEvent,
ProofStateChangedEvent,
ConnectionEventTypes,
CredentialEventTypes,
ProofEventTypes,
Query,
utils
} from '@aries-framework/core'
utils,
TypedArrayEncoder,
DifPresentationExchangeProofFormatService,
JsonTransformer,
ClaimFormat
} from '@credo-ts/core'
import {
GetCredentialsForRequestReturn,
ProofFormatDataMessagePayload
} from '@aries-framework/core/build/modules/proofs/protocol/ProofProtocolOptions'
} from '@credo-ts/core/build/modules/proofs/protocol/ProofProtocolOptions'
// Indy VDR
import {
IndyVdrAnonCredsRegistry,
IndyVdrIndyDidResolver,
IndyVdrModule,
IndyVdrPoolConfig,
IndyVdrSovDidResolver
} from '@aries-framework/indy-vdr'
import { PushNotificationsFcmModule } from '@aries-framework/push-notifications'
} from '@credo-ts/indy-vdr'
import { PushNotificationsFcmModule } from '@credo-ts/push-notifications'
// Q&A
import {
QuestionAnswerRecord,
QuestionAnswerEventTypes,
QuestionAnswerStateChangedEvent,
QuestionAnswerState
} from '@aries-framework/question-answer'
} from '@credo-ts/question-answer'

export * from './agent'
export * from './providers'
Expand Down Expand Up @@ -152,7 +155,7 @@ export {
ConnectionsModule,
Agent,
BasicMessageRepository,
AriesFrameworkError,
CredoError,
ConnectionStateChangedEvent,
CredentialStateChangedEvent,
ProofStateChangedEvent,
Expand All @@ -162,7 +165,11 @@ export {
GenericRecord,
SaveGenericRecordOption,
Query,
utils
utils,
TypedArrayEncoder,
DifPresentationExchangeProofFormatService,
JsonTransformer,
ClaimFormat
}
// Anoncreds
export {
Expand Down Expand Up @@ -195,8 +202,6 @@ export {
export { IndyVdrAnonCredsRegistry, IndyVdrPoolConfig, IndyVdrIndyDidResolver, IndyVdrModule, IndyVdrSovDidResolver }
// Askar
export { AskarModule }
// Anoncreds RS
export { AnonCredsRsModule }
// Push Notifications
export { PushNotificationsFcmModule }
// Q&A
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi/src/proofs/proofs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
RequestProofOptions,
SelectCredentialsForProofRequestOptions,
SendProofProblemReportOptions
} from '@aries-framework/core'
} from '@credo-ts/core'

/**
* Retrieves the formatted data for a proof record with the given ID.
Expand Down
6 changes: 3 additions & 3 deletions packages/ssi/src/providers/AgentProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Agent } from '@aries-framework/core'
import type { AgentModulesInput } from '@aries-framework/core/build/agent/AgentModules'
import type { Agent } from '@credo-ts/core'
import type { AgentModulesInput } from '@credo-ts/core/build/agent/AgentModules'

import AgentProvider, { useAgent } from '@aries-framework/react-hooks'
import AgentProvider, { useAgent } from '@credo-ts/react-hooks'

const useAdeyaAgent: <AgentModules extends AgentModulesInput = AgentModulesInput>() => {
loading: boolean
Expand Down
4 changes: 2 additions & 2 deletions packages/ssi/src/pushNotifications/pushNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Agent } from '@aries-framework/core'
import type { FcmDeviceInfo } from '@aries-framework/push-notifications'
import type { Agent } from '@credo-ts/core'
import type { FcmDeviceInfo } from '@credo-ts/push-notifications'

/**
* Sets the device information for push notifications using the provided connection ID and device information.
Expand Down
4 changes: 2 additions & 2 deletions packages/ssi/src/questionAnswer/questionAnswer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Agent, Query } from '@aries-framework/core'
import type { QuestionAnswerRecord, ValidResponse } from '@aries-framework/question-answer'
import type { Agent, Query } from '@credo-ts/core'
import type { QuestionAnswerRecord, ValidResponse } from '@credo-ts/question-answer'

export type SendQuestionConfig = {
question: string
Expand Down
10 changes: 5 additions & 5 deletions packages/ssi/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// NOTE: We need to import these to be able to use the AskarWallet in this file.
import '@hyperledger/aries-askar-react-native'

import type { InitConfig, WalletConfig, WalletExportImportConfig } from '@aries-framework/core'
import type { AgentModulesInput } from '@aries-framework/core/build/agent/AgentModules'
import type { InitConfig, WalletConfig, WalletExportImportConfig } from '@credo-ts/core'
import type { AgentModulesInput } from '@credo-ts/core/build/agent/AgentModules'

import { AskarWallet } from '@aries-framework/askar'
import { AskarWallet } from '@credo-ts/askar'
import {
Agent,
ConsoleLogger,
Expand All @@ -13,8 +13,8 @@ import {
SigningProviderRegistry,
WsOutboundTransport,
utils
} from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/react-native'
} from '@credo-ts/core'
import { agentDependencies } from '@credo-ts/react-native'

interface WalletImportConfigWithAgent {
agentConfig: InitConfig
Expand Down
Loading

0 comments on commit 4f41ce3

Please sign in to comment.