شروع شدن
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
بررسی اجمالی
پروتکل Digital Asset Links و API به یک برنامه یا وب سایت امکان می دهد تا اظهارات عمومی و قابل تأیید را در مورد سایر برنامه ها یا وب سایت ها ارائه دهد. برای مثال، یک وبسایت میتواند اعلام کند که با یک برنامه اندرویدی خاص مرتبط است، یا میتواند اعلام کند که میخواهد اعتبار کاربر را با وبسایت دیگری به اشتراک بگذارد.
در اینجا برخی از کاربردهای احتمالی پیوندهای دارایی دیجیتال آورده شده است:
- وبسایت A اعلام میکند که اگر برنامه نصب شده باشد، پیوندهای سایت آن باید در یک برنامه تعیینشده در دستگاههای تلفن همراه باز شود.
- وبسایت A اعلام میکند که میتواند اعتبار کاربری Chrome خود را با وبسایت B به اشتراک بگذارد تا کاربر مجبور نباشد در صورت ورود به وبسایت A، وارد وبسایت B شود.
- برنامه A اعلام می کند که می تواند تنظیمات دستگاه مانند مکان را با وب سایت B به اشتراک بگذارد.
شرایط کلیدی
- اصلی: اصلی برنامه یا وب سایتی است که بیانیه را ارائه می دهد. در پیوندهای دارایی دیجیتال، اصلی همیشه برنامه یا وب سایتی است که لیست بیانیه را میزبانی می کند.
- فهرست بیانیه ها : اظهارات در فهرست بیانیه ای قرار می گیرند که حاوی یک یا چند عبارت است. فهرست بیانیه متنی واضح و قابل دسترسی برای عموم است، در مکانی که توسط مدیر کنترل می شود و جعل یا دستکاری در آن دشوار است. این می تواند یک فایل مستقل یا بخشی از آیتم بزرگتر دیگری باشد. به عنوان مثال، در یک وب سایت، یک فایل کامل است. در یک برنامه اندروید، بخشی در مانیفست برنامه است. اظهارات می تواند توسط هر کسی، با استفاده از روش های غیر اختصاصی مشاهده و تأیید شود. برای اطلاعات بیشتر به مستندات لیست بیانیه مراجعه کنید .
- بیانیه: یک دستور یک ساختار JSON کاملاً ساختار یافته است که از یک رابطه (آنچه در بیانیه میگوید انجام دهید، به عنوان مثال: فعال کردن اعتبار اشتراکگذاری) و یک هدف (وبسایت یا برنامهای که این رابطه برای آن اعمال میشود) تشکیل شده است. بنابراین، هر عبارت مانند یک جمله است که در آن اصل رابطه در مورد هدف را می گوید.
- بیانیه مصرف کننده: یک مصرف کننده بیانیه لیستی از بیانیه را از یک اصلی درخواست می کند، وجود یک بیانیه را در مقابل یک اصل معین بررسی می کند و در صورت وجود می تواند عمل مشخص شده را انجام دهد. برای اطلاعات بیشتر به بیانیه comsuming مستندات مراجعه کنید .
مثال استفاده سریع
در اینجا یک مثال بسیار ساده از اینکه چگونه وب سایت www.example.com می تواند از پیوندهای دارایی دیجیتال استفاده کند تا مشخص کند که هر پیوند به URL در آن سایت باید در یک برنامه تعیین شده به جای مرورگر باز شود، آمده است:
- وب سایت www.example.com یک لیست بیانیه را در https://www.example.com/.well-known/assetlinks.json منتشر می کند. این نام و مکان رسمی برای لیست بیانیه در یک سایت است. لیست های بیانیه در هر مکان دیگری یا با هر نام دیگری برای این سایت معتبر نیست. در مثال ما، فهرست عبارت از یک عبارت تشکیل شده است که به برنامه اندرویدی خود اجازه میدهد پیوندها را در سایت خود باز کند:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app",
"sha256_cert_fingerprints": ["hash_of_app_certificate"] }
}]
یک لیست عبارت از آرایهای از عبارات در علامتهای [ ] پشتیبانی میکند، اما فایل مثال ما فقط حاوی یک عبارت است. . sha256_cert_fingerprints
اثر انگشت SHA256 گواهی امضای برنامه شما است. جزئیات بیشتر را در اسناد پیوندهای برنامه Android بیابید. - برنامه Android فهرست شده در بیانیه بالا دارای یک فیلتر قصد است که طرح، میزبان و الگوی مسیر URL هایی را که می خواهد مدیریت کند، مشخص می کند: در این مورد، https://www.example.com. فیلتر قصد شامل یک ویژگی خاص
android:autoVerify
است که در Android M جدید است، که نشان میدهد Android باید هنگام نصب برنامه، عبارت موجود در وبسایتی را که در فیلتر intent توضیح داده شده است تأیید کند. - یک کاربر برنامه را نصب می کند. Android فیلتر intent را با ویژگی
autoVerify
می بیند و وجود لیست بیانیه را در سایت مشخص شده بررسی می کند. در صورت وجود، Android بررسی میکند که آیا آن فایل حاوی بیانیهای است که مدیریت پیوند را به برنامه اعطا میکند یا خیر، و برنامه را در برابر بیانیه با هش گواهی تأیید میکند. اگر همه چیز بررسی شود، Android هر هدف https://www.example.com را به برنامه example.com ارسال می کند. - کاربر روی پیوندی به https://www.example.com/puppies در دستگاه خود کلیک می کند. این پیوند می تواند در هر جایی باشد: در یک مرورگر، در یک پیشنهاد Google Search Appliance یا هر جای دیگری. Android هدف را به برنامه example.com ارسال می کند.
- برنامه example.com هدف را دریافت میکند و انتخاب میکند که آن را مدیریت کند و صفحه تولهها را در برنامه باز میکند. اگر به دلایلی برنامه از مدیریت پیوند امتناع میکرد، یا اگر برنامه در دستگاه نبود، پیوند به کنترلکننده هدف پیشفرض بعدی که با الگوی هدف مطابقت دارد (اغلب مرورگر) ارسال میشد.
ملاحظات و محدودیت های مهم:
- پروتکل اصل را تایید نمی کند که بیانیه را صادر می کند، اما بیانیه در یک مکان خاص قرار دارد که به شدت با مدیر اصلی مرتبط است و تحت کنترل مدیر اصلی است.
- پروتکل هدف بیانیه را احراز هویت نمی کند، اما ابزاری را برای تماس گیرنده فراهم می کند تا هدف را احراز هویت کند (به عنوان مثال، یک بیانیه اهداف برنامه تلفن همراه را با هش گواهی و نام بسته شناسایی می کند).
- پروتکل به طور بومی هیچ اقدامی را انجام نمی دهد. بلکه امکان افشای عبارات را فراهم می کند، که یک برنامه مصرف کننده باید آنها را تأیید کند و سپس تصمیم بگیرد که آیا و چگونه بر اساس آن عمل کند. Android M به صورت بومی این مراحل را برای شما انجام می دهد. برای مثال، اگر وبسایتی مدیریت پیوند را به یک برنامه خاص واگذار کند، Android بیانیه را بررسی و تأیید میکند، برنامه هدف را تأیید میکند و سپس به برنامه گزینه مدیریت پیوند داده شده را ارائه میدهد.
- این پروتکل امکان اظهار نظر در مورد دو شخص ثالث را نمی دهد: یعنی وب سایت A می تواند در مورد وب سایت B بیانیه ای ارائه دهد، اما وب سایت A نمی تواند بیانیه ای در مورد رابطه وب سایت B با وب سایت C ارائه دهد. با این حال، اگر وب سایت B به وب سایت A اعتماد داشته باشد، آن را نشان می دهد. می تواند وب سایت A را برای بیانیه ای که به وب سایت C اجازه می دهد بررسی کند و تصمیم به اجرای آن بگیرد.
مراحل بعدی
- ببینید آیا مستندات صریح برای مورد استفاده شما وجود دارد یا خیر.
- درباره ایجاد یک بیانیه بیاموزید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-06-26 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2024-06-26 بهوقت ساعت هماهنگ جهانی."],[[["\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)"]]