Skip to content

Commit

Permalink
Add wallet custom scheme for issuance to avoid problem of browser sup…
Browse files Browse the repository at this point in the history
…port

#3229
  • Loading branch information
hawkbee1 committed Jan 20, 2025
1 parent 7d0e947 commit dbd5aae
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Parameters {

static const oidc4vcUniversalLink =
'https://app.altme.io/app/download/callback';
static const walletDeepLink = 'altme-openid-credential-offer';

static const authorizeEndPoint =
'https://app.altme.io/app/download/authorize';
Expand Down
4 changes: 2 additions & 2 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,13 @@ bool isPolygonIdUrl(String url) =>

bool isOIDC4VCIUrl(Uri uri) {
return uri.toString().startsWith('openid') ||
uri.toString().startsWith('haip');
uri.toString().startsWith('haip') ||
uri.toString().startsWith(Parameters.walletDeepLink);
}

bool isSIOPV2OROIDC4VPUrl(Uri uri) {
final isOpenIdUrl = uri.toString().startsWith('openid://?') ||
uri.toString().startsWith('openid-vc://?') ||
uri.toString().startsWith('altme-openid-credential-offer://') ||
uri.toString().startsWith('openid-hedera://?') ||
uri.toString().startsWith('haip://?') ||
uri.toString().startsWith('haip://authorize?');
Expand Down
1 change: 1 addition & 0 deletions lib/oidc4vc/helper_function/get_issuance_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Future<Oidc4vcParameters> getIssuanceData({
for (final oidc4vcType in OIDC4VCType.values) {
if (oidc4vcType.isEnabled && url.startsWith(oidc4vcType.offerPrefix)) {
if (oidc4vcType == OIDC4VCType.DEFAULT ||
oidc4vcType == OIDC4VCType.WALLET ||
oidc4vcType == OIDC4VCType.EBSI) {
if (credSupported?.trustFramework != null &&
credSupported == credSupported?.trustFramework) {
Expand Down
1 change: 1 addition & 0 deletions packages/oidc4vc/lib/src/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const walletDeepLink = 'altme-openid-credential-offer';
9 changes: 9 additions & 0 deletions packages/oidc4vc/lib/src/models/oidc4vc_type.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import 'package:oidc4vc/src/constants.dart';

enum OIDC4VCType {
DEFAULT(
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
),

WALLET(
offerPrefix: '$walletDeepLink://',
presentationPrefix: 'openid-vc://',
),

GAIAX(
offerPrefix: 'openid-initiate-issuance://',
presentationPrefix: 'openid://',
Expand Down Expand Up @@ -46,9 +53,11 @@ extension OIDC4VCTypeX on OIDC4VCType {
case OIDC4VCType.GREENCYPHER:
case OIDC4VCType.EBSI:
case OIDC4VCType.HAIP:
case OIDC4VCType.WALLET:
return true;
case OIDC4VCType.JWTVC:
return false;
// TODO: Handle this case.
}
}
}
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1493,10 +1493,10 @@ packages:
dependency: transitive
description:
name: local_auth_darwin
sha256: "5c5127061107278ab4cafa1ac51b3b6760282bf1a2abf011270908a429d1634b"
sha256: "630996cd7b7f28f5ab92432c4b35d055dd03a747bc319e5ffbb3c4806a3e50d2"
url: "https://pub.dev"
source: hosted
version: "1.4.2"
version: "1.4.3"
local_auth_platform_interface:
dependency: transitive
description:
Expand Down

0 comments on commit dbd5aae

Please sign in to comment.