Validate() публичный Метод

Check to see if an account name is acceptable for use at a portal. Note that a positive response to a validation request does not guarantee that the account name will be available for a subsequent call to CreatePersonalProfile.
public Validate ( string Account ) : ValidateResponse
Account string The requested account name.
Результат ValidateResponse
Пример #1
0
        /// <summary>
        /// Attempt to create an account at the specified portal.
        /// </summary>
        /// <param name="Portal"></param>
        /// <param name="Account"></param>
        /// <returns>true if succeeded, false otherwise.</returns>
        public bool TryNewPortalAccount(string Portal, string Account) {
            Portal = (Portal == null) || (Portal == "") ? "mesh.prismproof.org" : Portal;


            this.Portal = Portal;
            this.AccountName = Account;

            MeshClient = new MeshClient(Portal);


            var ValidateResponse = MeshClient.Validate(AccountID);

            if (!ValidateResponse.Valid) {
                InvalidInput = ValidateResponse.Reason;
                }

            return ValidateResponse.Valid;
            }
Пример #2
0
        public void MeshStoreAPI() {

            if (DoLocal) {
                File.Delete(Store);
                File.Delete(Portal);
                MeshPortal.Default = new MeshPortalDirect(Store, Portal);
                }
            else {
                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;
                }


            MeshClient1 = new MeshClient(Service);
            var valid = MeshClient1.Validate(AccountID);
            if (!valid.Status.StatusSuccess()) {
                Console.WriteLine("Validate failed");
                }

            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);
            var SignedProfile = UserProfile.Signed;

            MeshClient1.CreatePersonalProfile(AccountID, SignedProfile);

            // Create a password profile
            //var PasswordProfile = new PasswordProfile(UserProfile);
            //var SignedPasswordProfile = PasswordProfile.Signed;
            //SignedProfile = UserProfile.Signed;

            //MeshClient1.Publish(SignedPasswordProfile);
            //MeshClient1.Publish(SignedProfile);


            MeshClient2 = new MeshClient(Service, AccountID);
            MeshClient2.SignedDeviceProfile = DevProfile;
            MeshClient2.GetPersonalProfile();

            // Read back the password profile and add entry 
            var AccountPasswordProfile = MeshClient2.GetPasswordProfile();
            AccountPasswordProfile.Add(PWDSite, PWDUser, PWDPassword);
            var AccountSignedPassword = AccountPasswordProfile.Signed;



            // Publish updates to both profiles.
            MeshClient2.Publish(AccountSignedPassword);

            // Create a new device profile.
            var DevProfile2 = new SignedDeviceProfile(Device2, Device2Description);

            MeshClient3 = new MeshClient(Service, AccountID);

            MeshClient3.ConnectRequest(DevProfile2);
            MeshClient2.ConnectStatus(DevProfile2.UniqueID);

            var PendingResponse = MeshClient1.ConnectPending();

            foreach (var Request in PendingResponse.Pending) {
                MeshClient1.ConnectClose(Request, ConnectionStatus.Accepted);
                }

            MeshClient3.ConnectStatus(DevProfile2.UniqueID);

            MeshClient3.GetPasswordProfile();

            }