@@ -34,20 +34,13 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
3434
3535 sessionClaim .GetValueFromPayload = func (payload map [string ]interface {}, userContext supertokens.UserContext ) interface {} {
3636 if value , ok := payload [sessionClaim .Key ].(map [string ]interface {}); ok {
37- return value
38- }
39- return nil
40- }
41-
42- getValueFromPayload := func (payload map [string ]interface {}, userContext supertokens.UserContext ) interface {} {
43- if value , ok := sessionClaim .GetValueFromPayload (payload , userContext ).(map [string ]interface {}); ok {
4437 return value ["v" ]
4538 }
4639 return nil
4740 }
4841
4942 getLastRefetchTime := func (payload map [string ]interface {}, userContext supertokens.UserContext ) * int64 {
50- if value , ok := sessionClaim .GetValueFromPayload ( payload , userContext ) .(map [string ]interface {}); ok {
43+ if value , ok := payload [ sessionClaim .Key ] .(map [string ]interface {}); ok {
5144 val := value ["t" ].(int64 )
5245 return & val
5346 }
@@ -67,7 +60,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
6760 ID : claimId ,
6861 Claim : sessionClaim ,
6962 ShouldRefetch : func (payload map [string ]interface {}, userContext supertokens.UserContext ) bool {
70- claimVal , ok := getValueFromPayload (payload , userContext ).([]interface {})
63+ claimVal , ok := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
7164 if ! ok || claimVal == nil {
7265 return true
7366 }
@@ -77,7 +70,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
7770 return false
7871 },
7972 Validate : func (payload map [string ]interface {}, userContext supertokens.UserContext ) ClaimValidationResult {
80- claimVal := getValueFromPayload (payload , userContext ).([]interface {})
73+ claimVal := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
8174
8275 if claimVal == nil {
8376 return ClaimValidationResult {
@@ -128,7 +121,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
128121 ID : claimId ,
129122 Claim : sessionClaim ,
130123 ShouldRefetch : func (payload map [string ]interface {}, userContext supertokens.UserContext ) bool {
131- val , ok := getValueFromPayload (payload , userContext ).([]interface {})
124+ val , ok := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
132125 if ! ok || val == nil {
133126 return true
134127 }
@@ -138,7 +131,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
138131 return false
139132 },
140133 Validate : func (payload map [string ]interface {}, userContext supertokens.UserContext ) ClaimValidationResult {
141- claimVal := getValueFromPayload (payload , userContext ).([]interface {})
134+ claimVal := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
142135
143136 if claimVal == nil {
144137 return ClaimValidationResult {
@@ -189,7 +182,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
189182 ID : claimId ,
190183 Claim : sessionClaim ,
191184 ShouldRefetch : func (payload map [string ]interface {}, userContext supertokens.UserContext ) bool {
192- val , ok := getValueFromPayload (payload , userContext ).([]interface {})
185+ val , ok := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
193186 if ! ok || val == nil {
194187 return true
195188 }
@@ -199,7 +192,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
199192 return false
200193 },
201194 Validate : func (payload map [string ]interface {}, userContext supertokens.UserContext ) ClaimValidationResult {
202- claimVal := getValueFromPayload (payload , userContext ).([]interface {})
195+ claimVal := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
203196
204197 if claimVal == nil {
205198 return ClaimValidationResult {
@@ -251,7 +244,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
251244 ID : claimId ,
252245 Claim : sessionClaim ,
253246 ShouldRefetch : func (payload map [string ]interface {}, userContext supertokens.UserContext ) bool {
254- val , ok := getValueFromPayload (payload , userContext ).([]interface {})
247+ val , ok := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
255248 if ! ok || val == nil {
256249 return true
257250 }
@@ -261,7 +254,7 @@ func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInS
261254 return false
262255 },
263256 Validate : func (payload map [string ]interface {}, userContext supertokens.UserContext ) ClaimValidationResult {
264- claimVal := getValueFromPayload (payload , userContext ).([]interface {})
257+ claimVal := sessionClaim . GetValueFromPayload (payload , userContext ).([]interface {})
265258
266259 if claimVal == nil {
267260 return ClaimValidationResult {
0 commit comments