【译】Asset Links Specification

Overview

 Asset Link 是一个安全地获取声明的协议,该声明由digital asset支持,比如网站或者移动app或者其他digital asset来声明两者直接的关系。声明可以可靠地被作为持有者源assets地属性。

Statement Model

 一个digital asset 就是一个可以被识别和定位的在线实体,通常会提供服务和内容。通常assets的例子就是网站,移动应用和社会化多媒体页面。
 asset的所有者具有控制和发言的权利。

 asset的所有者可以通过创建statement来建立不同的asset之间的关系。一种关系的示例就是权限委派。比如说一个网站的所有者可以赋予某个app具有处理某些url的能力。两者的关系是公开化的信息。
 特定类型的关系在asset文件里定义两者之间的任意关联。这种关联既不是对称的,可传递的,也不是反对称或者非可传递的。
 一个statement S(r, a, b)是一个关系r的判定,r持有有序的(a,b)。
 比如,r=“delegates permission to handle the site's URLs”, a = nytimes.com website,b = New York Times mobile app,,那么S(r, a, b)就可以被认为nytimes.com网站委派 the New York Times应用具有处理该网站地址的能力。

Data Types

AssetDescriptor

 我们用AssetDescriptor来给asset命名,asset是一个json格式的字符串。对于初始化的API版本,我们仅支持两种类型的asset类型,web sites 和 Android apps(在将来,可能会考虑添加其他类型但是不影响模型)。
Web site descriptors 如下:

// if no port given, default port for scheme is assumed
{ "namespace": "web",
  "site": "http[s]://{fully-qualified domain}{:optional port}"
}

 我们同时仅仅支持一个完全的域名。在url里只允许配置全限定域名。
Android app descriptors 如下:

{ "namespace": "android_app", "package_name": "[Java package name]",
  "sha256_cert_fingerprints": ["[SHA256 fingerprint of signing cert]",
            "[additional allowed cert]", ...]
}

  sha256_cert_fingerprints一个由冒号分割的16进制字符串列表。该列表是一个语法糖:因为一个app只需要去验证一个证书。一个asset descriptor关联两个fingerprint等价于两个asset descriptor关联了一个fingerprint。
 举个关于Android app descriptor例子:

{ "namespace": "android_app", "package_name": "com.costingtons.app",
  "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:"
     "A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]}

 特别地,我们并不会去查询app的版本。一个phone-based的实现可能回去匹配最近安装的版本,同时中央服务会使用app在goole play store上的最近的版本。
iOS App asset descriptors如下所示:

{ "namespace": "ios_app", "appid": "585027354" }

Relation

Relation描述了statement的性质,由kind和detial组成。kinds的集合由API枚举:

Kind Description/Reliability determination
delegate_permission The detail field specifies which permission to delegate. A statement involving this relation does not constitute a requirement to do the delegation, just a permission to do so. How to determine reliability: A statement of this kind is reliable if it's made by the owner of the asset doing the delegating.

 我们期望在将来添加其它的kind,但是我们会谨慎行事。
 detail字段由小写的字母数字,下划线和句号构成(匹配正则表达式[a-z0-9_.]+)。

Pre-defined kind / detail Description
delegate_permission/common.handle_all_urls Delegates the ability to handle all URLs that the source asset can handle.

 如果定义自定义detail字符串,我们建议使用java风格作用域。e.g,com.google.app.detailstring

Statement

 Statement的示例:

{
 "relation": ["{kind}/{detail}", ...],
 "target" : { AssetDescriptor }
}
{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target" : { "namespace": "android_app",
               "package_name": "com.mydomain.app",
               "sha256_cert_fingerprints": ["[cert hash]"] }
}

 如果源asset的分发机制是安全的,所包含的文件必须要能通过https访问,只有当http状态码是200的时候才U会处理内部包含的文件,其它情况下包含的文件会被直接抛弃,http的30x的重定向是不允许的。

你可能感兴趣的:(【译】Asset Links Specification)