in FirebaseAdmin/FirebaseAdmin/Auth/UserRecordArgs.cs [216:244]
internal static string CheckCustomClaims(IReadOnlyDictionary<string, object> claims)
{
if (claims == null || claims.Count == 0)
{
return "{}";
}
foreach (var key in claims.Keys)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentException("Claim names must not be null or empty");
}
if (FirebaseTokenFactory.ReservedClaims.Contains(key))
{
throw new ArgumentException($"Claim {key} is reserved and cannot be set");
}
}
var customClaimsString = NewtonsoftJsonSerializer.Instance.Serialize(claims);
var byteCount = Encoding.UTF8.GetByteCount(customClaimsString);
if (byteCount > 1000)
{
throw new ArgumentException($"Claims must not be longer than 1000 bytes when serialized");
}
return customClaimsString;
}