Skip to content

Commit

Permalink
feat: add basic message and notifications module (#10)
Browse files Browse the repository at this point in the history
* feat: add credentials and proofs modules with dedicated functions

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

* chore: upgrade aries-framework packages to 0.4.2

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

* refactor: remove isWalletImportable method

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

* fix: provider import in proof module

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

* fix: add agent param in all the methods

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

* feat: add basic message and notifications module

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

---------

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>
  • Loading branch information
sairanjit authored Oct 10, 2023
1 parent f53a08e commit f5be207
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/ssi/src/basicMessages/basicMessages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { AdeyaAgent } from '../agent'

/**
* Sends a basic message to the connection with the given connection id.
*
* @param agent The agent instance .
* @param connectionId The connection id.
* @param message The message to send.
*/
export const sendBasicMessage = async (agent: AdeyaAgent, connectionId: string, message: string) => {
return agent.basicMessages.sendMessage(connectionId, message)
}
1 change: 1 addition & 0 deletions packages/ssi/src/basicMessages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './basicMessages'
2 changes: 2 additions & 0 deletions packages/ssi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export * from './wallet'
export * from './connections'
export * from './credentials'
export * from './proofs'
export * from './basicMessages'
export * from './pushNotifications'
export { initializeAgent, AdeyaAgent } from './agent'
// Core
export {
Expand Down
1 change: 1 addition & 0 deletions packages/ssi/src/pushNotifications/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './pushNotifications'
18 changes: 18 additions & 0 deletions packages/ssi/src/pushNotifications/pushNotifications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { AdeyaAgent } from '../agent'
import type { FcmDeviceInfo } from '@aries-framework/push-notifications'

/**
* Sets the device information for push notifications using the provided connection ID and device information.
*
* @param agent - The Adeya agent instance.
* @param connectionId - The connection ID for the device.
* @param deviceInfo - The device information for push notifications.
* @returns void.
*/
export const setPushNotificationDeviceInfo = async (
agent: AdeyaAgent,
connectionId: string,
deviceInfo: FcmDeviceInfo
) => {
return agent.modules.pushNotificationsFcm.setDeviceInfo(connectionId, deviceInfo)
}
11 changes: 11 additions & 0 deletions packages/ssi/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// NOTE: We need to import these to be able to use the AskarWallet in this file.
import '@hyperledger/aries-askar-react-native'

import type { AdeyaAgent } from '../agent'
import type { InitConfig } from '@aries-framework/core'
import type { IndyVdrPoolConfig } from '@aries-framework/indy-vdr'

Expand Down Expand Up @@ -52,6 +53,16 @@ export const isWalletPinCorrect = async (walletConfig: WalletConfig) => {
}
}

/**
* Exports a wallet.
*
* @param agent The agent.
* @param exportConfig The configuration for exporting the wallet.
*/
export const exportWallet = async (agent: AdeyaAgent, exportConfig: WalletExportImportConfig) => {
await agent.wallet.export(exportConfig)
}

/**
* Imports a wallet with an agent.
*
Expand Down

0 comments on commit f5be207

Please sign in to comment.