feat: enhance JWT support with private key handling and additional algorithms

This commit is contained in:
Udhay-Adithya
2025-07-06 12:19:27 +05:30
parent 92af4fba77
commit d5ca13b356
8 changed files with 388 additions and 85 deletions

View File

@@ -7,6 +7,7 @@ part 'auth_jwt_model.g.dart';
class AuthJwtModel with _$AuthJwtModel {
const factory AuthJwtModel({
required String secret,
String? privateKey,
required String payload,
required String addTokenTo,
required String algorithm,

View File

@@ -22,6 +22,7 @@ AuthJwtModel _$AuthJwtModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$AuthJwtModel {
String get secret => throw _privateConstructorUsedError;
String? get privateKey => throw _privateConstructorUsedError;
String get payload => throw _privateConstructorUsedError;
String get addTokenTo => throw _privateConstructorUsedError;
String get algorithm => throw _privateConstructorUsedError;
@@ -49,6 +50,7 @@ abstract class $AuthJwtModelCopyWith<$Res> {
@useResult
$Res call({
String secret,
String? privateKey,
String payload,
String addTokenTo,
String algorithm,
@@ -75,6 +77,7 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
@override
$Res call({
Object? secret = null,
Object? privateKey = freezed,
Object? payload = null,
Object? addTokenTo = null,
Object? algorithm = null,
@@ -89,6 +92,10 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
? _value.secret
: secret // ignore: cast_nullable_to_non_nullable
as String,
privateKey: freezed == privateKey
? _value.privateKey
: privateKey // ignore: cast_nullable_to_non_nullable
as String?,
payload: null == payload
? _value.payload
: payload // ignore: cast_nullable_to_non_nullable
@@ -134,6 +141,7 @@ abstract class _$$AuthJwtModelImplCopyWith<$Res>
@useResult
$Res call({
String secret,
String? privateKey,
String payload,
String addTokenTo,
String algorithm,
@@ -159,6 +167,7 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
@override
$Res call({
Object? secret = null,
Object? privateKey = freezed,
Object? payload = null,
Object? addTokenTo = null,
Object? algorithm = null,
@@ -173,6 +182,10 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
? _value.secret
: secret // ignore: cast_nullable_to_non_nullable
as String,
privateKey: freezed == privateKey
? _value.privateKey
: privateKey // ignore: cast_nullable_to_non_nullable
as String?,
payload: null == payload
? _value.payload
: payload // ignore: cast_nullable_to_non_nullable
@@ -211,6 +224,7 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
class _$AuthJwtModelImpl implements _AuthJwtModel {
const _$AuthJwtModelImpl({
required this.secret,
this.privateKey,
required this.payload,
required this.addTokenTo,
required this.algorithm,
@@ -226,6 +240,8 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
@override
final String secret;
@override
final String? privateKey;
@override
final String payload;
@override
final String addTokenTo;
@@ -242,7 +258,7 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
@override
String toString() {
return 'AuthJwtModel(secret: $secret, payload: $payload, addTokenTo: $addTokenTo, algorithm: $algorithm, isSecretBase64Encoded: $isSecretBase64Encoded, headerPrefix: $headerPrefix, queryParamKey: $queryParamKey, header: $header)';
return 'AuthJwtModel(secret: $secret, privateKey: $privateKey, payload: $payload, addTokenTo: $addTokenTo, algorithm: $algorithm, isSecretBase64Encoded: $isSecretBase64Encoded, headerPrefix: $headerPrefix, queryParamKey: $queryParamKey, header: $header)';
}
@override
@@ -251,6 +267,8 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
(other.runtimeType == runtimeType &&
other is _$AuthJwtModelImpl &&
(identical(other.secret, secret) || other.secret == secret) &&
(identical(other.privateKey, privateKey) ||
other.privateKey == privateKey) &&
(identical(other.payload, payload) || other.payload == payload) &&
(identical(other.addTokenTo, addTokenTo) ||
other.addTokenTo == addTokenTo) &&
@@ -270,6 +288,7 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
int get hashCode => Object.hash(
runtimeType,
secret,
privateKey,
payload,
addTokenTo,
algorithm,
@@ -296,6 +315,7 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
abstract class _AuthJwtModel implements AuthJwtModel {
const factory _AuthJwtModel({
required final String secret,
final String? privateKey,
required final String payload,
required final String addTokenTo,
required final String algorithm,
@@ -311,6 +331,8 @@ abstract class _AuthJwtModel implements AuthJwtModel {
@override
String get secret;
@override
String? get privateKey;
@override
String get payload;
@override
String get addTokenTo;

View File

@@ -9,6 +9,7 @@ part of 'auth_jwt_model.dart';
_$AuthJwtModelImpl _$$AuthJwtModelImplFromJson(Map<String, dynamic> json) =>
_$AuthJwtModelImpl(
secret: json['secret'] as String,
privateKey: json['privateKey'] as String?,
payload: json['payload'] as String,
addTokenTo: json['addTokenTo'] as String,
algorithm: json['algorithm'] as String,
@@ -21,6 +22,7 @@ _$AuthJwtModelImpl _$$AuthJwtModelImplFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> _$$AuthJwtModelImplToJson(_$AuthJwtModelImpl instance) =>
<String, dynamic>{
'secret': instance.secret,
'privateKey': instance.privateKey,
'payload': instance.payload,
'addTokenTo': instance.addTokenTo,
'algorithm': instance.algorithm,