Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DigitalAssetLinks.ts #770

Merged
merged 1 commit into from
Mar 13, 2023
Merged

Update DigitalAssetLinks.ts #770

merged 1 commit into from
Mar 13, 2023

Conversation

hslee2008
Copy link
Contributor

@hslee2008 hslee2008 commented Mar 11, 2023

Problem (?) I had before

After using bubblewrap for the first time, I had 1 issue that took me days to fix.
It was the Digital Asset Links JSON file.

The problem was the fingerprints were spread out on one item in arrays.

[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "app.web.test.twa",
      "sha256_cert_fingerprints": ["fingerprint1"]
    }
  },
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "app.web.test.twa",
      "sha256_cert_fingerprints": ["fingerprint2"]
    }
  }
]

This was how the file was generated.

Fix

After looking at few sources, I came to conclusion that the assetlinks.json file should be something like below.

  1. Example Format in AssetLinks docs - Google
  2. Example File in AssetLinks docs - Google
  3. Also, looking at few examples such as Google Docs AssetLinks.json, we can see that the fingerprints are contained in arrays by package names.
  4. Checking out why my site was not validated in Google Play Console

Note: I could not recreate the error message Google Play Console told me to update my asssetlinks.json file to contain all the fingerprints in one array. I will edit this pull request again if I manage to do so.

[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "app.web.test.twa",
      "sha256_cert_fingerprints": [
        "fingerprint1",
        "fingerprint2"
      ]
    }
  }
]

Todos

  • Update corresponding testing files
  • Recreate Google Play Console Error Message

Make generateAssetLinks function to contain fingerprints in one item in array instead of spreading them out one by one.
@andreban
Copy link
Member

Looping in @PEConn, as he may remember the details better. IIRC, listing all the fingerprints in the array is the approach thought to be right initially, but then found that the current implementation, which is documented here, is the correct one.

@PEConn
Copy link
Collaborator

PEConn commented Mar 13, 2023

It turns out we were originally correct and our "correction" was unnecessary. According to this - "This field supports multiple fingerprints, which can be used to support different versions of your app, such as debug and production builds.".

So, putting all the fingerprints in a single array should work. (However, my understanding is that having separate entries should also work.)

@andreban
Copy link
Member

Ah, thanks for clarifying @PEConn. PR looks good to me then.

@andreban andreban self-requested a review March 13, 2023 15:47
Copy link
Member

@andreban andreban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@andreban andreban merged commit 81adecf into GoogleChromeLabs:main Mar 13, 2023
@andreban andreban added the bug Something isn't working label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants