Skip to content

Commit

Permalink
Create custom deeplink for OIDC4VP #3239
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Jan 20, 2025
1 parent 6dc6b9e commit 750f7dc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="openid-vc" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="altme-openid-vc" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
10 changes: 10 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@
<string>openid-vc</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>openid</string>
<key>CFBundleURLSchemes</key>
<array>
<string>altme-openid-vc</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
Expand Down
3 changes: 2 additions & 1 deletion lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class Parameters {

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

static const authorizeEndPoint =
'https://app.altme.io/app/download/authorize';
Expand Down
3 changes: 2 additions & 1 deletion lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,13 @@ bool isPolygonIdUrl(String url) =>
bool isOIDC4VCIUrl(Uri uri) {
return uri.toString().startsWith('openid') ||
uri.toString().startsWith('haip') ||
uri.toString().startsWith(Parameters.walletDeepLink);
uri.toString().startsWith(Parameters.walletOfferDeepLink);
}

bool isSIOPV2OROIDC4VPUrl(Uri uri) {
final isOpenIdUrl = uri.toString().startsWith('openid://?') ||
uri.toString().startsWith('openid-vc://?') ||
uri.toString().startsWith(Parameters.walletPresentationDeepLink) ||
uri.toString().startsWith('openid-hedera://?') ||
uri.toString().startsWith('haip://?') ||
uri.toString().startsWith('haip://authorize?');
Expand Down
2 changes: 1 addition & 1 deletion lib/splash/view/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class _SplashViewState extends State<SplashView> {
}
});

if (isOIDC4VCIUrl(uri)) {
if (isOIDC4VCIUrl(uri) || isSIOPV2OROIDC4VPUrl(uri)) {
context.read<DeepLinkCubit>().addDeepLink(uri.toString());
return;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/oidc4vc/lib/src/constants.dart
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
const walletDeepLink = 'altme-openid-credential-offer';
const walletOfferDeepLink = 'altme-openid-credential-offer';
const walletPresentationDeepLink = 'altme-openid-vc';
4 changes: 2 additions & 2 deletions packages/oidc4vc/lib/src/models/oidc4vc_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ enum OIDC4VCType {
),

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

GAIAX(
Expand Down

0 comments on commit 750f7dc

Please sign in to comment.