public void RegisterResponse_FromJson() { RegisterResponse registerResponse = RegisterResponse.FromJson <RegisterResponse>(JsonData); Assert.IsNotNull(registerResponse); Assert.IsNotNull(registerResponse.GetClientData()); Assert.IsNotNull(registerResponse.ToJson()); Assert.IsTrue(registerResponse.GetHashCode() != 0); Assert.AreEqual(JsonData, registerResponse.ToJson()); Assert.AreEqual(TestConts.REGISTRATION_RESPONSE_DATA_BASE64, registerResponse.RegistrationData); Assert.AreEqual(TestConts.CLIENT_DATA_REGISTER_BASE64, registerResponse.ClientData); }
/// <summary> /// Finishes a previously started registration. /// </summary> /// <param name="startedRegistration">started registration response.</param> /// <param name="tokenResponse">tokenResponse the response from the token/client.</param> /// <param name="facets">A list of valid facets to verify against. (note: optional)</param> /// <returns>a DeviceRegistration object, holding information about the registered device. Servers should persist this.</returns> public static DeviceRegistration FinishRegistration(StartedRegistration startedRegistration, RegisterResponse tokenResponse, HashSet <string> facets = null) { ClientData clientData = tokenResponse.GetClientData(); clientData.CheckContent(RegisterType, startedRegistration.Challenge, facets); RawRegisterResponse rawRegisterResponse = RawRegisterResponse.FromBase64(tokenResponse.RegistrationData); rawRegisterResponse.CheckSignature(startedRegistration.AppId, clientData.AsJson()); return(rawRegisterResponse.CreateDevice()); }