Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/validate-capabilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: SDK Compliance
on:
workflow_dispatch:
pull_request:
branches:
- main

permissions:
contents: read
Expand Down
6 changes: 3 additions & 3 deletions packages/gotrue/lib/src/gotrue_admin_oauth_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class OAuthClientListResponse {
.map((e) => OAuthClient.fromJson(e as Map<String, dynamic>))
.toList(),
aud: json['aud'] as String?,
nextPage: json['nextPage'] as int?,
lastPage: json['lastPage'] as int?,
total: json['total'] as int? ?? 0,
nextPage: (json['nextPage'] as num?)?.toInt(),
lastPage: (json['lastPage'] as num?)?.toInt(),
total: (json['total'] as num?)?.toInt() ?? 0,
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/gotrue/lib/src/types/jwt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class JwtPayload {
iss: json['iss'] as String?,
sub: json['sub'] as String?,
aud: json['aud'],
exp: json['exp'] as int?,
nbf: json['nbf'] as int?,
iat: json['iat'] as int?,
exp: (json['exp'] as num?)?.toInt(),
nbf: (json['nbf'] as num?)?.toInt(),
iat: (json['iat'] as num?)?.toInt(),
jti: json['jti'] as String?,
claims: Map<String, dynamic>.of(json),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/gotrue/lib/src/types/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Session {
}
return Session(
accessToken: json['access_token'] as String,
expiresIn: json['expires_in'] as int?,
expiresIn: (json['expires_in'] as num?)?.toInt(),
refreshToken: json['refresh_token'] as String?,
tokenType: json['token_type'] as String,
providerToken: json['provider_token'] as String?,
Expand Down
16 changes: 16 additions & 0 deletions packages/gotrue/test/src/helper_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:gotrue/src/helper.dart';
import 'package:gotrue/src/types/jwt.dart';
import 'package:test/test.dart';

void main() {
Expand Down Expand Up @@ -330,4 +331,19 @@ void main() {
});
});
});

group('JwtPayload', () {
test('fromJson accepts double exp, nbf, and iat', () {
final payload = JwtPayload.fromJson({
'sub': '1234567890',
'exp': 1700000000.0,
'nbf': 1600000000.0,
'iat': 1650000000.0,
});

expect(payload.exp, equals(1700000000));
expect(payload.nbf, equals(1600000000));
expect(payload.iat, equals(1650000000));
});
});
}
20 changes: 20 additions & 0 deletions packages/gotrue/test/src/types/session_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ void main() {
);
expect(session.user.id, equals('123'));
});

test('accepts a double expires_in, as sent by a BroadcastChannel', () {
final json = {
'access_token': 'test-access-token',
'expires_in': 3600.0,
'token_type': 'bearer',
'user': {
'id': '123',
'app_metadata': <String, dynamic>{},
'user_metadata': <String, dynamic>{},
'aud': 'authenticated',
'created_at': '2023-01-01T00:00:00Z',
},
};

final session = Session.fromJson(json);

expect(session, isNotNull);
expect(session!.expiresIn, equals(3600));
});
});

group('toJson', () {
Expand Down
1 change: 1 addition & 0 deletions packages/storage_client/lib/src/storage_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SupabaseStorageClient extends StorageBucketApi {
/// only if your project has the dedicated storage host enabled; otherwise
/// every storage request will fail with an `Invalid Storage request` error.
/// Defaults to `false` (opt-in).
// ignore: use_super_parameters
SupabaseStorageClient(
String url,
Map<String, String> headers, {
Expand Down
14 changes: 8 additions & 6 deletions packages/supabase_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ android {
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
Expand All @@ -39,6 +35,12 @@ android {
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

flutter {
source = "../.."
}
9 changes: 6 additions & 3 deletions packages/supabase_flutter/example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
kotlin.version=2.1.20
# This newDsl flag was added by the Flutter template
android.newDsl=false
# This builtInKotlin flag was added by the Flutter template
android.builtInKotlin=false
kotlin.version=2.4.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
4 changes: 2 additions & 2 deletions packages/supabase_flutter/example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.13.1' apply false
id "org.jetbrains.kotlin.android" version "2.1.20" apply false
id "com.android.application" version "9.1.0" apply false
id "org.jetbrains.kotlin.android" version "2.4.0" apply false
}

include ":app"
Loading