MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / createUserClaim

Function createUserClaim

util/cmd/load_test_users/main.go:71–98  ·  view source on GitHub ↗

nolint:lll // WONTFIX: useful comment * createUserClaim creates the token that will be used to create a fake user in the auth emulator. The user will be created so that it can fake a sign in with GitHub. More details about the structure of the claims can be found below. Currently the JWT ID looks

(user User, project string)

Source from the content-addressed store, hash-verified

69 - https://github.com/Dietarify/app-backend/blob/5c905a5c956a1542eebf28d0fbe1c7cab0ea80f4/README.md?plain=1#L70-L79
70*/
71func createUserClaim(user User, project string) jwt.MapClaims {
72 issueTime := time.Now()
73 claims := jwt.MapClaims{
74 "name": user.Name,
75 "email": user.Email,
76 "email_verified": user.EmailVerified,
77 "auth_time": issueTime.Unix(),
78 "user_id": user.UserID,
79 "firebase": map[string]any{
80 "identities": map[string]any{
81 "email": []string{
82 user.Email,
83 },
84 "github.com": []string{
85 fmt.Sprintf("%d", user.GitHubUserID),
86 },
87 },
88 "sign_in_provider": "github.com",
89 },
90 "iat": issueTime.Unix(),
91 "exp": issueTime.Add(1 * time.Hour).Unix(),
92 "aud": project,
93 "sub": user.UserID,
94 "iss": "https://securetoken.google.com/" + project,
95 }
96
97 return claims
98}
99
100// getUsers contains the list of users to create.
101// Any updates should be reflected in e2e/tests/utils.ts as well.

Callers 1

createUsersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected