スタートガイド
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
概要
Digital Asset Links プロトコルと API を使用すると、アプリやウェブサイトは、他のアプリやウェブサイトに関する検証可能なステートメントを公開できます。たとえば、あるウェブサイトで特定の Android アプリに関連付けられていることを宣言したり、ユーザーの認証情報を別のウェブサイトと共有することを宣言したりできます。
デジタル アセット リンクの用途としては、次のようなものが考えられます。
- ウェブサイト A では、モバイル デバイスの指定アプリがインストールされている場合、そのサイトへのリンクをそのアプリで開くよう宣言しています。
- ウェブサイト A は、Chrome ユーザーの認証情報をウェブサイト B と共有できることを宣言しています。これにより、ユーザーはウェブサイト A にログインしている場合にウェブサイト B にログインする必要がなくなります。
- アプリ A は、位置情報などのデバイスの設定をウェブサイト B と共有できることを宣言します。
主な用語
- プリンシパル: プリンシパルとは、主張を行っているアプリまたはウェブサイトです。デジタル アセット リンクのプリンシパルは常に、ステートメント リストをホストするアプリまたはウェブサイトです。
- ステートメント リスト: ステートメントは、1 つ以上のステートメントを含むステートメント リストに含まれています。ステートメント リストは平文で、誰でもアクセス可能で、プリンシパルによって管理され、スプーフィングや改ざんが困難な場所にあります。独立したファイルでも、別の大きなアイテムの一部でもかまいません。たとえば、ウェブサイトではファイル全体、Android アプリではアプリ マニフェスト内のセクションです。明細書は、独自の方法で誰でも閲覧、検証できます。詳細については、ステートメント リストのドキュメントをご覧ください。
- ステートメント: ステートメントは、relation(ステートメントで指示される内容、たとえば、認証情報の共有を有効にする)とrelation(リレーションが適用されるウェブサイトまたはアプリ)で構成される、厳密に構造化された JSON コンストラクトです。したがって、各ステートメントは、プリンシパルがターゲットに関する関係を言います。
- ステートメント コンシューマ: ステートメント コンシューマは、プリンシパルにステートメント リストをリクエストし、指定されたプリンシパルに対するステートメントの存在を確認します。存在する場合は、指定されたアクションを実行できます。詳細については、ドキュメントに含まれるステートメントをご覧ください.
簡単な使用例
以下は、ウェブサイト www.example.com でデジタル アセット リンクを使用して、そのサイトの URL へのリンクをブラウザではなく特定のアプリで開くように指定する非常に簡単な例です。
- ウェブサイト www.example.com は、https://www.example.com/.well-known/assetlinks.json でステートメントのリストを公開しています。サイト上でのステートメント リストの正式名称と場所です。他の場所にあるステートメント リストは、このサイトでは有効ではありません。この例では、ステートメント リストは 1 つのステートメントで構成され、サイトのリンクを開く権限を Android アプリに付与します。
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app",
"sha256_cert_fingerprints": ["hash_of_app_certificate"] }
}]
ステートメント リストは [ ] マーク内のステートメントの配列をサポートしますが、サンプル ファイルにはステートメントが 1 つしか含まれません。
sha256_cert_fingerprints
は、アプリの署名証明書の SHA256 フィンガープリントです。詳しくは、Android アプリリンクのドキュメントをご覧ください。
- 上記の文の Android アプリには、処理する URL のスキーム、ホスト、パスパターンを指定するインテント フィルタがあります。この例では、https://www.example.com です。このインテント フィルタには、Android M で新たに導入された特別な属性
android:autoVerify
が含まれています。この属性は、アプリのインストール時に、インテント フィルタに記述されたウェブサイトのステートメントを Android が検証する必要があることを示します。
- ユーザーがアプリをインストールします。Android は
autoVerify
属性を持つインテント フィルタを検出し、指定されたサイトにステートメント リストが存在するかどうかを確認します。存在する場合、Android はアプリへのリンク処理を付与するステートメントがそのファイルに含まれているかどうかをチェックし、証明書ハッシュによるステートメントとアプリを照合します。すべて確認できたら、Android はすべての https://www.example.com インテントを example.com アプリに転送します。
- ユーザーがデバイスで https://www.example.com/puppies へのリンクをクリックします。このリンクは、ブラウザや Google アプライアンスの提案内など、どこにでも構いません。Android はインテントを example.com アプリに転送します。
- example.com アプリはインテントを受信して処理を選択し、アプリで子犬のページを開きます。なんらかの理由でアプリがリンクの処理を拒否した場合、またはアプリがデバイスにない場合は、そのインテント パターンに一致する次のデフォルト インテント ハンドラ(多くの場合はブラウザ)にリンクが送信されます。
重要な考慮事項と制限事項:
- プロトコルはステートメントを作成するプリンシパルを認証しませんが、ステートメントはプリンシパルと強く関連のある特定のロケーションにあり、プリンシパルの制御下にあります。
- プロトコルはステートメントのターゲットを認証しませんが、呼び出し元がターゲットを認証する手段を提供します(たとえば、ステートメントは証明書ハッシュとパッケージ名によってモバイルアプリのターゲットを識別します)。
- このプロトコルは、ステートメント アクションをネイティブに実行しません。ステートメントを公開する機能を有効にします。ステートメントは、使用側のアプリケーションが検証してから、どのように処理すべきかを決定する必要があります。これらの手順は、Android M がネイティブに実行します。たとえば、ウェブサイトがリンク処理を特定のアプリに委任した場合、Android はステートメントを確認して検証し、ターゲット アプリを検証して、指定されたリンクを処理するオプションをアプリに提供します。
- このプロトコルでは、2 社の第三者に関する記述を行うことはできません。つまり、ウェブサイト A はウェブサイト B について記述できますが、ウェブサイト A はウェブサイト B とウェブサイト C の関係について記述することはできません。ただし、ウェブサイト B がウェブサイト A を信頼している場合、ウェブサイト A にウェブサイト C に権限を付与するステートメントがあるかどうかを確認し、それを実装することができます。
次のステップ
- ユースケースに関する明示的なドキュメントがあるかどうかを確認します。
- 詳しくは、明細書の作成についての記事をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-06-26 UTC。
[null,null,["最終更新日 2024-06-26 UTC。"],[[["\u003cp\u003eDigital Asset Links enable apps and websites to make verifiable statements about their relationships with other apps and websites, such as link handling or credential sharing.\u003c/p\u003e\n"],["\u003cp\u003eThese statements are stored in a publicly accessible statement list, typically an "assetlinks.json" file hosted by the app or website making the statement.\u003c/p\u003e\n"],["\u003cp\u003eAndroid M and above automatically uses Digital Asset Links to verify website-to-app associations and direct links to the appropriate app if installed.\u003c/p\u003e\n"],["\u003cp\u003eThe protocol provides a foundation for trust and delegation between digital entities but relies on consumers to validate and act upon the statements.\u003c/p\u003e\n"]]],[],null,["# Getting Started\n\nOverview\n--------\n\nThe Digital Asset Links protocol and API enable an app or website to make public,\nverifiable *statements* about other apps or websites. For example, a website\ncan declare that it is associated with a specific Android app, or it can declare that\nit wants to share user credentials with another website.\n\nHere are some possible uses for Digital Asset Links:\n\n- Website A declares that links to its site should open in a designated app on mobile devices, if the app is installed.\n- Website A declares that it can share its Chrome user credentials with website B so that the user won't have to log in to website B if it is logged into website A.\n- App A declares that it can share device settings, such as location, with website B.\n\n### Key terms\n\n- **Principal:** The principal is the app or website making the statement. In Digital Asset Links, the principal is always the app or website that hosts the statement list.\n- **Statement list** : Statements are contained in a *statement list* that contains one or more statements. A statement list is cleartext and publicly accessible, in a location that is controlled by the principal and difficult to spoof or tamper with. It can be a free-standing file, or a section of another, larger item. For example, on a website, it is an entire file; in an Android app, it is a section in the app manifest. Statements can be viewed and verified by anyone, using non-proprietary methods. [See the statement list documentation for more information](/digital-asset-links/v1/create-statement).\n- **Statement:** A statement is a tightly structured JSON construct that consists of a *relation* (what the statement says to do, for example: Enable sharing credentials) and a *target* (the website or app that the relation applies to). Therefore, each statement is like a sentence, where *principal* says *relation* about *target* . \n- **Statement consumer:** A statement consumer requests a statement list from a principal, checks for the presence of a statement against a given principal, and if it exists, can perform the action specified. [See the statement comsuming documentation for more information](/digital-asset-links/v1/consuming)*.*\n\nQuick usage example\n-------------------\n\nHere's a very simplified example of how the website www.example.com could\nuse Digital Asset Links to specify that any links to URLs in that site should\nopen in a designated app rather than the browser:\n\n1. The website www.example.com publishes a statement list at https://www.example.com/.well-known/assetlinks.json. This is the official name and location for a statement list on a site; statement lists in any other location, or with any other name, are not valid for this site. In our example, the statement list consists of one statement, granting its Android app the permission to open links on its site: \n\n ```\n [{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\" : { \"namespace\": \"android_app\", \"package_name\": \"com.example.app\",\n \"sha256_cert_fingerprints\": [\"hash_of_app_certificate\"] }\n }]\n ```\n A statement list supports an array of statements within the \\[ \\] marks, but our example file contains only one statement. `sha256_cert_fingerprints` is the SHA256 fingerprints of your app's signing certificate. Find more details in the [Android App Links documentation](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc).\n2. The Android app listed in the statement above has an intent filter that specifies the scheme, host, and path pattern of URLs that it wants to handle: in this case, https://www.example.com. The intent filter includes a special attribute `android:autoVerify`, new to Android M, which indicates that Android should verify the statement on the website described in the intent filter when the app is installed.\n3. A user installs the app. Android sees the intent filter with the `autoVerify` attribute and checks for the presence of the statement list at the specified site; if present, Android checks whether that file includes a statement granting link handling to the app, and verifies the app against the statement by certificate hash. If everything checks out, Android will then forward any https://www.example.com intents to the example.com app.\n4. The user clicks a link to https://www.example.com/puppies on their device. This link could be anywhere: in a browser, in a Google Search Appliance suggestion, or anywhere else. Android forwards the intent to the example.com app.\n5. The example.com app receives the intent and chooses to handle it, opening the puppies page in the app. If for some reason the app had declined to handle the link, or if the app were not on the device, then the link would have been sent to the next default intent handler matching that intent pattern (often the browser).\n\nImportant considerations and limitations:\n-----------------------------------------\n\n- The protocol does not authenticate the principal making the statement, but the statement is located in a specific location strongly associated with the principal, and under control of the principal.\n- The protocol does not authenticate the statement target, but it provides a means for the caller to authenticate the target (for example, a statement identifies mobile app targets by certificate hash and package name).\n- The protocol does not natively perform any statement actions; rather, it enables the ability to expose statements, which a consuming application must validate and then decide whether and how to act upon. Android M natively performs these steps for you; for example, if a website delegates link handling to a specific app, Android checks and verifies the statement, verifies the target app, and then offers the app the option to handle the given link.\n- The protocol does not enable making statements about two third parties: that is, website A can make a statement about website B, but website A cannot make a statement about website B's relationship to website C. However, if website B trusts website A, it can check website A for a statement granting permission to website C, and decide to implement that.\n\nNext steps\n----------\n\n1. [See if there is explicit documentation for your use case.](/digital-asset-links/v1/using)\n2. [Learn about creating a statement.](/digital-asset-links/v1/create-statement)"]]