From 8a50357cdd8af679ce0e81a65ea112b2cc24f370 Mon Sep 17 00:00:00 2001 From: Maycon Mello Date: Wed, 9 Aug 2023 12:35:13 -0300 Subject: [PATCH 1/5] fixing webview module resolution --- examples/verify-credential.js | 6 +++--- integration-tests/credentials.test.ts | 6 +++--- integration-tests/custom-networks.test.ts | 2 +- integration-tests/helpers/account-helpers.ts | 2 +- integration-tests/helpers/index.ts | 2 +- integration-tests/helpers/wallet-helpers.ts | 4 ++-- integration-tests/transactions.test.ts | 4 ++-- packages/core/setup-tests.ts | 2 +- packages/core/src/account-provider.ts | 2 +- packages/core/src/did-provider.test.ts | 2 +- packages/core/src/did-provider.ts | 4 ++-- packages/core/src/network-resolver.ts | 4 ++-- packages/core/src/types.ts | 4 ++-- packages/core/src/v1-helpers.ts | 8 ++++---- packages/core/src/wallet-wasm.ts | 10 +++++----- packages/core/src/wallet.ts | 12 +++++------ packages/credentials/lib/credentials.test.js | 4 ++-- packages/credentials/lib/index.js | 4 ++-- .../lib/credentialPresentHooks.js | 2 +- .../lib/credentials/credentialHooks.js | 4 ++-- .../lib/credentials/credentialHooks.test.js | 8 ++++---- packages/react-native/lib/didHooks.js | 2 +- packages/react-native/lib/didHooks.test.js | 6 +++--- packages/react-native/lib/index.js | 10 +++++----- packages/react-native/lib/message-handler.js | 4 ++-- .../react-native/lib/message-handler.test.js | 2 +- .../react-native/lib/rn-rpc-server/index.js | 2 +- packages/react-native/lib/wallet.ts | 2 +- packages/react-native/sdk-setup.ts | 6 +++--- packages/relay-service/src/did/dids.js | 2 +- packages/relay-service/src/index.js | 4 ++-- packages/relay-service/tests/didcomm.test.js | 2 +- packages/request-logger/lib/request-logger.js | 2 +- .../tests/request-logger.test.js | 4 ++-- packages/scripts/setup-tests.js | 2 +- packages/transactions/lib/schema.js | 2 +- packages/transactions/lib/transactions.js | 20 +++++++++---------- .../transactions/lib/transactions.test.js | 2 +- .../src/services/relay-service/service.js | 2 +- setup-tests.js | 6 +++--- 40 files changed, 89 insertions(+), 89 deletions(-) diff --git a/examples/verify-credential.js b/examples/verify-credential.js index 26a7f987..1b0049a5 100644 --- a/examples/verify-credential.js +++ b/examples/verify-credential.js @@ -1,12 +1,12 @@ const {createWallet} = require('@docknetwork/wallet-sdk-core/lib/wallet'); const { credentialServiceRPC, -} = require('@docknetwork/wallet-sdk-wasm/lib/services/credential'); +} = require('@docknetwork/wallet-sdk-wasm/src/services/credential'); const { didServiceRPC, -} = require('@docknetwork/wallet-sdk-wasm/lib/services/dids'); +} = require('@docknetwork/wallet-sdk-wasm/src/services/dids'); -const {dockService} = require('@docknetwork/wallet-sdk-wasm/lib/services/dock'); +const {dockService} = require('@docknetwork/wallet-sdk-wasm/src/services/dock'); const exampleCredential = require('./example-credential.json'); const presentationDefinition = require('./presentation-definition.json'); diff --git a/integration-tests/credentials.test.ts b/integration-tests/credentials.test.ts index f712d9c3..f22a479f 100644 --- a/integration-tests/credentials.test.ts +++ b/integration-tests/credentials.test.ts @@ -11,10 +11,10 @@ import { UniversityDegreeTestnet, } from './data/credentials'; import {cleanup, createNewWallet, getWallet, setupEnvironent} from './helpers'; -import {credentialService} from '@docknetwork/wallet-sdk-wasm/lib/services/credential/service'; +import {credentialService} from '@docknetwork/wallet-sdk-wasm/src/services/credential/service'; import {IWallet} from '@docknetwork/wallet-sdk-core/src/types'; -import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; -import {API_MOCK_DISABLED} from "@docknetwork/wallet-sdk-wasm/lib/services/test-utils"; +import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; +import {API_MOCK_DISABLED} from "@docknetwork/wallet-sdk-wasm/src/services/test-utils"; const allCredentials = [ BasicCredential, diff --git a/integration-tests/custom-networks.test.ts b/integration-tests/custom-networks.test.ts index eed460f4..69f343b8 100644 --- a/integration-tests/custom-networks.test.ts +++ b/integration-tests/custom-networks.test.ts @@ -1,5 +1,5 @@ import {createWallet, IWallet} from '@docknetwork/wallet-sdk-core/src/wallet'; -import {Network} from '@docknetwork/wallet-sdk-data-store/lib/types'; +import {Network} from '@docknetwork/wallet-sdk-data-store/src/types'; describe('Custom networks', () => { let wallet: IWallet; diff --git a/integration-tests/helpers/account-helpers.ts b/integration-tests/helpers/account-helpers.ts index 5d991527..f88e670d 100644 --- a/integration-tests/helpers/account-helpers.ts +++ b/integration-tests/helpers/account-helpers.ts @@ -1,4 +1,4 @@ -import {Accounts} from '@docknetwork/wallet-sdk-wasm/lib/modules/accounts'; +import {Accounts} from '@docknetwork/wallet-sdk-wasm/src/modules/accounts'; import { Account2MnemonicDetails, AccountJSON, diff --git a/integration-tests/helpers/index.ts b/integration-tests/helpers/index.ts index b6922542..3b1ef984 100644 --- a/integration-tests/helpers/index.ts +++ b/integration-tests/helpers/index.ts @@ -1,4 +1,4 @@ -import {mockDockService} from '@docknetwork/wallet-sdk-wasm/lib/services/test-utils'; +import {mockDockService} from '@docknetwork/wallet-sdk-wasm/src/services/test-utils'; import {DataStoreSnapshotV1} from '../data/data-store'; export async function setupEnvironent() { diff --git a/integration-tests/helpers/wallet-helpers.ts b/integration-tests/helpers/wallet-helpers.ts index 16a64c0f..9febe7f7 100644 --- a/integration-tests/helpers/wallet-helpers.ts +++ b/integration-tests/helpers/wallet-helpers.ts @@ -7,8 +7,8 @@ import {DataStoreSnapshotV1} from '../data/data-store'; import {WalletBackupJSON, WalletBackupPasssword} from '../data/wallet-backup'; import {IWallet} from '@docknetwork/wallet-sdk-core/lib/types'; import {createWallet} from '@docknetwork/wallet-sdk-core/lib/wallet'; -import {Wallet} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; -import {setV1LocalStorage} from '@docknetwork/wallet-sdk-data-store/lib/migration/migration1/v1-data-store'; +import {Wallet} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; +import {setV1LocalStorage} from '@docknetwork/wallet-sdk-data-store/src/migration/migration1/v1-data-store'; let wallet: IWallet; diff --git a/integration-tests/transactions.test.ts b/integration-tests/transactions.test.ts index 89406827..dcca2a47 100644 --- a/integration-tests/transactions.test.ts +++ b/integration-tests/transactions.test.ts @@ -1,5 +1,5 @@ -import {Accounts} from '@docknetwork/wallet-sdk-wasm/lib/modules/accounts'; -import {DOCK_TOKEN_UNIT} from '@docknetwork/wallet-sdk-wasm/lib/core/format-utils'; +import {Accounts} from '@docknetwork/wallet-sdk-wasm/src/modules/accounts'; +import {DOCK_TOKEN_UNIT} from '@docknetwork/wallet-sdk-wasm/src/core/format-utils'; import {Transactions} from '@docknetwork/wallet-sdk-transactions/lib/transactions'; import { diff --git a/packages/core/setup-tests.ts b/packages/core/setup-tests.ts index 4b00a6b2..ab2e4573 100644 --- a/packages/core/setup-tests.ts +++ b/packages/core/setup-tests.ts @@ -1 +1 @@ -import '@docknetwork/wallet-sdk-wasm/lib/setup-tests'; +import '@docknetwork/wallet-sdk-wasm/src/setup-tests'; diff --git a/packages/core/src/account-provider.ts b/packages/core/src/account-provider.ts index 0de6f605..711c807b 100644 --- a/packages/core/src/account-provider.ts +++ b/packages/core/src/account-provider.ts @@ -1,5 +1,5 @@ import {IWallet} from './types'; -import {Accounts} from '@docknetwork/wallet-sdk-wasm/lib/modules/accounts'; +import {Accounts} from '@docknetwork/wallet-sdk-wasm/src/modules/accounts'; import {toV1WalletService} from './v1-helpers'; interface ICreateAccountsProvider { diff --git a/packages/core/src/did-provider.test.ts b/packages/core/src/did-provider.test.ts index 2bb58174..a05d6097 100644 --- a/packages/core/src/did-provider.test.ts +++ b/packages/core/src/did-provider.test.ts @@ -2,7 +2,7 @@ import {IWallet} from './types'; import {createWallet} from './wallet'; import {createDIDock, createDIDProvider, IDIDProvider} from './did-provider'; import {createAccountProvider} from './account-provider'; -import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/dids'; +import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/dids'; describe('DID Provider', () => { let wallet: IWallet; diff --git a/packages/core/src/did-provider.ts b/packages/core/src/did-provider.ts index 7e3b8a60..04b19cd5 100644 --- a/packages/core/src/did-provider.ts +++ b/packages/core/src/did-provider.ts @@ -1,6 +1,6 @@ import {IWallet} from './types'; -import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/dids/index'; -import assert from "assert"; +import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/dids/index'; +import assert from 'assert'; export async function importDID({ wallet, diff --git a/packages/core/src/network-resolver.ts b/packages/core/src/network-resolver.ts index 0b731542..16f853e9 100644 --- a/packages/core/src/network-resolver.ts +++ b/packages/core/src/network-resolver.ts @@ -4,8 +4,8 @@ import { DocumentResolverProps, DocumentResolverResult, WalletDocument, -} from '@docknetwork/wallet-sdk-data-store/lib/types'; -import {utilCryptoService} from '@docknetwork/wallet-sdk-wasm/lib/services/util-crypto'; +} from '@docknetwork/wallet-sdk-data-store/src/types'; +import {utilCryptoService} from '@docknetwork/wallet-sdk-wasm/src/services/util-crypto'; type ResolverResult = string | null; diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 2c2c941b..f148dc69 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -3,8 +3,8 @@ import { DataStoreConfigs, DocumentResolverResult, WalletDocument, -} from '@docknetwork/wallet-sdk-data-store/lib/types'; -import {Accounts} from '@docknetwork/wallet-sdk-wasm/lib/modules/accounts'; +} from '@docknetwork/wallet-sdk-data-store/src/types'; +import {Accounts} from '@docknetwork/wallet-sdk-wasm/src/modules/accounts'; import {EventEmitter} from 'events'; export interface IV1Wallet { diff --git a/packages/core/src/v1-helpers.ts b/packages/core/src/v1-helpers.ts index 7168d929..69b83677 100644 --- a/packages/core/src/v1-helpers.ts +++ b/packages/core/src/v1-helpers.ts @@ -1,10 +1,10 @@ // TODO: [wallet-sdk] Cleanup wallet-sdk unnused wasm services https://dock-team.atlassian.net/browse/DCKA-1658 import {IV1Wallet, IWallet} from './types'; import {createAccountProvider} from './account-provider'; -import {WalletDocument} from '@docknetwork/wallet-sdk-data-store/lib/types'; -import * as walletServiceConfigs from '@docknetwork/wallet-sdk-wasm/lib/services/wallet/configs'; -import {keyringService} from '@docknetwork/wallet-sdk-wasm/lib/services/keyring/index'; -import {walletService} from '@docknetwork/wallet-sdk-wasm/lib/services/wallet'; +import {WalletDocument} from '@docknetwork/wallet-sdk-data-store/src/types'; +import * as walletServiceConfigs from '@docknetwork/wallet-sdk-wasm/src/services/wallet/configs'; +import {keyringService} from '@docknetwork/wallet-sdk-wasm/src/services/keyring/index'; +import {walletService} from '@docknetwork/wallet-sdk-wasm/src/services/wallet'; import {v4 as uuid} from 'uuid'; import {EventEmitter} from 'events'; diff --git a/packages/core/src/wallet-wasm.ts b/packages/core/src/wallet-wasm.ts index 19f59a76..9dd5ba03 100644 --- a/packages/core/src/wallet-wasm.ts +++ b/packages/core/src/wallet-wasm.ts @@ -1,10 +1,10 @@ -import {keyringService} from '@docknetwork/wallet-sdk-wasm/lib/services/keyring'; -import {utilCryptoService} from '@docknetwork/wallet-sdk-wasm/lib/services/util-crypto'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock'; +import {keyringService} from '@docknetwork/wallet-sdk-wasm/src/services/keyring'; +import {utilCryptoService} from '@docknetwork/wallet-sdk-wasm/src/services/util-crypto'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock'; import {IWallet} from './types'; -import {Network} from '@docknetwork/wallet-sdk-data-store/lib/types'; -import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; +import {Network} from '@docknetwork/wallet-sdk-data-store/src/types'; +import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; function isSubstrateNetwork(network: Network) { return !!network.configs.substrateUrl; diff --git a/packages/core/src/wallet.ts b/packages/core/src/wallet.ts index 26724f77..7e86d422 100644 --- a/packages/core/src/wallet.ts +++ b/packages/core/src/wallet.ts @@ -1,9 +1,9 @@ -import {createDataStore} from '@docknetwork/wallet-sdk-data-store/lib'; +import {createDataStore} from '@docknetwork/wallet-sdk-data-store/src'; import { DataStore, DataStoreConfigs, WalletDocument, -} from '@docknetwork/wallet-sdk-data-store/lib/types'; +} from '@docknetwork/wallet-sdk-data-store/src/types'; import { getDocumentsByType, getDocumentById, @@ -13,14 +13,14 @@ import { getAllDocuments, updateDocument, removeAllDocuments, -} from '@docknetwork/wallet-sdk-data-store/lib/entities/document'; +} from '@docknetwork/wallet-sdk-data-store/src/entities/document'; import {CreateWalletProps, IWallet} from './types'; import {toV1Wallet} from './v1-helpers'; import {initWalletWasm} from './wallet-wasm'; import {EventEmitter} from 'events'; -import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; -import {walletService} from '@docknetwork/wallet-sdk-wasm/lib/services/wallet'; -import {importUniversalWalletDocuments} from '@docknetwork/wallet-sdk-data-store/lib/migration/migration1/migrate-v1-data'; +import {WalletEvents} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; +import {walletService} from '@docknetwork/wallet-sdk-wasm/src/services/wallet'; +import {importUniversalWalletDocuments} from '@docknetwork/wallet-sdk-data-store/src/migration/migration1/migrate-v1-data'; export type {IWallet}; function once(emitter: EventEmitter, eventName: string) { diff --git a/packages/credentials/lib/credentials.test.js b/packages/credentials/lib/credentials.test.js index 072c2c19..42234957 100644 --- a/packages/credentials/lib/credentials.test.js +++ b/packages/credentials/lib/credentials.test.js @@ -1,7 +1,7 @@ import {Credentials} from './index'; -import {Wallet} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; +import {Wallet} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; import testCredential from '../fixtures/test-credential.json'; -import {getPromiseError} from '@docknetwork/wallet-sdk-wasm/lib/services/test-utils'; +import {getPromiseError} from '@docknetwork/wallet-sdk-wasm/src/services/test-utils'; import axios from 'axios'; describe('Credentials module', () => { diff --git a/packages/credentials/lib/index.js b/packages/credentials/lib/index.js index f6195892..f551c742 100644 --- a/packages/credentials/lib/index.js +++ b/packages/credentials/lib/index.js @@ -1,5 +1,5 @@ -import {Wallet} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; -import {assert} from '@docknetwork/wallet-sdk-wasm/lib/core/validation'; +import {Wallet} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; +import {assert} from '@docknetwork/wallet-sdk-wasm/src/core/validation'; import axios from 'axios'; import {samplePresentationDefinition} from './samples'; diff --git a/packages/react-native/lib/credentialPresentHooks.js b/packages/react-native/lib/credentialPresentHooks.js index fd3e91a8..cf767347 100644 --- a/packages/react-native/lib/credentialPresentHooks.js +++ b/packages/react-native/lib/credentialPresentHooks.js @@ -1,5 +1,5 @@ import {useCallback, useMemo} from 'react'; -import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/credential'; +import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/credential'; export function usePresentation() { const presentCredentials = useCallback( diff --git a/packages/react-native/lib/credentials/credentialHooks.js b/packages/react-native/lib/credentials/credentialHooks.js index a2e26f18..cb4cf6f6 100644 --- a/packages/react-native/lib/credentials/credentialHooks.js +++ b/packages/react-native/lib/credentials/credentialHooks.js @@ -1,8 +1,8 @@ import {useMemo, useCallback, useState, useEffect} from 'react'; import {useWallet} from '../index'; import assert from 'assert'; -import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/credential'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock'; +import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/credential'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock'; export const CREDENTIAL_STATUS = { INVALID: 1, diff --git a/packages/react-native/lib/credentials/credentialHooks.test.js b/packages/react-native/lib/credentials/credentialHooks.test.js index 45f3e84f..ece49e18 100644 --- a/packages/react-native/lib/credentials/credentialHooks.test.js +++ b/packages/react-native/lib/credentials/credentialHooks.test.js @@ -11,12 +11,12 @@ import { waitFor, } from './credentialHooks'; import {useWallet} from '../index'; -import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/credential'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock'; +import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/credential'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock'; -jest.mock('@docknetwork/wallet-sdk-wasm/lib/services/credential', () => { +jest.mock('@docknetwork/wallet-sdk-wasm/src/services/credential', () => { const originalModule = jest.requireActual( - '@docknetwork/wallet-sdk-wasm/lib/services/credential', + '@docknetwork/wallet-sdk-wasm/src/services/credential', ); const mockFunctions = { verifyCredential: jest.fn(credential => { diff --git a/packages/react-native/lib/didHooks.js b/packages/react-native/lib/didHooks.js index ab90efc5..c083b599 100644 --- a/packages/react-native/lib/didHooks.js +++ b/packages/react-native/lib/didHooks.js @@ -1,5 +1,5 @@ import {useCallback, useMemo} from 'react'; -import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/dids'; +import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/dids'; import {createDIDProvider} from '@docknetwork/wallet-sdk-core/src/did-provider'; import {useWallet} from './index'; diff --git a/packages/react-native/lib/didHooks.test.js b/packages/react-native/lib/didHooks.test.js index 24406a98..afb5bc87 100644 --- a/packages/react-native/lib/didHooks.test.js +++ b/packages/react-native/lib/didHooks.test.js @@ -1,11 +1,11 @@ import {renderHook} from '@testing-library/react-hooks'; import {useDIDManagement} from './didHooks'; import {useWallet} from './index'; -import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/lib/services/dids'; +import {didServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/dids'; -jest.mock('@docknetwork/wallet-sdk-wasm/lib/services/dids', () => { +jest.mock('@docknetwork/wallet-sdk-wasm/src/services/dids', () => { const originalModule = jest.requireActual( - '@docknetwork/wallet-sdk-wasm/lib/services/dids', + '@docknetwork/wallet-sdk-wasm/src/services/dids', ); const mockFunctions = { generateKeyDoc: jest.fn().mockReturnValue({ diff --git a/packages/react-native/lib/index.js b/packages/react-native/lib/index.js index 96d55acf..cc1345e2 100644 --- a/packages/react-native/lib/index.js +++ b/packages/react-native/lib/index.js @@ -1,8 +1,8 @@ -import {setStorage} from '@docknetwork/wallet-sdk-wasm/lib/core/storage'; +import {setStorage} from '@docknetwork/wallet-sdk-wasm/src/core/storage'; import { Wallet, WalletEvents, -} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; +} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; import React, { useCallback, useContext, @@ -15,8 +15,8 @@ import {Platform, View} from 'react-native'; import WebView from 'react-native-webview'; import {WebviewEventHandler} from './message-handler'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import {AccountDetails} from '@docknetwork/wallet-sdk-wasm/lib/modules/account'; -import {DocumentType} from '@docknetwork/wallet-sdk-wasm/lib/types'; +import {AccountDetails} from '@docknetwork/wallet-sdk-wasm/src/modules/account'; +import {DocumentType} from '@docknetwork/wallet-sdk-wasm/src/types'; import './rn-rpc-server'; import {useDIDManagement, useDIDUtils} from './didHooks'; import {usePresentation} from './credentialPresentHooks'; @@ -29,7 +29,7 @@ import { } from './credentials/credentialHooks'; import {getOrCreateWallet} from './wallet'; import debounce from 'lodash.debounce'; -import {setV1LocalStorage} from '@docknetwork/wallet-sdk-data-store/lib/migration/migration1/v1-data-store'; +import {setV1LocalStorage} from '@docknetwork/wallet-sdk-data-store/src/migration/migration1/v1-data-store'; export type WalletSDKContextProps = { wallet: Wallet, status: string, diff --git a/packages/react-native/lib/message-handler.js b/packages/react-native/lib/message-handler.js index bdce6f72..eac8d888 100644 --- a/packages/react-native/lib/message-handler.js +++ b/packages/react-native/lib/message-handler.js @@ -2,9 +2,9 @@ import assert from 'assert'; import { getRpcClient, initRpcClient, -} from '@docknetwork/wallet-sdk-wasm/lib/rpc-client'; +} from '@docknetwork/wallet-sdk-wasm/src/rpc-client'; -import {Logger} from '@docknetwork/wallet-sdk-wasm/lib/core/logger'; +import {Logger} from '@docknetwork/wallet-sdk-wasm/src/core/logger'; import rnRpcServer from './rn-rpc-server'; export class WebviewEventHandler { diff --git a/packages/react-native/lib/message-handler.test.js b/packages/react-native/lib/message-handler.test.js index 4a5c0f4e..20100aa7 100644 --- a/packages/react-native/lib/message-handler.test.js +++ b/packages/react-native/lib/message-handler.test.js @@ -1,4 +1,4 @@ -import {getRpcClient} from '@docknetwork/wallet-sdk-wasm/lib/rpc-client'; +import {getRpcClient} from '@docknetwork/wallet-sdk-wasm/src/rpc-client'; import {WebviewEventHandler} from './message-handler'; import rnRpcServer from './rn-rpc-server'; diff --git a/packages/react-native/lib/rn-rpc-server/index.js b/packages/react-native/lib/rn-rpc-server/index.js index 27f74776..69961ccf 100644 --- a/packages/react-native/lib/rn-rpc-server/index.js +++ b/packages/react-native/lib/rn-rpc-server/index.js @@ -2,7 +2,7 @@ import {JSONRPCServer} from 'json-rpc-2.0'; import { createRpcService, patchRpcServer, -} from '@docknetwork/wallet-sdk-wasm/lib/rpc-util'; +} from '@docknetwork/wallet-sdk-wasm/src/rpc-util'; import {storageService} from './async-storage-service'; import {loggerService} from './logger'; diff --git a/packages/react-native/lib/wallet.ts b/packages/react-native/lib/wallet.ts index 87a5f568..e10dff0b 100644 --- a/packages/react-native/lib/wallet.ts +++ b/packages/react-native/lib/wallet.ts @@ -1,6 +1,6 @@ import {createWallet, IWallet} from '@docknetwork/wallet-sdk-core/src/wallet'; import {dockDocumentNetworkResolver} from '@docknetwork/wallet-sdk-core/src/network-resolver'; -import {DataStoreConfigs} from '@docknetwork/wallet-sdk-data-store/lib/types'; +import {DataStoreConfigs} from '@docknetwork/wallet-sdk-data-store/src/types'; let wallet: IWallet; diff --git a/packages/react-native/sdk-setup.ts b/packages/react-native/sdk-setup.ts index 8f59af2e..17e07056 100644 --- a/packages/react-native/sdk-setup.ts +++ b/packages/react-native/sdk-setup.ts @@ -1,9 +1,9 @@ import { getRpcClient, initRpcClient, -} from '@docknetwork/wallet-sdk-wasm/lib/rpc-client'; -import rpcServer from '@docknetwork/wallet-sdk-wasm/lib/rpc-server'; -import {setStorage} from '@docknetwork/wallet-sdk-wasm/lib/core/storage'; +} from '@docknetwork/wallet-sdk-wasm/src/rpc-client'; +import rpcServer from '@docknetwork/wallet-sdk-wasm/src/rpc-server'; +import {setStorage} from '@docknetwork/wallet-sdk-wasm/src/core/storage'; setStorage(global.localStorage); diff --git a/packages/relay-service/src/did/dids.js b/packages/relay-service/src/did/dids.js index 7d5427ea..2ec926df 100644 --- a/packages/relay-service/src/did/dids.js +++ b/packages/relay-service/src/did/dids.js @@ -1,5 +1,5 @@ import {hexDIDToQualified} from '@docknetwork/sdk/utils/did'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock/service'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock/service'; export async function resolveDID(did, disableCache = false) { // Check if string has no qualifier, if so assume its hex format diff --git a/packages/relay-service/src/index.js b/packages/relay-service/src/index.js index 31f74233..a9adff57 100644 --- a/packages/relay-service/src/index.js +++ b/packages/relay-service/src/index.js @@ -1,7 +1,7 @@ import {isBase64} from '@polkadot/util-crypto'; import assert from 'assert'; import axios from 'axios'; -import {Logger} from '@docknetwork/wallet-sdk-wasm/lib/core/logger'; +import {Logger} from '@docknetwork/wallet-sdk-wasm/src/core/logger'; import { didcommCreateEncrypted, didcommDecrypt, @@ -16,7 +16,7 @@ import { toBase64, } from './payloads'; import jwtDecode from 'jwt-decode'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock/service'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock/service'; let serviceURL = process.env.RELAY_SERVICE_URL || 'https://relay.dock.io'; diff --git a/packages/relay-service/tests/didcomm.test.js b/packages/relay-service/tests/didcomm.test.js index 4efeedd4..da96d641 100644 --- a/packages/relay-service/tests/didcomm.test.js +++ b/packages/relay-service/tests/didcomm.test.js @@ -6,7 +6,7 @@ import { getDerivedAgreementKey, } from '../lib/didcomm'; import {ALICE_KEY_PAIR_DOC, BOB_KEY_PAIR_DOC} from './mock-data'; -import {dockService} from '@docknetwork/wallet-sdk-wasm/lib/services/dock/service'; +import {dockService} from '@docknetwork/wallet-sdk-wasm/src/services/dock/service'; import { DockResolver, DIDKeyResolver, diff --git a/packages/request-logger/lib/request-logger.js b/packages/request-logger/lib/request-logger.js index 70363a36..2892de7d 100644 --- a/packages/request-logger/lib/request-logger.js +++ b/packages/request-logger/lib/request-logger.js @@ -1,4 +1,4 @@ -import {getRealm} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; +import {getRealm} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; import assert from 'assert'; import {v4 as uuidv4} from 'uuid'; export const RequestLogger = (function () { diff --git a/packages/request-logger/tests/request-logger.test.js b/packages/request-logger/tests/request-logger.test.js index 42c2456c..1f3c1170 100644 --- a/packages/request-logger/tests/request-logger.test.js +++ b/packages/request-logger/tests/request-logger.test.js @@ -1,6 +1,6 @@ import {RequestLogger} from '../lib/request-logger'; -import {getRealm} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; -jest.mock('@docknetwork/wallet-sdk-wasm/lib/core/realm', () => { +import {getRealm} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; +jest.mock('@docknetwork/wallet-sdk-wasm/src/core/realm', () => { const realmFunctions = { write: jest.fn(callback => { callback(); diff --git a/packages/scripts/setup-tests.js b/packages/scripts/setup-tests.js index 94804d47..5c660ccb 100644 --- a/packages/scripts/setup-tests.js +++ b/packages/scripts/setup-tests.js @@ -24,4 +24,4 @@ global.navigator = { appVersion: [], }; -require('@docknetwork/wallet-sdk-wasm/lib/setup-tests'); +require('@docknetwork/wallet-sdk-wasm/src/setup-tests'); diff --git a/packages/transactions/lib/schema.js b/packages/transactions/lib/schema.js index b139b08a..7d7c935a 100644 --- a/packages/transactions/lib/schema.js +++ b/packages/transactions/lib/schema.js @@ -1,4 +1,4 @@ -import {addSchema} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; +import {addSchema} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; addSchema({ name: 'Transaction', diff --git a/packages/transactions/lib/transactions.js b/packages/transactions/lib/transactions.js index e882a1d4..ef5513d0 100644 --- a/packages/transactions/lib/transactions.js +++ b/packages/transactions/lib/transactions.js @@ -1,20 +1,20 @@ import './schema'; import assert from 'assert'; -import {DOCK_TOKEN_UNIT} from '@docknetwork/wallet-sdk-wasm/lib/core/format-utils'; +import {DOCK_TOKEN_UNIT} from '@docknetwork/wallet-sdk-wasm/src/core/format-utils'; import BigNumber from 'bignumber.js'; -import {Accounts} from '@docknetwork/wallet-sdk-wasm/lib/modules/accounts'; -import {Account} from '@docknetwork/wallet-sdk-wasm/lib/modules/account'; -import {substrateService} from '@docknetwork/wallet-sdk-wasm/lib/services/substrate'; -import {NetworkManager} from '@docknetwork/wallet-sdk-wasm/lib/modules/network-manager'; -import {getRealm} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; -import {getRpcEventEmitter} from '@docknetwork/wallet-sdk-wasm/lib/events'; +import {Accounts} from '@docknetwork/wallet-sdk-wasm/src/modules/accounts'; +import {Account} from '@docknetwork/wallet-sdk-wasm/src/modules/account'; +import {substrateService} from '@docknetwork/wallet-sdk-wasm/src/services/substrate'; +import {NetworkManager} from '@docknetwork/wallet-sdk-wasm/src/modules/network-manager'; +import {getRealm} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; +import {getRpcEventEmitter} from '@docknetwork/wallet-sdk-wasm/src/events'; import {TransactionDetails} from './transaction'; -import {fetchTransactions} from '@docknetwork/wallet-sdk-wasm/lib/core/subscan'; +import {fetchTransactions} from '@docknetwork/wallet-sdk-wasm/src/core/subscan'; import { isAddressValid, isNumberValid, -} from '@docknetwork/wallet-sdk-wasm/lib/core/validation'; -import {Wallet} from '@docknetwork/wallet-sdk-wasm/lib/modules/wallet'; +} from '@docknetwork/wallet-sdk-wasm/src/core/validation'; +import {Wallet} from '@docknetwork/wallet-sdk-wasm/src/modules/wallet'; export const TransactionStatus = { InProgress: 'pending', diff --git a/packages/transactions/lib/transactions.test.js b/packages/transactions/lib/transactions.test.js index a6c166fc..1759bbb3 100644 --- a/packages/transactions/lib/transactions.test.js +++ b/packages/transactions/lib/transactions.test.js @@ -1,5 +1,5 @@ import {TransactionStatus, Transactions} from './transactions'; -import {getRealm, initRealm} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; +import {getRealm, initRealm} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; const initMockTransactions = () => { const today = new Date(); diff --git a/packages/wasm/src/services/relay-service/service.js b/packages/wasm/src/services/relay-service/service.js index bd1edc40..539bf00d 100644 --- a/packages/wasm/src/services/relay-service/service.js +++ b/packages/wasm/src/services/relay-service/service.js @@ -7,7 +7,7 @@ import { validation, } from './configs'; -import {RelayService as relayServiceClient} from '@docknetwork/wallet-sdk-relay-service/lib'; +import {RelayService as relayServiceClient} from '@docknetwork/wallet-sdk-relay-service/src'; /** * RelayService diff --git a/setup-tests.js b/setup-tests.js index d7d3abb5..35940a41 100644 --- a/setup-tests.js +++ b/setup-tests.js @@ -8,8 +8,8 @@ import Realm from 'realm'; import { initRealm, setRealmInstance, -} from '@docknetwork/wallet-sdk-wasm/lib/core/realm'; -import {mockDockService} from '@docknetwork/wallet-sdk-wasm/lib/services/test-utils'; +} from '@docknetwork/wallet-sdk-wasm/src/core/realm'; +import {mockDockService} from '@docknetwork/wallet-sdk-wasm/src/services/test-utils'; setRealmInstance(Realm); initRealm(); @@ -36,7 +36,7 @@ global.navigator = { appVersion: [], }; -require('@docknetwork/wallet-sdk-wasm/lib/setup-tests'); +require('@docknetwork/wallet-sdk-wasm/src/setup-tests'); jest.mock('@react-native-async-storage/async-storage', () => 'AsyncStorage'); From 3968fe5dfa757f586fe3bff3c4e08a96b2630f69 Mon Sep 17 00:00:00 2001 From: Maycon Mello Date: Wed, 9 Aug 2023 12:36:46 -0300 Subject: [PATCH 2/5] fixing webview module resolution --- packages/react-native/bundler/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-native/bundler/index.js b/packages/react-native/bundler/index.js index 6ad97c79..133f72dd 100644 --- a/packages/react-native/bundler/index.js +++ b/packages/react-native/bundler/index.js @@ -4,7 +4,6 @@ const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); const getWebpackConfig = ({entry, path, filename}) => ({ mode: 'development', - devtool: false, entry, output: { path, @@ -47,15 +46,12 @@ const getWebpackConfig = ({entry, path, filename}) => ({ rules: [ { test: /\.(m|c)?js$/, - exclude: [ - /\/node_modules\/(?!@polkadot|@docknetwork|@digitalbazaar|safe-buffer|readable-stream|@noble|lzutf8|@transmute|@bitauth)/, - ], + exclude: [/\/node_modules\/(?!@polkadot|@docknetwork|@digitalbazaar)/], use: { loader: require.resolve('babel-loader'), options: { presets: ['@babel/preset-env'], plugins: [ - require.resolve('../transform-bigint-to-number.js'), '@babel/plugin-transform-async-to-generator', '@babel/plugin-syntax-bigint', '@babel/plugin-transform-modules-commonjs', From 9ac6cc9ae33ff22e2f8a3b0c6fc33b92380c0119 Mon Sep 17 00:00:00 2001 From: Maycon Mello Date: Wed, 9 Aug 2023 13:34:08 -0300 Subject: [PATCH 3/5] remove holder from bbs presentation --- .../wasm/src/services/credential/service.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/wasm/src/services/credential/service.js b/packages/wasm/src/services/credential/service.js index 6184cdbb..bf2f0b05 100644 --- a/packages/wasm/src/services/credential/service.js +++ b/packages/wasm/src/services/credential/service.js @@ -11,6 +11,17 @@ import {dockService, getDock} from '../dock/service'; const pex: PEX = new PEX(); +export function isBBSPlusCredential(credential) { + return ( + (typeof credential?.proof?.type === 'string' && + credential.proof.type.includes('BBS+SignatureDock')) || + (Array.isArray(credential['@context']) && + credential['@context'].find( + context => context['bs'] && context['bs'].indexOf('bbs') > -1, + )) + ); +} + class CredentialService { constructor() { this.name = serviceName; @@ -60,10 +71,16 @@ class CredentialService { validation.createPresentation(params); const {credentials, keyDoc, challenge, id, domain} = params; const vp = new VerifiablePresentation(id); + let isBBS; for (const signedVC of credentials) { vp.addCredential(signedVC); + isBBS = isBBS || isBBSPlusCredential(signedVC); } - vp.setHolder(keyDoc.controller); + + if (!isBBS) { + vp.setHolder(keyDoc.controller); + } + keyDoc.keypair = keyDocToKeypair(keyDoc, getDock()); return vp.sign(keyDoc, challenge, domain, dockService.resolver); } From 95987fb1471fa39d3fa86d1cb1f1abc1b48d7245 Mon Sep 17 00:00:00 2001 From: Maycon Mello Date: Wed, 9 Aug 2023 13:44:38 -0300 Subject: [PATCH 4/5] remove holder from bbs presentation --- packages/wasm/src/services/credential/service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wasm/src/services/credential/service.js b/packages/wasm/src/services/credential/service.js index bf2f0b05..6b218442 100644 --- a/packages/wasm/src/services/credential/service.js +++ b/packages/wasm/src/services/credential/service.js @@ -17,7 +17,7 @@ export function isBBSPlusCredential(credential) { credential.proof.type.includes('BBS+SignatureDock')) || (Array.isArray(credential['@context']) && credential['@context'].find( - context => context['bs'] && context['bs'].indexOf('bbs') > -1, + context => context.bs && context.bs.indexOf('bbs') > -1, )) ); } From b718a2d214c9f5b210f80637411dbec31a89286b Mon Sep 17 00:00:00 2001 From: Maycon Mello Date: Wed, 9 Aug 2023 13:51:20 -0300 Subject: [PATCH 5/5] fixing tests isues --- setup-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-tests.js b/setup-tests.js index 35940a41..5a54d6d6 100644 --- a/setup-tests.js +++ b/setup-tests.js @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; import {JSDOM} from 'jsdom'; -import {NetworkManager} from './packages/wasm/lib/modules/network-manager'; -import {getStorage} from './packages/wasm/lib/core/storage'; +import {NetworkManager} from './packages/wasm/src/modules/network-manager'; +import {getStorage} from './packages/wasm/src/core/storage'; import './packages/transactions/lib/schema'; import Realm from 'realm'; import {