@@ -66,7 +66,12 @@ func runVerifyBeforeUserCreatedHook(
6666 hookReq := & v0hooks.BeforeUserCreatedInput {}
6767 err := call .Unmarshal (hookReq )
6868 require .NoError (t , err )
69+
70+ require .NotNil (t , hookReq .Metadata )
71+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
6972 require .Equal (t , v0hooks .BeforeUserCreated , hookReq .Metadata .Name )
73+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
74+ require .False (t , hookReq .Metadata .Time .IsZero ())
7075
7176 u := hookReq .User
7277 require .Equal (t , expUser .ID , u .ID )
@@ -103,7 +108,12 @@ func runVerifyAfterUserCreatedHook(
103108 hookReq := & v0hooks.AfterUserCreatedInput {}
104109 err := call .Unmarshal (hookReq )
105110 require .NoError (t , err )
111+
112+ require .NotNil (t , hookReq .Metadata )
113+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
106114 require .Equal (t , v0hooks .AfterUserCreated , hookReq .Metadata .Name )
115+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
116+ require .False (t , hookReq .Metadata .Time .IsZero ())
107117
108118 u := hookReq .User
109119 require .Equal (t , expUser .ID , u .ID )
@@ -176,6 +186,12 @@ func signupAndConfirmEmail(
176186 err = call .Unmarshal (hookReq )
177187 require .NoError (t , err )
178188
189+ require .NotNil (t , hookReq .Metadata )
190+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
191+ require .Equal (t , v0hooks .SendEmail , hookReq .Metadata .Name )
192+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
193+ require .False (t , hookReq .Metadata .Time .IsZero ())
194+
179195 // verify that the latest user from find user matches OTP
180196 otpHash := crypto .GenerateTokenHash (
181197 expUser .GetEmail (), hookReq .EmailData .Token )
@@ -285,6 +301,12 @@ func TestE2EHooks(t *testing.T) {
285301 err = call .Unmarshal (hookReq )
286302 require .NoError (t , err )
287303
304+ require .NotNil (t , hookReq .Metadata )
305+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
306+ require .Equal (t , v0hooks .SendSMS , hookReq .Metadata .Name )
307+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
308+ require .False (t , hookReq .Metadata .Time .IsZero ())
309+
288310 latestUser , err := models .FindUserByID (inst .Conn , signupUser .ID )
289311 require .NoError (t , err )
290312 require .NotNil (t , latestUser )
@@ -383,6 +405,12 @@ func TestE2EHooks(t *testing.T) {
383405 err = call .Unmarshal (hookReq )
384406 require .NoError (t , err )
385407
408+ require .NotNil (t , hookReq .Metadata )
409+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
410+ require .Equal (t , v0hooks .SendSMS , hookReq .Metadata .Name )
411+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
412+ require .False (t , hookReq .Metadata .Time .IsZero ())
413+
386414 require .Equal (t , currentUser .ID , hookReq .User .ID )
387415 require .Equal (t , currentUser .Aud , hookReq .User .Aud )
388416 require .Equal (t , currentUser .Phone , hookReq .User .Phone )
@@ -924,6 +952,13 @@ func TestE2EHooks(t *testing.T) {
924952 hookReq := & v0hooks.CustomAccessTokenInput {}
925953 err := call .Unmarshal (hookReq )
926954 require .NoError (t , err )
955+
956+ require .NotNil (t , hookReq .Metadata )
957+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
958+ require .Equal (t , v0hooks .CustomizeAccessToken , hookReq .Metadata .Name )
959+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
960+ require .False (t , hookReq .Metadata .Time .IsZero ())
961+
927962 require .Equal (t , currentUser .ID , hookReq .UserID )
928963 require .Equal (t , currentUser .ID .String (), hookReq .Claims .Subject )
929964 }
@@ -1127,6 +1162,12 @@ func TestE2EHooks(t *testing.T) {
11271162 err = call .Unmarshal (hookReq )
11281163 require .NoError (t , err )
11291164
1165+ require .NotNil (t , hookReq .Metadata )
1166+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
1167+ require .Equal (t , v0hooks .SendEmail , hookReq .Metadata .Name )
1168+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
1169+ require .False (t , hookReq .Metadata .Time .IsZero ())
1170+
11301171 // hook user matches the signup user
11311172 require .Equal (t , signupUser .ID , hookReq .User .ID )
11321173 require .Equal (t , signupUser .Aud , hookReq .User .Aud )
@@ -1240,6 +1281,12 @@ func TestE2EHooks(t *testing.T) {
12401281 err = call .Unmarshal (hookReq )
12411282 require .NoError (t , err )
12421283
1284+ require .NotNil (t , hookReq .Metadata )
1285+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
1286+ require .Equal (t , v0hooks .SendEmail , hookReq .Metadata .Name )
1287+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
1288+ require .False (t , hookReq .Metadata .Time .IsZero ())
1289+
12431290 // verify there is an ott generated
12441291 ott , err := models .FindOneTimeToken (
12451292 inst .Conn ,
@@ -1343,6 +1390,12 @@ func TestE2EHooks(t *testing.T) {
13431390 err = call .Unmarshal (hookReq )
13441391 require .NoError (t , err )
13451392
1393+ require .NotNil (t , hookReq .Metadata )
1394+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
1395+ require .Equal (t , v0hooks .SendEmail , hookReq .Metadata .Name )
1396+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
1397+ require .False (t , hookReq .Metadata .Time .IsZero ())
1398+
13461399 // hook user matches the signup user
13471400 require .Equal (t , signupUser .ID , hookReq .User .ID )
13481401 require .Equal (t , signupUser .Aud , hookReq .User .Aud )
@@ -1453,6 +1506,12 @@ func TestE2EHooks(t *testing.T) {
14531506 err = call .Unmarshal (hookReq )
14541507 require .NoError (t , err )
14551508
1509+ require .NotNil (t , hookReq .Metadata )
1510+ require .NotEmpty (t , hookReq .Metadata .IPAddress )
1511+ require .Equal (t , v0hooks .SendEmail , hookReq .Metadata .Name )
1512+ require .NotEqual (t , uuid .Nil , hookReq .Metadata .UUID )
1513+ require .False (t , hookReq .Metadata .Time .IsZero ())
1514+
14561515 // verify there is an ott generated
14571516 ott , err := models .FindOneTimeToken (
14581517 inst .Conn ,
0 commit comments