دليل البدء
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
نظرة عامة
يتيح بروتوكول "روابط مواد العرض الرقمية" وواجهة برمجة التطبيقات للتطبيق أو الموقع الإلكتروني نشر بيانات علنية
يمكن التحقق منها عن تطبيقات أو مواقع إلكترونية أخرى. على سبيل المثال، يمكن لموقع إلكتروني أن يعلن عن أنّه مرتبط بتطبيق Android محدّد، أو يمكنه الإفصاح عن أنّه يريد مشاركة بيانات اعتماد المستخدم مع موقع إلكتروني آخر.
في ما يلي بعض الاستخدامات الممكنة لميزة "روابط مواد العرض الرقمية":
- يعلن الموقع الإلكتروني "أ" أنّ الروابط المؤدية إلى موقعه الإلكتروني يجب أن تفتح في تطبيق معيّن على
الأجهزة الجوّالة إذا كان التطبيق مثبّتًا.
- يعلن الموقع الإلكتروني "أ" أنّه يمكنه مشاركة بيانات اعتماد مستخدم Chrome مع الموقع الإلكتروني "ب" حتى لا يضطر المستخدم إلى تسجيل الدخول إلى الموقع الإلكتروني "ب" في حال تسجيل الدخول إلى الموقع الإلكتروني "أ".
- يشير التطبيق "أ" إلى أنّه يمكنه مشاركة إعدادات الجهاز، مثل الموقع الجغرافي، مع الموقع الإلكتروني "ب".
المصطلحات الرئيسية
- مدير: يكون المحتوى الرئيسي هو التطبيق أو الموقع الإلكتروني الذي يصدر البيان. في روابط الأصول الرقمية، يكون العنصر الأساسي دائمًا هو التطبيق أو الموقع الإلكتروني الذي يستضيف قائمة الكشف.
- قائمة العبارات: تكون العبارات مضمّنة في قائمة العبارات التي تحتوي على
عبارة واحدة أو أكثر. قائمة العبارات هي نص واضح ويمكن الوصول إليها بشكل علني، وتوضع في مكان يتحكم فيه المدير ويصعب انتحاله أو التلاعب به.
يمكن أن يكون ملفًا مستقلاً أو قسمًا من عنصر آخر أكبر. على سبيل المثال، يكون الملف على موقع إلكتروني كاملاً، أما في تطبيق Android، فهو قسم في بيان التطبيق.
يمكن لأي شخص الاطّلاع على البيانات وإثبات ملكيتها باستخدام طرق غير ملكية. يُرجى الاطّلاع على مستندات قائمة الكشف للحصول على مزيد من المعلومات.
- العبارة: العبارة هي بنية JSON منظَّمة بإحكام تتكوّن من relation (ما تنص عليه العبارة فعله، مثل: تفعيل مشاركة بيانات الاعتماد) وrelation (الموقع الإلكتروني أو التطبيق الذي تنطبق عليه العلاقة). لذلك، تكون كل عبارة مثل جملة، حيث يشير principal إلى relation حول target.
- مستهلك البيان: يطلب المستهلك الحصول على قائمة بيان من جهة رئيسية، ويتحقّق من توفُّر عبارة مقارنةً بأساسي معيّن، ويمكنه تنفيذ الإجراء المحدّد إن كان متوفرًا. لمزيد من المعلومات، يمكنك الاطّلاع على البيان الذي يتضمّن المستندات.
مثال على الاستخدام السريع
إليك مثال مبسَّط للغاية لكيفية استخدام الموقع الإلكتروني www.example.com
لروابط مواد العرض الرقمية لتحديد أنّ أي روابط تؤدي إلى عناوين URL في ذلك الموقع الإلكتروني يجب
فتحها في تطبيق مخصّص بدلاً من المتصفّح:
- ينشر الموقع الإلكتروني www.example.com قائمة بيانات على
https://www.example.com/.well-known/assetlinks.json. هذا هو الاسم الرسمي والموقع الجغرافي لقائمة الكشف على موقع إلكتروني. وقوائم البيان في أي
مكان آخر أو بأي اسم آخر ليست صالحة لهذا الموقع. في المثال الذي عرضناه، تتكوّن قائمة العبارات من عبارة واحدة تمنح تطبيق Android الإذن بفتح الروابط على موقعها الإلكتروني:
[{
"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 App Links.
- يحتوي تطبيق Android المدرَج في العبارة أعلاه على فلتر أهداف يحدّد المخطط والمضيف ونمط المسار لعناوين URL التي يريد معالجتها: في هذه الحالة، https://www.example.com. يتضمّن فلتر الأهداف سمة خاصة
android:autoVerify
، جديدة على Android M، والتي تشير إلى أنّه على Android التحقّق من العبارة الواردة في الموقع الإلكتروني الموضّح في فلتر الأهداف عند تثبيت التطبيق.
- يثبّت أحد المستخدمين التطبيق. يرى نظام التشغيل Android فلتر الأهداف الذي يتضمّن
السمة
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 من العبارة ويتأكّد من صحتها، ويتحقّق من التطبيق المستهدَف،
ثم يوفّر للتطبيق خيار التعامل مع الرابط المحدَّد.
- ولا يسمح البروتوكول بالتصريح عن طرفَين ثالثَين: بمعنى أن الموقع الإلكتروني "أ" يمكنه إصدار بيان حول الموقع الإلكتروني "ب"،
ولكن الموقع الإلكتروني "أ" لا يمكنه التصريح عن علاقة الموقع الإلكتروني "ب"
بالموقع الإلكتروني "ج". في المقابل، إذا كان الموقع الإلكتروني "ب" يثق في الموقع الإلكتروني "أ"، يمكنه مراجعة الموقع الإلكتروني "أ" بحثًا عن عبارة تمنح الإذن للموقع الإلكتروني "ج" واتخاذ قرار بتنفيذ ذلك.
الخطوات التالية
- تحقَّق مما إذا كانت هناك مستندات واضحة تشير إلى حالة استخدامك.
- تعرَّف على مزيد من المعلومات عن إنشاء كشف.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة 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)"]]