1- import { _decodeUserInfo } from "./types" ;
1+ import { _decodeUserInfo , AuthenticatorType , AuthenticatorKind } from "./types" ;
22
33const USER_INFO = `
44{
@@ -7,6 +7,33 @@ const USER_INFO = `
77 "https://authgear.com/claims/user/is_anonymous": false,
88 "https://authgear.com/claims/user/can_reauthenticate": true,
99 "https://authgear.com/claims/user/roles": ["role_a"],
10+ "https://authgear.com/claims/user/authenticators": [
11+ {
12+ "created_at": "2023-01-01T00:00:00Z",
13+ "updated_at": "2023-01-01T00:00:00Z",
14+ "type": "password",
15+ "kind": "primary"
16+ },
17+ {
18+ "created_at": "2023-01-01T00:00:00Z",
19+ "updated_at": "2023-01-01T00:00:00Z",
20+ "type": "oob_otp_sms",
21+ "kind": "primary"
22+ },
23+ {
24+ "created_at": "2023-01-01T00:00:00Z",
25+ "updated_at": "2023-01-01T00:00:00Z",
26+ "type": "oob_otp_email",
27+ "kind": "primary"
28+ },
29+ {
30+ "created_at": "2023-01-01T00:00:00Z",
31+ "updated_at": "2023-01-01T00:00:00Z",
32+ "type": "totp",
33+ "kind": "secondary"
34+ }
35+ ],
36+ "https://authgear.com/claims/user/recovery_code_enabled": true,
1037
1138 "email": "user@example.com",
1239 "email_verified": true,
@@ -55,6 +82,33 @@ describe("_decodeUserInfo", () => {
5582 birthdate : "1970-01-01" ,
5683 canReauthenticate : true ,
5784 roles : [ "role_a" ] ,
85+ authenticators : [
86+ {
87+ createdAt : new Date ( "2023-01-01T00:00:00Z" ) ,
88+ updatedAt : new Date ( "2023-01-01T00:00:00Z" ) ,
89+ type : AuthenticatorType . Password ,
90+ kind : AuthenticatorKind . Primary ,
91+ } ,
92+ {
93+ createdAt : new Date ( "2023-01-01T00:00:00Z" ) ,
94+ updatedAt : new Date ( "2023-01-01T00:00:00Z" ) ,
95+ type : AuthenticatorType . OOBOTPSMS ,
96+ kind : AuthenticatorKind . Primary ,
97+ } ,
98+ {
99+ createdAt : new Date ( "2023-01-01T00:00:00Z" ) ,
100+ updatedAt : new Date ( "2023-01-01T00:00:00Z" ) ,
101+ type : AuthenticatorType . OOBOTPEmail ,
102+ kind : AuthenticatorKind . Primary ,
103+ } ,
104+ {
105+ createdAt : new Date ( "2023-01-01T00:00:00Z" ) ,
106+ updatedAt : new Date ( "2023-01-01T00:00:00Z" ) ,
107+ type : AuthenticatorType . TOTP ,
108+ kind : AuthenticatorKind . Secondary ,
109+ } ,
110+ ] ,
111+ recoveryCodeEnabled : true ,
58112 customAttributes : {
59113 foobar : 42 ,
60114 } ,
@@ -84,6 +138,33 @@ describe("_decodeUserInfo", () => {
84138 street_address : "10 Somewhere Street" ,
85139 } ,
86140 birthdate : "1970-01-01" ,
141+ "https://authgear.com/claims/user/authenticators" : [
142+ {
143+ created_at : "2023-01-01T00:00:00Z" ,
144+ updated_at : "2023-01-01T00:00:00Z" ,
145+ type : "password" ,
146+ kind : "primary" ,
147+ } ,
148+ {
149+ created_at : "2023-01-01T00:00:00Z" ,
150+ updated_at : "2023-01-01T00:00:00Z" ,
151+ type : "oob_otp_sms" ,
152+ kind : "primary" ,
153+ } ,
154+ {
155+ created_at : "2023-01-01T00:00:00Z" ,
156+ updated_at : "2023-01-01T00:00:00Z" ,
157+ type : "oob_otp_email" ,
158+ kind : "primary" ,
159+ } ,
160+ {
161+ created_at : "2023-01-01T00:00:00Z" ,
162+ updated_at : "2023-01-01T00:00:00Z" ,
163+ type : "totp" ,
164+ kind : "secondary" ,
165+ } ,
166+ ] ,
167+ "https://authgear.com/claims/user/recovery_code_enabled" : true ,
87168 custom_attributes : {
88169 foobar : 42 ,
89170 } ,
0 commit comments