@@ -69,11 +69,20 @@ var testUser = &UserRecord{
6969 MultiFactor : & MultiFactorSettings {
7070 EnrolledFactors : []* MultiFactorInfo {
7171 {
72- UID : "0aaded3f-5e73-461d-aef9-37b48e3769be " ,
72+ UID : "enrolledFactor1 " ,
7373 FactorID : "phone" ,
7474 EnrollmentTimestamp : 1614776780000 ,
75- PhoneNumber : "+1234567890" ,
76- DisplayName : "My MFA Phone" ,
75+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
76+ PhoneNumber : "+1234567890" ,
77+ },
78+ DisplayName : "My MFA Phone" ,
79+ },
80+ {
81+ UID : "enrolledFactor2" ,
82+ FactorID : "totp" ,
83+ EnrollmentTimestamp : 1614776780000 ,
84+ TOTPMultiFactorInfo : & TOTPInfo {},
85+ DisplayName : "My MFA TOTP" ,
7786 },
7887 },
7988 },
@@ -646,8 +655,10 @@ func TestInvalidCreateUser(t *testing.T) {
646655 (& UserToCreate {}).MFASettings (MultiFactorSettings {
647656 EnrolledFactors : []* MultiFactorInfo {
648657 {
649- UID : "EnrollmentID" ,
650- PhoneNumber : "+11234567890" ,
658+ UID : "EnrollmentID" ,
659+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
660+ PhoneNumber : "+11234567890" ,
661+ },
651662 DisplayName : "Spouse's phone number" ,
652663 FactorID : "phone" ,
653664 },
@@ -658,7 +669,9 @@ func TestInvalidCreateUser(t *testing.T) {
658669 (& UserToCreate {}).MFASettings (MultiFactorSettings {
659670 EnrolledFactors : []* MultiFactorInfo {
660671 {
661- PhoneNumber : "invalid" ,
672+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
673+ PhoneNumber : "invalid" ,
674+ },
662675 DisplayName : "Spouse's phone number" ,
663676 FactorID : "phone" ,
664677 },
@@ -669,7 +682,9 @@ func TestInvalidCreateUser(t *testing.T) {
669682 (& UserToCreate {}).MFASettings (MultiFactorSettings {
670683 EnrolledFactors : []* MultiFactorInfo {
671684 {
672- PhoneNumber : "+11234567890" ,
685+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
686+ PhoneNumber : "+11234567890" ,
687+ },
673688 DisplayName : "Spouse's phone number" ,
674689 FactorID : "phone" ,
675690 EnrollmentTimestamp : time .Now ().UTC ().Unix (),
@@ -681,7 +696,9 @@ func TestInvalidCreateUser(t *testing.T) {
681696 (& UserToCreate {}).MFASettings (MultiFactorSettings {
682697 EnrolledFactors : []* MultiFactorInfo {
683698 {
684- PhoneNumber : "+11234567890" ,
699+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
700+ PhoneNumber : "+11234567890" ,
701+ },
685702 DisplayName : "Spouse's phone number" ,
686703 FactorID : "" ,
687704 },
@@ -692,8 +709,10 @@ func TestInvalidCreateUser(t *testing.T) {
692709 (& UserToCreate {}).MFASettings (MultiFactorSettings {
693710 EnrolledFactors : []* MultiFactorInfo {
694711 {
695- PhoneNumber : "+11234567890" ,
696- FactorID : "phone" ,
712+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
713+ PhoneNumber : "+11234567890" ,
714+ },
715+ FactorID : "phone" ,
697716 },
698717 },
699718 }),
@@ -773,7 +792,9 @@ var createUserCases = []struct {
773792 (& UserToCreate {}).MFASettings (MultiFactorSettings {
774793 EnrolledFactors : []* MultiFactorInfo {
775794 {
776- PhoneNumber : "+11234567890" ,
795+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
796+ PhoneNumber : "+11234567890" ,
797+ },
777798 DisplayName : "Spouse's phone number" ,
778799 FactorID : "phone" ,
779800 },
@@ -790,12 +811,16 @@ var createUserCases = []struct {
790811 (& UserToCreate {}).MFASettings (MultiFactorSettings {
791812 EnrolledFactors : []* MultiFactorInfo {
792813 {
793- PhoneNumber : "+11234567890" ,
814+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
815+ PhoneNumber : "+11234567890" ,
816+ },
794817 DisplayName : "number1" ,
795818 FactorID : "phone" ,
796819 },
797820 {
798- PhoneNumber : "+11234567890" ,
821+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
822+ PhoneNumber : "+11234567890" ,
823+ },
799824 DisplayName : "number2" ,
800825 FactorID : "phone" ,
801826 },
@@ -875,9 +900,11 @@ func TestInvalidUpdateUser(t *testing.T) {
875900 (& UserToUpdate {}).MFASettings (MultiFactorSettings {
876901 EnrolledFactors : []* MultiFactorInfo {
877902 {
878- UID : "enrolledSecondFactor1" ,
879- PhoneNumber : "+11234567890" ,
880- FactorID : "phone" ,
903+ UID : "enrolledSecondFactor1" ,
904+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
905+ PhoneNumber : "+11234567890" ,
906+ },
907+ FactorID : "phone" ,
881908 },
882909 },
883910 }),
@@ -886,8 +913,10 @@ func TestInvalidUpdateUser(t *testing.T) {
886913 (& UserToUpdate {}).MFASettings (MultiFactorSettings {
887914 EnrolledFactors : []* MultiFactorInfo {
888915 {
889- UID : "enrolledSecondFactor1" ,
890- PhoneNumber : "invalid" ,
916+ UID : "enrolledSecondFactor1" ,
917+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
918+ PhoneNumber : "invalid" ,
919+ },
891920 DisplayName : "Spouse's phone number" ,
892921 FactorID : "phone" ,
893922 },
@@ -898,7 +927,9 @@ func TestInvalidUpdateUser(t *testing.T) {
898927 (& UserToUpdate {}).MFASettings (MultiFactorSettings {
899928 EnrolledFactors : []* MultiFactorInfo {
900929 {
901- PhoneNumber : "+11234567890" ,
930+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
931+ PhoneNumber : "+11234567890" ,
932+ },
902933 FactorID : "phone" ,
903934 DisplayName : "Spouse's phone number" ,
904935 },
@@ -1049,14 +1080,18 @@ var updateUserCases = []struct {
10491080 (& UserToUpdate {}).MFASettings (MultiFactorSettings {
10501081 EnrolledFactors : []* MultiFactorInfo {
10511082 {
1052- UID : "enrolledSecondFactor1" ,
1053- PhoneNumber : "+11234567890" ,
1083+ UID : "enrolledSecondFactor1" ,
1084+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
1085+ PhoneNumber : "+11234567890" ,
1086+ },
10541087 DisplayName : "Spouse's phone number" ,
10551088 FactorID : "phone" ,
10561089 EnrollmentTimestamp : time .Now ().Unix (),
10571090 }, {
1058- UID : "enrolledSecondFactor2" ,
1059- PhoneNumber : "+11234567890" ,
1091+ UID : "enrolledSecondFactor2" ,
1092+ PhoneMultiFactorInfo : & PhoneMultiFactorInfo {
1093+ PhoneNumber : "+11234567890" ,
1094+ },
10601095 DisplayName : "Spouse's phone number" ,
10611096 FactorID : "phone" ,
10621097 },
@@ -1886,10 +1921,16 @@ func TestMakeExportedUser(t *testing.T) {
18861921 MFAInfo : []* multiFactorInfoResponse {
18871922 {
18881923 PhoneInfo : "+1234567890" ,
1889- MFAEnrollmentID : "0aaded3f-5e73-461d-aef9-37b48e3769be " ,
1924+ MFAEnrollmentID : "enrolledFactor1 " ,
18901925 DisplayName : "My MFA Phone" ,
18911926 EnrolledAt : "2021-03-03T13:06:20.542896Z" ,
18921927 },
1928+ {
1929+ TOTPInfo : & TOTPInfo {},
1930+ MFAEnrollmentID : "enrolledFactor2" ,
1931+ DisplayName : "My MFA TOTP" ,
1932+ EnrolledAt : "2021-03-03T13:06:20.542896Z" ,
1933+ },
18931934 },
18941935 }
18951936
0 commit comments