@docknetwork/wallet-sdk-web 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/wallet-sdk-web.esm.js +331 -85
- package/dist/wallet-sdk-web.iife.js +331 -85
- package/package.json +1 -1
- package/src/index.js +307 -77
package/README.md
CHANGED
|
@@ -18,6 +18,14 @@ or via CDN:
|
|
|
18
18
|
|
|
19
19
|
The SDK can be used via a global variable (Script Tag) or imported as an ES Module (Bundlers).
|
|
20
20
|
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> This SDK is designed for **browser-side use only**.
|
|
23
|
+
|
|
24
|
+
1. **Client-Side Only**: Your wallet keys (mnemonic/master key) decrypt your data locally in the browser. **Never** send these keys to a server or store them where they can be accessed by third parties.
|
|
25
|
+
2. **No Server-Side Operations**: Do not use this SDK to initialize wallets or process keys on a backend server. Server-side handling of user keys creates significant security risks and breaks the non-custodial model.
|
|
26
|
+
3. **End-to-End Encryption**: User data stored in the Cloud Wallet (EDV) is fully encrypted. The decryption key exists *only* in the user's browser session.
|
|
27
|
+
4. **Authentication vs Encryption**: The `edvAuthKey` is strictly for authenticating the client with the storage server. It does **not** grant access to the encrypted data content; only the user's keys can do that. You can request an `edvAuthKey` by contacting Truvera support at [docs.truvera.io/support](https://docs.truvera.io/support).
|
|
28
|
+
|
|
21
29
|
### 1. Script Tag (Global)
|
|
22
30
|
|
|
23
31
|
When loaded via `<script>`, the SDK exposes a global variable `TruveraWebWallet`.
|
|
@@ -44,6 +52,8 @@ async function main() {
|
|
|
44
52
|
}
|
|
45
53
|
```
|
|
46
54
|
|
|
55
|
+
|
|
56
|
+
|
|
47
57
|
### Key Generation (Optional)
|
|
48
58
|
|
|
49
59
|
If you don't have a mnemonic, you can generate a new master key/mnemonic pair using the SDK:
|
|
@@ -560555,140 +560555,386 @@ function createVerificationController(_ref) {
|
|
|
560555
560555
|
};
|
|
560556
560556
|
}
|
|
560557
560557
|
|
|
560558
|
+
/**
|
|
560559
|
+
* @fileoverview Dock Wallet SDK for Web
|
|
560560
|
+
*
|
|
560561
|
+
* This module provides a simplified interface for initializing and working with
|
|
560562
|
+
* the Dock Wallet SDK in web environments. It includes functions for managing
|
|
560563
|
+
* DIDs, credentials, presentations, and cloud wallet synchronization.
|
|
560564
|
+
*
|
|
560565
|
+
* @module @docknetwork/wallet-sdk-web
|
|
560566
|
+
*/
|
|
560567
|
+
|
|
560568
|
+
|
|
560569
|
+
/**
|
|
560570
|
+
* Initializes the Dock Wallet SDK with the provided configuration.
|
|
560571
|
+
*
|
|
560572
|
+
* This function sets up all necessary wallet providers and establishes a connection
|
|
560573
|
+
* to the cloud wallet for synchronization. It requires either a master key or mnemonic
|
|
560574
|
+
* for wallet recovery, but not both.
|
|
560575
|
+
*
|
|
560576
|
+
* @async
|
|
560577
|
+
* @param {Object} config - Configuration object for wallet initialization
|
|
560578
|
+
* @param {string} config.edvUrl - The Encrypted Data Vault (EDV) URL for cloud storage
|
|
560579
|
+
* @param {string} config.edvAuthKey - Authentication key for accessing the EDV
|
|
560580
|
+
* @param {string} [config.masterKey] - Master key for wallet access (required if mnemonic is not provided)
|
|
560581
|
+
* @param {string} [config.mnemonic] - BIP39 mnemonic for wallet recovery (required if masterKey is not provided)
|
|
560582
|
+
* @param {string} config.networkId - Network identifier ('testnet' or 'mainnet')
|
|
560583
|
+
* @param {string} [config.databasePath='truvera-web-wallet'] - Optional path for the local database
|
|
560584
|
+
*
|
|
560585
|
+
* @returns {Promise<Object>} Initialized wallet object with the following properties:
|
|
560586
|
+
* @returns {Object} returns.wallet - Core wallet instance
|
|
560587
|
+
* @returns {Object} returns.messageProvider - Provider for handling wallet messages
|
|
560588
|
+
* @returns {Object} returns.cloudWallet - Cloud wallet instance for synchronization
|
|
560589
|
+
* @returns {Object} returns.didProvider - Provider for DID operations
|
|
560590
|
+
* @returns {Object} returns.credentialProvider - Provider for credential operations
|
|
560591
|
+
* @returns {Function} returns.getCredentials - Function to retrieve all credentials
|
|
560592
|
+
* @returns {Function} returns.addCredential - Function to import a credential from an offer URI
|
|
560593
|
+
* @returns {Function} returns.getDID - Function to get the default DID
|
|
560594
|
+
* @returns {Function} returns.submitPresentation - Function to create and submit a presentation
|
|
560595
|
+
*
|
|
560596
|
+
* @throws {Error} When neither masterKey nor mnemonic is provided
|
|
560597
|
+
* @throws {Error} When both masterKey and mnemonic are provided
|
|
560598
|
+
* @throws {Error} When edvUrl is not provided
|
|
560599
|
+
* @throws {Error} When edvAuthKey is not provided
|
|
560600
|
+
* @throws {Error} When networkId is not provided
|
|
560601
|
+
* @throws {Error} When networkId is not 'testnet' or 'mainnet'
|
|
560602
|
+
* @throws {Error} When wallet initialization fails
|
|
560603
|
+
* @throws {Error} When cloud wallet initialization fails
|
|
560604
|
+
*
|
|
560605
|
+
* @example
|
|
560606
|
+
* // Initialize with mnemonic
|
|
560607
|
+
* const wallet = await initialize({
|
|
560608
|
+
* edvUrl: 'https://edv.example.com',
|
|
560609
|
+
* edvAuthKey: 'your-auth-key',
|
|
560610
|
+
* mnemonic: 'your twelve word mnemonic phrase here...',
|
|
560611
|
+
* networkId: 'testnet'
|
|
560612
|
+
* });
|
|
560613
|
+
*
|
|
560614
|
+
* @example
|
|
560615
|
+
* // Initialize with master key
|
|
560616
|
+
* const wallet = await initialize({
|
|
560617
|
+
* edvUrl: 'https://edv.example.com',
|
|
560618
|
+
* edvAuthKey: 'your-auth-key',
|
|
560619
|
+
* masterKey: 'your-master-key',
|
|
560620
|
+
* networkId: 'mainnet',
|
|
560621
|
+
* databasePath: 'custom-wallet-db'
|
|
560622
|
+
* });
|
|
560623
|
+
*/
|
|
560558
560624
|
async function initialize(_ref) {
|
|
560559
560625
|
let {
|
|
560560
560626
|
edvUrl,
|
|
560561
560627
|
edvAuthKey,
|
|
560562
|
-
networkId,
|
|
560563
560628
|
masterKey,
|
|
560564
|
-
mnemonic
|
|
560629
|
+
mnemonic,
|
|
560630
|
+
networkId,
|
|
560631
|
+
databasePath
|
|
560565
560632
|
} = _ref;
|
|
560633
|
+
// Validate required parameters
|
|
560566
560634
|
if (!masterKey && !mnemonic) {
|
|
560567
|
-
throw new Error('
|
|
560635
|
+
throw new Error('Initialization failed: Either masterKey or mnemonic must be provided for wallet access');
|
|
560568
560636
|
}
|
|
560569
560637
|
if (masterKey && mnemonic) {
|
|
560570
|
-
throw new Error('
|
|
560638
|
+
throw new Error('Initialization failed: Cannot provide both masterKey and mnemonic. Please use only one authentication method');
|
|
560571
560639
|
}
|
|
560572
560640
|
if (!edvUrl) {
|
|
560573
|
-
throw new Error('
|
|
560641
|
+
throw new Error('Initialization failed: edvUrl is required. Please provide a valid Encrypted Data Vault URL');
|
|
560642
|
+
}
|
|
560643
|
+
if (typeof edvUrl !== 'string' || !edvUrl.trim()) {
|
|
560644
|
+
throw new Error('Initialization failed: edvUrl must be a non-empty string');
|
|
560574
560645
|
}
|
|
560575
560646
|
if (!edvAuthKey) {
|
|
560576
|
-
throw new Error('
|
|
560647
|
+
throw new Error('Initialization failed: edvAuthKey is required for EDV authentication');
|
|
560648
|
+
}
|
|
560649
|
+
if (typeof edvAuthKey !== 'string' || !edvAuthKey.trim()) {
|
|
560650
|
+
throw new Error('Initialization failed: edvAuthKey must be a non-empty string');
|
|
560577
560651
|
}
|
|
560578
560652
|
if (!networkId) {
|
|
560579
|
-
throw new Error('
|
|
560653
|
+
throw new Error('Initialization failed: networkId is required. Must be either "testnet" or "mainnet"');
|
|
560580
560654
|
}
|
|
560581
|
-
|
|
560582
|
-
|
|
560583
|
-
|
|
560584
|
-
|
|
560585
|
-
|
|
560586
|
-
|
|
560587
|
-
|
|
560588
|
-
|
|
560589
|
-
|
|
560590
|
-
|
|
560591
|
-
|
|
560592
|
-
})
|
|
560593
|
-
|
|
560594
|
-
|
|
560595
|
-
|
|
560596
|
-
|
|
560597
|
-
|
|
560598
|
-
|
|
560599
|
-
wallet
|
|
560600
|
-
|
|
560601
|
-
|
|
560602
|
-
|
|
560655
|
+
if (networkId !== 'testnet' && networkId !== 'mainnet') {
|
|
560656
|
+
throw new Error("Initialization failed: Invalid networkId \"".concat(networkId, "\". Must be either \"testnet\" or \"mainnet\""));
|
|
560657
|
+
}
|
|
560658
|
+
|
|
560659
|
+
// Initialize data store
|
|
560660
|
+
let dataStore;
|
|
560661
|
+
try {
|
|
560662
|
+
dataStore = await createDataStore({
|
|
560663
|
+
databasePath: databasePath || 'truvera-web-wallet',
|
|
560664
|
+
defaultNetwork: networkId
|
|
560665
|
+
});
|
|
560666
|
+
} catch (error) {
|
|
560667
|
+
throw new Error("Failed to create data store: ".concat(error.message));
|
|
560668
|
+
}
|
|
560669
|
+
|
|
560670
|
+
// Initialize wallet
|
|
560671
|
+
let wallet;
|
|
560672
|
+
try {
|
|
560673
|
+
wallet = await createWallet({
|
|
560674
|
+
dataStore
|
|
560675
|
+
});
|
|
560676
|
+
} catch (error) {
|
|
560677
|
+
throw new Error("Failed to create wallet: ".concat(error.message));
|
|
560678
|
+
}
|
|
560679
|
+
|
|
560680
|
+
// Initialize providers
|
|
560681
|
+
let didProvider, credentialProvider, messageProvider;
|
|
560682
|
+
try {
|
|
560683
|
+
didProvider = createDIDProvider({
|
|
560684
|
+
wallet
|
|
560685
|
+
});
|
|
560686
|
+
credentialProvider = await createCredentialProvider({
|
|
560687
|
+
wallet
|
|
560688
|
+
});
|
|
560689
|
+
messageProvider = createMessageProvider({
|
|
560690
|
+
wallet,
|
|
560691
|
+
didProvider
|
|
560692
|
+
});
|
|
560693
|
+
} catch (error) {
|
|
560694
|
+
throw new Error("Failed to initialize wallet providers: ".concat(error.message));
|
|
560695
|
+
}
|
|
560696
|
+
|
|
560697
|
+
// Recover or set master key
|
|
560603
560698
|
if (mnemonic) {
|
|
560604
|
-
|
|
560605
|
-
|
|
560606
|
-
|
|
560607
|
-
|
|
560608
|
-
|
|
560699
|
+
try {
|
|
560700
|
+
masterKey = await recoverCloudWalletMasterKey(mnemonic);
|
|
560701
|
+
} catch (error) {
|
|
560702
|
+
throw new Error("Failed to recover master key from mnemonic: ".concat(error.message));
|
|
560703
|
+
}
|
|
560609
560704
|
}
|
|
560610
|
-
|
|
560611
|
-
|
|
560612
|
-
|
|
560613
|
-
masterKey: masterKey,
|
|
560614
|
-
authKey: edvAuthKey
|
|
560615
|
-
});
|
|
560616
|
-
console.log('Cloud wallet created');
|
|
560617
|
-
console.log(credentialProvider);
|
|
560705
|
+
|
|
560706
|
+
// Initialize cloud wallet
|
|
560707
|
+
let cloudWallet;
|
|
560618
560708
|
try {
|
|
560619
|
-
|
|
560620
|
-
|
|
560621
|
-
|
|
560709
|
+
cloudWallet = await initializeCloudWallet({
|
|
560710
|
+
dataStore: dataStore,
|
|
560711
|
+
edvUrl: edvUrl,
|
|
560712
|
+
masterKey: masterKey,
|
|
560713
|
+
authKey: edvAuthKey
|
|
560714
|
+
});
|
|
560715
|
+
} catch (error) {
|
|
560716
|
+
throw new Error("Failed to initialize cloud wallet: ".concat(error.message));
|
|
560717
|
+
}
|
|
560718
|
+
|
|
560719
|
+
// Pull documents from cloud (non-critical operation)
|
|
560720
|
+
try {
|
|
560721
|
+
await cloudWallet.pullDocuments();
|
|
560722
|
+
} catch (error) {
|
|
560723
|
+
console.warn('Warning: Failed to pull documents from cloud wallet. You may need to sync manually.', error.message);
|
|
560622
560724
|
}
|
|
560623
560725
|
return {
|
|
560624
|
-
// Simplified API for common use cases
|
|
560625
560726
|
wallet,
|
|
560727
|
+
messageProvider,
|
|
560728
|
+
cloudWallet,
|
|
560729
|
+
didProvider,
|
|
560730
|
+
credentialProvider,
|
|
560626
560731
|
/**
|
|
560627
|
-
*
|
|
560628
|
-
*
|
|
560732
|
+
* Retrieves all credentials stored in the wallet.
|
|
560733
|
+
*
|
|
560734
|
+
* @async
|
|
560735
|
+
* @returns {Promise<Array>} Array of credential objects
|
|
560736
|
+
* @throws {Error} When credential retrieval fails
|
|
560737
|
+
*
|
|
560738
|
+
* @example
|
|
560739
|
+
* const credentials = await wallet.getCredentials();
|
|
560740
|
+
* console.log(`Found ${credentials.length} credentials`);
|
|
560629
560741
|
*/
|
|
560630
560742
|
getCredentials: async () => {
|
|
560631
|
-
|
|
560743
|
+
try {
|
|
560744
|
+
return await credentialProvider.getCredentials();
|
|
560745
|
+
} catch (error) {
|
|
560746
|
+
throw new Error("Failed to retrieve credentials: ".concat(error.message));
|
|
560747
|
+
}
|
|
560632
560748
|
},
|
|
560633
560749
|
/**
|
|
560634
|
-
*
|
|
560635
|
-
*
|
|
560636
|
-
* @
|
|
560750
|
+
* Imports a credential using an OpenID4VC (OID4VCI) offer URI.
|
|
560751
|
+
*
|
|
560752
|
+
* @async
|
|
560753
|
+
* @param {string} uri - The credential offer URI (e.g., openid-credential-offer://...)
|
|
560754
|
+
* @returns {Promise<Object>} The imported credential object
|
|
560755
|
+
* @throws {Error} When the URI is invalid or credential import fails
|
|
560756
|
+
*
|
|
560757
|
+
* @example
|
|
560758
|
+
* const credential = await wallet.addCredential('openid-credential-offer://...');
|
|
560759
|
+
* console.log('Credential imported:', credential.id);
|
|
560637
560760
|
*/
|
|
560638
560761
|
addCredential: async uri => {
|
|
560639
|
-
|
|
560640
|
-
|
|
560641
|
-
|
|
560642
|
-
|
|
560762
|
+
if (!uri || typeof uri !== 'string') {
|
|
560763
|
+
throw new Error('Invalid credential offer URI: URI must be a non-empty string');
|
|
560764
|
+
}
|
|
560765
|
+
try {
|
|
560766
|
+
return await credentialProvider.importCredentialFromURI({
|
|
560767
|
+
uri,
|
|
560768
|
+
didProvider
|
|
560769
|
+
});
|
|
560770
|
+
} catch (error) {
|
|
560771
|
+
throw new Error("Failed to import credential from URI: ".concat(error.message));
|
|
560772
|
+
}
|
|
560643
560773
|
},
|
|
560644
560774
|
/**
|
|
560645
|
-
*
|
|
560646
|
-
*
|
|
560775
|
+
* Retrieves the default DID (Decentralized Identifier) for the wallet.
|
|
560776
|
+
*
|
|
560777
|
+
* @async
|
|
560778
|
+
* @returns {Promise<string>} The default DID string
|
|
560779
|
+
* @throws {Error} When DID retrieval fails or no DID exists
|
|
560780
|
+
*
|
|
560781
|
+
* @example
|
|
560782
|
+
* const did = await wallet.getDID();
|
|
560783
|
+
* console.log('Default DID:', did);
|
|
560647
560784
|
*/
|
|
560648
560785
|
getDID: async () => {
|
|
560649
|
-
|
|
560786
|
+
try {
|
|
560787
|
+
return await didProvider.getDefaultDID();
|
|
560788
|
+
} catch (error) {
|
|
560789
|
+
throw new Error("Failed to retrieve default DID: ".concat(error.message));
|
|
560790
|
+
}
|
|
560650
560791
|
},
|
|
560651
560792
|
/**
|
|
560652
|
-
*
|
|
560653
|
-
*
|
|
560654
|
-
*
|
|
560655
|
-
*
|
|
560656
|
-
*
|
|
560793
|
+
* Creates and submits a verifiable presentation for the given credentials and proof request.
|
|
560794
|
+
*
|
|
560795
|
+
* This function processes a proof request from a verifier, selects the specified credentials,
|
|
560796
|
+
* creates a presentation with the requested attributes, and submits it to the verifier.
|
|
560797
|
+
*
|
|
560798
|
+
* @async
|
|
560799
|
+
* @param {Object} config - Configuration object for presentation submission
|
|
560800
|
+
* @param {Array<Object>} config.credentials - Array of credential objects to include in the presentation
|
|
560801
|
+
* @param {string} config.credentials[].id - The credential ID
|
|
560802
|
+
* @param {Object} config.credentials[].attributesToReveal - Map of attribute names to reveal
|
|
560803
|
+
* @param {Array<string>} config.credentials[].attributesToReveal - Array of attribute names to reveal from this credential
|
|
560804
|
+
* @param {string} config.proofRequestUrl - URL to the proof request template from the verifier
|
|
560805
|
+
*
|
|
560806
|
+
* @returns {Promise<Object>} The submission response from the verifier
|
|
560807
|
+
* @throws {Error} When credentials array is empty or invalid
|
|
560808
|
+
* @throws {Error} When proofRequestUrl is invalid
|
|
560809
|
+
* @throws {Error} When verification controller fails to start
|
|
560810
|
+
* @throws {Error} When presentation creation fails
|
|
560811
|
+
* @throws {Error} When presentation submission fails
|
|
560812
|
+
*
|
|
560657
560813
|
* @example
|
|
560658
|
-
*
|
|
560659
|
-
*
|
|
560660
|
-
*
|
|
560661
|
-
*
|
|
560662
|
-
*
|
|
560814
|
+
* // Submit a presentation with selective disclosure
|
|
560815
|
+
* const result = await wallet.submitPresentation({
|
|
560816
|
+
* credentials: [
|
|
560817
|
+
* {
|
|
560818
|
+
* id: 'credential-123',
|
|
560819
|
+
* attributesToReveal: ['name', 'dateOfBirth']
|
|
560820
|
+
* },
|
|
560821
|
+
* {
|
|
560822
|
+
* id: 'credential-456',
|
|
560823
|
+
* attributesToReveal: ['email']
|
|
560824
|
+
* }
|
|
560825
|
+
* ],
|
|
560826
|
+
* proofRequestUrl: 'https://verifier.example.com/proof-request/abc123'
|
|
560663
560827
|
* });
|
|
560664
|
-
* @returns
|
|
560665
560828
|
*/
|
|
560666
560829
|
submitPresentation: async _ref2 => {
|
|
560667
560830
|
let {
|
|
560668
|
-
// Map of credential id with attributesToReveal object
|
|
560669
560831
|
credentials,
|
|
560670
|
-
// Proof request URL should be a valid URL to a proof request template
|
|
560671
560832
|
proofRequestUrl
|
|
560672
560833
|
} = _ref2;
|
|
560673
|
-
|
|
560674
|
-
|
|
560675
|
-
|
|
560676
|
-
|
|
560677
|
-
|
|
560678
|
-
|
|
560679
|
-
|
|
560680
|
-
|
|
560834
|
+
// Validate inputs
|
|
560835
|
+
if (!credentials || !Array.isArray(credentials) || credentials.length === 0) {
|
|
560836
|
+
throw new Error('Invalid credentials: Must provide a non-empty array of credentials');
|
|
560837
|
+
}
|
|
560838
|
+
if (!proofRequestUrl || typeof proofRequestUrl !== 'string') {
|
|
560839
|
+
throw new Error('Invalid proofRequestUrl: Must be a valid URL string');
|
|
560840
|
+
}
|
|
560841
|
+
|
|
560842
|
+
// Validate each credential
|
|
560681
560843
|
for (const credential of credentials) {
|
|
560682
|
-
|
|
560683
|
-
credential: credential
|
|
560684
|
-
|
|
560844
|
+
if (!credential.id) {
|
|
560845
|
+
throw new Error('Invalid credential: Each credential must have an id property');
|
|
560846
|
+
}
|
|
560847
|
+
if (!credential.attributesToReveal) {
|
|
560848
|
+
throw new Error("Invalid credential ".concat(credential.id, ": Missing attributesToReveal property"));
|
|
560849
|
+
}
|
|
560850
|
+
}
|
|
560851
|
+
let verificationController;
|
|
560852
|
+
try {
|
|
560853
|
+
verificationController = createVerificationController({
|
|
560854
|
+
wallet,
|
|
560855
|
+
credentialProvider,
|
|
560856
|
+
didProvider
|
|
560685
560857
|
});
|
|
560858
|
+
} catch (error) {
|
|
560859
|
+
throw new Error("Failed to create verification controller: ".concat(error.message));
|
|
560860
|
+
}
|
|
560861
|
+
try {
|
|
560862
|
+
await verificationController.start({
|
|
560863
|
+
template: proofRequestUrl
|
|
560864
|
+
});
|
|
560865
|
+
} catch (error) {
|
|
560866
|
+
throw new Error("Failed to start verification with proof request: ".concat(error.message));
|
|
560867
|
+
}
|
|
560868
|
+
|
|
560869
|
+
// Select credentials and attributes to reveal
|
|
560870
|
+
try {
|
|
560871
|
+
for (const credential of credentials) {
|
|
560872
|
+
verificationController.selectedCredentials.set(credential.id, {
|
|
560873
|
+
credential: credential,
|
|
560874
|
+
attributesToReveal: credential.attributesToReveal
|
|
560875
|
+
});
|
|
560876
|
+
}
|
|
560877
|
+
} catch (error) {
|
|
560878
|
+
throw new Error("Failed to select credentials: ".concat(error.message));
|
|
560879
|
+
}
|
|
560880
|
+
let presentation;
|
|
560881
|
+
try {
|
|
560882
|
+
presentation = await verificationController.createPresentation();
|
|
560883
|
+
} catch (error) {
|
|
560884
|
+
throw new Error("Failed to create presentation: ".concat(error.message));
|
|
560885
|
+
}
|
|
560886
|
+
try {
|
|
560887
|
+
return await verificationController.submitPresentation(presentation);
|
|
560888
|
+
} catch (error) {
|
|
560889
|
+
throw new Error("Failed to submit presentation: ".concat(error.message));
|
|
560686
560890
|
}
|
|
560687
|
-
const presentation = await verificationController.createPresentation();
|
|
560688
|
-
return await verificationController.submitPresentation(presentation);
|
|
560689
560891
|
}
|
|
560690
560892
|
};
|
|
560691
560893
|
}
|
|
560894
|
+
|
|
560895
|
+
/**
|
|
560896
|
+
* Dock Wallet SDK - Web Module
|
|
560897
|
+
*
|
|
560898
|
+
* Provides a comprehensive SDK for building decentralized identity wallets in web applications.
|
|
560899
|
+
* Includes high-level initialization functions and low-level building blocks for custom implementations.
|
|
560900
|
+
*
|
|
560901
|
+
* @namespace DockWalletSDK
|
|
560902
|
+
*
|
|
560903
|
+
* @property {Function} initialize - High-level function to initialize a complete wallet with all providers
|
|
560904
|
+
* @property {Function} createDataStore - Create a data store for wallet data persistence
|
|
560905
|
+
* @property {Function} createWallet - Create a core wallet instance
|
|
560906
|
+
* @property {Function} createCredentialProvider - Create a provider for credential management
|
|
560907
|
+
* @property {Function} createDIDProvider - Create a provider for DID operations
|
|
560908
|
+
* @property {Function} createMessageProvider - Create a provider for wallet messaging
|
|
560909
|
+
* @property {Function} initializeCloudWallet - Initialize cloud wallet synchronization
|
|
560910
|
+
* @property {Function} generateCloudWalletMasterKey - Generate a new master key for cloud wallet
|
|
560911
|
+
* @property {Function} recoverCloudWalletMasterKey - Recover master key from a BIP39 mnemonic
|
|
560912
|
+
* @property {Function} createVerificationController - Create a controller for verification presentations
|
|
560913
|
+
*
|
|
560914
|
+
* @example
|
|
560915
|
+
* // Quick start - use the high-level initialize function
|
|
560916
|
+
* import WalletSDK from '@docknetwork/wallet-sdk-web';
|
|
560917
|
+
*
|
|
560918
|
+
* const wallet = await WalletSDK.initialize({
|
|
560919
|
+
* edvUrl: 'https://edv.dock.io',
|
|
560920
|
+
* edvAuthKey: 'your-auth-key',
|
|
560921
|
+
* mnemonic: 'your mnemonic phrase...',
|
|
560922
|
+
* networkId: 'testnet'
|
|
560923
|
+
* });
|
|
560924
|
+
*
|
|
560925
|
+
* @example
|
|
560926
|
+
* // Advanced usage - build custom wallet with individual components
|
|
560927
|
+
* import WalletSDK from '@docknetwork/wallet-sdk-web';
|
|
560928
|
+
*
|
|
560929
|
+
* const dataStore = await WalletSDK.createDataStore({
|
|
560930
|
+
* databasePath: 'my-wallet',
|
|
560931
|
+
* defaultNetwork: 'mainnet'
|
|
560932
|
+
* });
|
|
560933
|
+
*
|
|
560934
|
+
* const wallet = await WalletSDK.createWallet({ dataStore });
|
|
560935
|
+
* const didProvider = WalletSDK.createDIDProvider({ wallet });
|
|
560936
|
+
* // ... configure additional providers as needed
|
|
560937
|
+
*/
|
|
560692
560938
|
var index = {
|
|
560693
560939
|
initialize,
|
|
560694
560940
|
createDataStore,
|