Пример #1
0
 /// <summary>
 /// Initializes a ContextBuilder from scratch for a verity-sdk without a provisioned agent on the
 /// verity-application. This involves three main steps. First, a new local wallet is created
 /// using the given wallet config. Second, a new local key-pair is created in the new created wallet that will
 /// be used by the verity-sdk. Third, the verity-application public DID and verkey a retrieved from the
 /// verity-application instance referenced by the given verkey url. After these two step, a given fields are loaded
 /// into a blank ContextBuilder and returned.
 /// </summary>
 /// <param name="walletConfig">the wallet config for accessing the local wallet</param>
 /// <param name="verityUrl">the url for the targeted instance of the verity-application</param>
 /// <param name="seed">the seed used to generate the local key-pair</param>
 /// <return>a ContextBuilder with given, retrieved and created fields</return>
 public static Context fromScratch(WalletConfig walletConfig,
                                   string verityUrl,
                                   string seed)
 {
     WalletUtil.tryCreateWallet(walletConfig);
     return(scratchContext(walletConfig, verityUrl, seed));
 }
Пример #2
0
        public TestWallet(string walletName, string walletKey, string seed)
        {
            try
            {
                walletConfig = DefaultWalletConfig.build(walletName, walletKey);

                WalletUtil.tryCreateWallet(walletConfig);
                Wallet walletHandle = WalletUtil.openIndyWallet(walletConfig);

                Did theirResult = Did.createNewDid(walletHandle);
                this.verityPublicDID    = theirResult.did;
                this.verityPublicVerkey = theirResult.verkey;
                Did theirPairwiseResult = Did.createNewDid(walletHandle);
                this.verityPairwiseVerkey = theirPairwiseResult.verkey;
                this.verityPairwiseDID    = theirPairwiseResult.did;
                Did myPairwiseResult = Did.createNewDid(walletHandle, seed);
                this.sdkPairwiseDID    = myPairwiseResult.did;
                this.sdkPairwiseVerkey = myPairwiseResult.verkey;

                walletHandle.CloseAsync().GetAwaiter().GetResult();
            }
            catch (IndyException e)
            {
                throw new WalletException("Failed to initialize TestWallet", e);
            }
        }
Пример #3
0
 /// <summary>
 /// Initializes a ContextBuilder from scratch for a verity-sdk without a provisioned agent on the
 /// verity-application. This involves three main steps. First, a new local wallet is created
 /// using the given wallet id and key. Second, a new local key-pair is created in the new created wallet that will
 /// be used by the verity-sdk. Third, the verity-application public DID and verkey a retrieved from the
 /// verity-application instance referenced by the given verkey url. After these two step, a given fields are loaded
 /// into a blank ContextBuilder and returned.
 /// </summary>
 /// <param name="walletId">the id for the local wallet</param>
 /// <param name="walletKey">the key (credential) for the local wallet</param>
 /// <param name="verityUrl">the url for the targeted instance of the verity-application</param>
 /// <param name="seed">the seed used to generate the local key-pair</param>
 /// <return>a ContextBuilder with given, retrieved and created fields</return>
 public static Context fromScratch(string walletId,
                                   string walletKey,
                                   string verityUrl,
                                   string seed)
 {
     WalletUtil.tryCreateWallet(walletId, walletKey);
     return(scratchContext(DefaultWalletConfig.build(walletId, walletKey), verityUrl, seed));
 }
Пример #4
0
        /// <summary>
        /// Initializes a ContextBuilder from scratch for a verity-sdk that is using an already provisioned agent on
        /// the verity-application. This involves three main steps. First, a new local wallet is created
        /// using the given wallet config. Second, a new local key-pair is created in the new created wallet that will
        /// be used by the verity-sdk. Third, the verity-application public DID and verkey a retrieved from the
        /// verity-application instance referenced by the given verkey url. After these two step, a given fields are loaded
        /// into a blank ContextBuilder and returned.
        /// </summary>
        /// <param name="walletConfig">the wallet config for accessing the local wallet</param>
        /// <param name="verityUrl">the url for the targeted instance of the verity-application</param>
        /// <param name="domainDID">the domain DID for the agent already provisioned</param>
        /// <param name="verityAgentVerKey">the verkey for the agent already provisioned</param>
        /// <param name="seed">the seed used to generate the local key-pair</param>
        /// <return>a ContextBuilder with given, retrieved and created fields</return>
        public static Context fromScratch(WalletConfig walletConfig,
                                          string verityUrl,
                                          string domainDID,
                                          string verityAgentVerKey,
                                          string seed)
        {
            WalletUtil.tryCreateWallet(walletConfig);
            Context inter = scratchContext(walletConfig, verityUrl, seed);

            return(withProvisionedAgent(inter, domainDID, verityAgentVerKey));
        }
Пример #5
0
        /// <summary>
        /// Initializes a ContextBuilder from scratch for a verity-sdk that is using an already provisioned agent on
        /// the verity-application. This involves three main steps. First, a new local wallet is created
        /// using the given wallet id and key. Second, a new local key-pair is created in the new created wallet that will
        /// be used by the verity-sdk. Third, the verity-application public DID and verkey a retrieved from the
        /// verity-application instance referenced by the given verkey url. After these two step, a given fields are loaded
        /// into a blank ContextBuilder and returned.
        /// </summary>
        /// <param name="walletId">the id for the local wallet</param>
        /// <param name="walletKey">the key (credential) for the local wallet</param>
        /// <param name="verityUrl">the url for the targeted instance of the verity-application</param>
        /// <param name="domainDID">the domain DID for the agent already provisioned</param>
        /// <param name="verityAgentVerKey">the verkey for the agent already provisioned</param>
        /// <param name="seed">the seed used to generate the local key-pair</param>
        /// <param name="walletPath">custom path where libindy wallet should be stored (default is ~/.indy_client/wallet/)</param>
        /// <return>a ContextBuilder with given, retrieved and created fields</return>
        public static Context fromScratch(string walletId,
                                          string walletKey,
                                          string verityUrl,
                                          string domainDID,
                                          string verityAgentVerKey,
                                          string seed,
                                          string walletPath)
        {
            WalletUtil.tryCreateWallet(walletId, walletKey, walletPath);
            Context inter = scratchContext(DefaultWalletConfig.build(walletId, walletKey, walletPath), verityUrl, seed);

            return(withProvisionedAgent(inter, domainDID, verityAgentVerKey));
        }