CACAO-ZCAP

Chain-Agnostic CApability Objects (CACAOs) as Authorization Capabilities (zCaps)

Unofficial Draft

More details about this document
Latest published version:
https://www.w3.org/cacao-zcap/
Latest editor's draft:
https://demo.didkit.dev/2022/cacao-zcap/
History:
Commit history
Editor:
Charles E. Lehner (Spruce)
Feedback:
GitHub spruceid/cacao-zcap (pull requests, new issue, open issues)
public-credentials@w3.org with subject line [cacao-zcap] … message topic … (archives)

Abstract

Status of This Document

This document is a draft of a potential specification. It has no official standing of any kind and does not represent the support or consensus of any standards organization.

1. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key word MUST in this document is to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

2. Context

This specification defines the following JSON-LD Context file: https://demo.didkit.dev/2022/cacao-zcap/contexts/v1.json

JSON-LD documents using CacaoZcap2022 and CacaoZcapProof2022 are expected to use this context file in @context following the [SECURITY-VOCABULARY] context (https://w3id.org/security/v2), i.e.:

{
  "@context": [
    "https://w3id.org/security/v2",
    "https://demo.didkit.dev/2022/cacao-zcap/contexts/v1.json"
  ],
  ...
}

3. CACAO-ZCAP Mapping

CACAO property Relationship/Value ZCAP property Required?
h.t = cacaoPayloadType yes
p.domain = proof.domain yes
p.iss DID ↔ DID URL proof.verificationMethod yes
p.aud = invoker yes
p.version "1" yes
[...] @context yes
"CacaoZcap2022" type yes
"CacaoZcapProof2022" proof.type yes
p.nonce = proof.nonce yes
p.iat = proof.created yes
p.nbf = proof.validFrom no
p.exp = expires no
p.statement statement-actions mapping cacaoZcapSubstatement, allowedAction no
p.requestId = requestId no
. CID → id no
p.resources[0] = invocationTarget yes
p.resources[0] URL ↔ ZCAP Root URN proof.capabilityChain[0] no
p.resources[1..n-2] = proof.capabilityChain[1..n-2] no
p.resources[n-1] Object ↔ Data URI proof.capabilityChain[n-1] no
s.t = proof.cacaoSignatureType yes
s.s bytes ↔ multibase proof.proofValue no

3.1 id CID UUID mapping

The CACAO is serialized using [DAG-CBOR]. A SHA-256 hash is computed over this serialization. The last 16 bytes of the hash (dropping the initial 16) is used as "pseudo-random" input to a [RFC4122] v4 UUID. This UUID is represented as a URN by prefixing it with "urn:uuid:". This URN is used as the id of the delegation object.

3.2 issuer-verificationMethod mapping

The CACAO payload issuer property (p.iss) is defined by [CACAO] to be a [DID-PKH] DID. The proof verificationMethod property is expected to be a DID URL resolving to a verification method map. CACAO-ZCAP converts between these two fields (CACAO issuer and verification method URL) by assuming that the issuer DID has a default verification method, that the CACAO signature is created using the verification material of that default verification method, and that the default verification method allows creating a proof of type CacaoZcapProof2022.

3.3 Root ZCAP mapping

The first value of the CACAO payload resources array is used as the invocation target URI, that is the value of the zcap delegation's invocationTarget property. The invocation target URI is encoded into a root zcap URN to become the root capability id. The root zcap URN is constructed as the concatenation of "urn:zcap:root:" with encodeURIComponent(invocationTarget). To transform the root zcap URN to the invocation target URI, the prefix "urn:zcap:root:" is removed and the remaining value is URL-decoded to return the invocation target id.

3.4 Intermediate ZCAP mapping

If the proof capabilityChain array / CACAO resources array (p.resources) contain more than two elements, the intermediate elements are passed through as URIs.

3.5 Previous ZCAP mapping

The last value of the proof capabilityChain array / CACAO resources array (p.resources) represents the previous delegation. If the previous delegation is the root delegation, the capabilityChain array contains only the root delegation id, as a single value. If the previous delegation is a non-root delegation, the last value of the proof capabilityChain array is the previous delegation embedded as an object. The embedded previous delegation is represented in the last value of the CACAO resources array (p.resources) as a [RFC2397] Data URI containing the Base64-encoded JSON object serialized with [RFC8785] JSON Canonicalization Scheme (JCS).

3.6 signature-proofValue mapping

In CACAO, the signature is represented with an IPLD bytes type. In ZCAP and data integrity proofs, the signature is typically represented in a string in the proofValue property of the proof object. CACAO-ZCAP encodes the signature in the proofValue property using [MULTIBASE].

3.7 statement-actions mapping

The CACAO statement string MUST match the following ABNF (extending RFC 3986):

statement        = stmt-noaction / stmt-action
stmt-noaction    = "Authorize action" substmt-opt
stmt-action      = "Authorize action (" actions ")" substmt-opt
substmt-opt      = [ ": " substatement ]
actions          = action *( ", " action )
action           = *( reserved / unreserved / " " )
substatement     = *( reserved / unreserved / " " )

The substatement is the value of the cacaoZcapSubstatement proof property if present.

The action values are represented in the proof's allowedAction property as follows:

4. CACAO-ZCAP Vocabulary

This document defines the following terms, in the namespace https://demo.didkit.dev/2022/cacao-zcap/#.

In JSON-LD, these terms may be imported using 2. Context.

4.1 CacaoZcap2022

A CACAO interpreted as an authorization capability delegation.

The proof property should be an object of type CacaoZcapProof2022. The invocationTarget property should be the URL to which an entity is being authorized access.

Status
unstable
Expected properties
type, parentCapability, invocationTarget, expires, allowedAction, cacaoZcapSubstatement, cacaoRequestId, proof

4.2 CacaoZcapProof2022

A data integrity proof over an authorization capability delegation document (CacaoZcap2022), together representing a CACAO.

Status
unstable
Expected properties
type, created, verificationMethod, proofPurpose, proofValue, domain, nonce, capabilityChain, cacaoPayloadType, cacaoSignatureType

4.3 cacaoPayloadType

CACAO payload format type (CACAO header "t" value). e.g. "eip4361".

Status
unstable
Expected type
xsd:string

4.4 cacaoSignatureType

CACAO signature type (CACAO signature "t" value). e.g. "eip191" or "eip1271".

Status
unstable
Expected type
xsd:string

4.5 cacaoZcapSubstatement

CACAO substatement, parsed from the CACAO payload "statement" value according to the statement-actions mapping.

Status
unstable
Expected type
xsd:string

4.6 cacaoRequestId

CACAO request ID (CACAO payload "requestId" value).

Status
unstable
Expected type
xsd:string

5. Security Considerations

This section is non-normative.

5.1 Content in zCap not included in CACAO

This section is non-normative.

Certain properties of the zCap delegation and proof object do not appear in the CACAO object but are synthesized as part of the 3. CACAO-ZCAP Mapping. In particular, the delegation type property with value CacaoZcap2022, proof type property with value CacaoZcapProof2022, and proof proofPurpose property with value capabilityDelegation. Other properties are passed through from the CACAO into the delegation/proof but with different property names, which may have different meanings, e.g. iss as verificationMethod, and iat as created. It is possible therefore that an entity may sign/create a CACAO without intending it to be used as CacaoZcap2022/CacaoZcapProof2022 or realizing that it may be used as such. Applications may want to pay close attention to the CACAO-ZCAP statement substring (cacaoZcapSubstatement) - which is expected to be seen by the user during signing - for determining how much to rely on a CacaoZcap2022/CacaoZcapProof2022 for authorization/delegation purposes.

A. References

A.1 Normative references

[CACAO]
CACAO: Chain Agnostic CApability Object. Sergey Ukustov. CASA. March 2022. URL: https://github.com/ChainAgnostic/CAIPs/blob/91aaaff73038c2629ff11b88c2209f61521d8ece/CAIPs/caip-74.md
[DAG-CBOR]
DAG-CBOR: CBOR IPLD format. Rod Vagg; Volker Mische; Mikeal Rogers. IPLD. August 2019. Descriptive - Draft. URL: https://ipld.io/specs/codecs/dag-cbor/spec/
[DID-CORE]
Decentralized Identifiers (DIDs) v1.0. Manu Sporny; Amy Guy; Markus Sabadello; Drummond Reed. W3C. 19 July 2022. W3C Recommendation. URL: https://www.w3.org/TR/did-core/
[DID-PKH]
The did:pkh Method. Wayne Chang; Charles Lehner; Juan Caballero; Joel Thorstensson. W3C Credentials Community Group. February 2022. W3C Community Group Draft. URL: https://github.com/w3c-ccg/did-pkh/blob/ea93b0a5e0e8b54e572f3a6ca5a294f147901d2d/did-pkh-method-draft.md
[MULTIBASE]
The Multibase Encoding Scheme. Juan Benet; Manu Sporny. IETF. February 2022. Internet-Draft. URL: https://datatracker.ietf.org/doc/html/draft-multiformats-multibase-05
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119
[RFC2397]
The "data" URL scheme. L. Masinter. IETF. August 1998. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc2397
[RFC4122]
A Universally Unique IDentifier (UUID) URN Namespace. P. Leach; M. Mealling; R. Salz. IETF. July 2005. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc4122
[RFC8174]
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174
[RFC8785]
JSON Canonicalization Scheme (JCS). A. Rundgren; B. Jordan; S. Erdtman. IETF. June 2020. Informational. URL: https://www.rfc-editor.org/rfc/rfc8785
[SECURITY-VOCABULARY]
Security Linked Data Vocabulary. Manu Sporny; David Longley. Web Payments Community Group. CGDRAFT. URL: https://w3id.org/security