feat: implement oauth1

This commit is contained in:
Udhay-Adithya
2025-07-22 23:09:15 +05:30
parent 85030c72a6
commit bc779882f7
7 changed files with 185 additions and 76 deletions

View File

@@ -9,6 +9,7 @@ class AuthOAuth1Model with _$AuthOAuth1Model {
const factory AuthOAuth1Model({
required String consumerKey,
required String consumerSecret,
required String credentialsFilePath,
String? accessToken,
String? tokenSecret,
@Default("hmacSha1") String signatureMethod,

View File

@@ -23,6 +23,7 @@ AuthOAuth1Model _$AuthOAuth1ModelFromJson(Map<String, dynamic> json) {
mixin _$AuthOAuth1Model {
String get consumerKey => throw _privateConstructorUsedError;
String get consumerSecret => throw _privateConstructorUsedError;
String get credentialsFilePath => throw _privateConstructorUsedError;
String? get accessToken => throw _privateConstructorUsedError;
String? get tokenSecret => throw _privateConstructorUsedError;
String get signatureMethod => throw _privateConstructorUsedError;
@@ -55,6 +56,7 @@ abstract class $AuthOAuth1ModelCopyWith<$Res> {
$Res call({
String consumerKey,
String consumerSecret,
String credentialsFilePath,
String? accessToken,
String? tokenSecret,
String signatureMethod,
@@ -86,6 +88,7 @@ class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model>
$Res call({
Object? consumerKey = null,
Object? consumerSecret = null,
Object? credentialsFilePath = null,
Object? accessToken = freezed,
Object? tokenSecret = freezed,
Object? signatureMethod = null,
@@ -108,6 +111,10 @@ class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model>
? _value.consumerSecret
: consumerSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
accessToken: freezed == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
@@ -170,6 +177,7 @@ abstract class _$$AuthOAuth1ModelImplCopyWith<$Res>
$Res call({
String consumerKey,
String consumerSecret,
String credentialsFilePath,
String? accessToken,
String? tokenSecret,
String signatureMethod,
@@ -200,6 +208,7 @@ class __$$AuthOAuth1ModelImplCopyWithImpl<$Res>
$Res call({
Object? consumerKey = null,
Object? consumerSecret = null,
Object? credentialsFilePath = null,
Object? accessToken = freezed,
Object? tokenSecret = freezed,
Object? signatureMethod = null,
@@ -222,6 +231,10 @@ class __$$AuthOAuth1ModelImplCopyWithImpl<$Res>
? _value.consumerSecret
: consumerSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
accessToken: freezed == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
@@ -277,6 +290,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
const _$AuthOAuth1ModelImpl({
required this.consumerKey,
required this.consumerSecret,
required this.credentialsFilePath,
this.accessToken,
this.tokenSecret,
this.signatureMethod = "hmacSha1",
@@ -298,6 +312,8 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
@override
final String consumerSecret;
@override
final String credentialsFilePath;
@override
final String? accessToken;
@override
final String? tokenSecret;
@@ -326,7 +342,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
@override
String toString() {
return 'AuthOAuth1Model(consumerKey: $consumerKey, consumerSecret: $consumerSecret, accessToken: $accessToken, tokenSecret: $tokenSecret, signatureMethod: $signatureMethod, parameterLocation: $parameterLocation, version: $version, realm: $realm, callbackUrl: $callbackUrl, verifier: $verifier, nonce: $nonce, timestamp: $timestamp, includeBodyHash: $includeBodyHash)';
return 'AuthOAuth1Model(consumerKey: $consumerKey, consumerSecret: $consumerSecret, credentialsFilePath: $credentialsFilePath, accessToken: $accessToken, tokenSecret: $tokenSecret, signatureMethod: $signatureMethod, parameterLocation: $parameterLocation, version: $version, realm: $realm, callbackUrl: $callbackUrl, verifier: $verifier, nonce: $nonce, timestamp: $timestamp, includeBodyHash: $includeBodyHash)';
}
@override
@@ -338,6 +354,8 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
other.consumerKey == consumerKey) &&
(identical(other.consumerSecret, consumerSecret) ||
other.consumerSecret == consumerSecret) &&
(identical(other.credentialsFilePath, credentialsFilePath) ||
other.credentialsFilePath == credentialsFilePath) &&
(identical(other.accessToken, accessToken) ||
other.accessToken == accessToken) &&
(identical(other.tokenSecret, tokenSecret) ||
@@ -365,6 +383,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
runtimeType,
consumerKey,
consumerSecret,
credentialsFilePath,
accessToken,
tokenSecret,
signatureMethod,
@@ -399,6 +418,7 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
const factory _AuthOAuth1Model({
required final String consumerKey,
required final String consumerSecret,
required final String credentialsFilePath,
final String? accessToken,
final String? tokenSecret,
final String signatureMethod,
@@ -420,6 +440,8 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
@override
String get consumerSecret;
@override
String get credentialsFilePath;
@override
String? get accessToken;
@override
String? get tokenSecret;

View File

@@ -11,6 +11,7 @@ _$AuthOAuth1ModelImpl _$$AuthOAuth1ModelImplFromJson(
) => _$AuthOAuth1ModelImpl(
consumerKey: json['consumerKey'] as String,
consumerSecret: json['consumerSecret'] as String,
credentialsFilePath: json['credentialsFilePath'] as String,
accessToken: json['accessToken'] as String?,
tokenSecret: json['tokenSecret'] as String?,
signatureMethod: json['signatureMethod'] as String? ?? "hmacSha1",
@@ -29,6 +30,7 @@ Map<String, dynamic> _$$AuthOAuth1ModelImplToJson(
) => <String, dynamic>{
'consumerKey': instance.consumerKey,
'consumerSecret': instance.consumerSecret,
'credentialsFilePath': instance.credentialsFilePath,
'accessToken': instance.accessToken,
'tokenSecret': instance.tokenSecret,
'signatureMethod': instance.signatureMethod,