From e319c473623661e47ebee6ddbe84e1358197a270 Mon Sep 17 00:00:00 2001 From: Will Scott Date: Sat, 15 Oct 2022 10:55:36 -0500 Subject: [PATCH 1/2] Describe the double-hashed FindProviders reframe request in parallel to the current method. FindHashedSHA256Request requests content routing records using a derived hash of a CID of interest. This extension to reframe also introduces authenticaled content routing records that can be returned by this method. These records will blind the true peer ID of the provider, and are extended with a signature allowing the requester to validate their authenticity. --- reframe/REFRAME_KNOWN_METHODS.md | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/reframe/REFRAME_KNOWN_METHODS.md b/reframe/REFRAME_KNOWN_METHODS.md index 8db977d20..f700224c2 100644 --- a/reframe/REFRAME_KNOWN_METHODS.md +++ b/reframe/REFRAME_KNOWN_METHODS.md @@ -22,6 +22,7 @@ This document is defining known methods (request-response message types) and sem - [Identify DAG-JSON Examples](#identify-dag-json-examples) - [FindProviders](#findproviders) - [FindProviders DAG-JSON Examples](#findproviders-dag-json-examples) + - [FindProvidersBlinded](#findproviders-blinded) - [GetIPNS](#getipns) - [GetIPNS DAG-JSON Examples](#getipns-dag-json-examples) - [PutIPNS](#putipns) @@ -39,6 +40,7 @@ The known Request types are the following and are described below: type Request union { | "IdentifyRequest" IdentifyRequest | "FindProvidersRequest" FindProvidersRequest + | "FindHashedSHA256Request" FindHashedSHA256Request | "GetIPNSRequest" GetIPNSRequest | "PutIPNSRequest" PutIPNSRequest | "ProvideRequest" ProvideRequest @@ -51,6 +53,7 @@ The known Response types are the following and are described below: type Response union { | "IdentifyResponse" IdentifyResponse | "FindProvidersResponse" FindProvidersResponse + | "FindHashedSHA256Response" FindHashedSHA256Response | "GetIPNSResponse" GetIPNSResponse | "PutIPNSResponse" PutIPNSResponse | "ProvideResponse" ProvideResponse @@ -69,6 +72,7 @@ The following methods (request-response pairs) are _cachable_: type CachableRequest union { | "IdentifyRequest" IdentifyRequest | "FindProvidersRequest" FindProvidersRequest + | "FindHashedSHA256Request" FindHashedSHA256Request | "GetIPNSRequest" GetIPNSRequest } ``` @@ -145,6 +149,7 @@ Note: While the Key is a CID it is highly recommended that server implementation # We expect different types of nodes, e.g. peer, miner, public IP, etc. type Node union { | Peer "peer" + | AuthenticatedPeer "apeer" # This type will be returned in blinded queries | Any default } representation keyed @@ -203,6 +208,36 @@ Response: }} ``` +### FindProviders Blinded + +A message for finding nodes with interest in a given key using double hashing to blind the key being requested. + +```ipldsch + type FindHashedSHA256Request struct { + Query Bytes + } +``` + +The query is a derived hash of the multihash being requested. +The full semantics of double hashing in the context of content routing are described at https://www.notion.so/protocollabs/IPFS-Double-Hashing-Repurpose-8fdaae8748414ae592a5d24d59c0d8ed + +```ipldsch + type FindHashedSHA256Response struct { + Providers [Provider] + } + + type AuthenticatedPeer struct { + // ID is included in this superset of 'Peer' + ID Bytes // Enc_{MH}(PeerID || 0[32bytes]) + // Multiaddresses may be set as a hint if the server knows the publisher. + Multiaddresses optional [Bytes] + + Signature Bytes // signature of ID field by the publisher's PeerID. + } +} +``` + + ### GetIPNS A message for finding the latest IPNS records for a given identifier. From 9db33578c26cfd5a31194d290d03cd1252186e2c Mon Sep 17 00:00:00 2001 From: Will Scott Date: Sat, 15 Oct 2022 11:02:19 -0500 Subject: [PATCH 2/2] further detail into construction of the derived query --- reframe/REFRAME_KNOWN_METHODS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reframe/REFRAME_KNOWN_METHODS.md b/reframe/REFRAME_KNOWN_METHODS.md index f700224c2..27447da84 100644 --- a/reframe/REFRAME_KNOWN_METHODS.md +++ b/reframe/REFRAME_KNOWN_METHODS.md @@ -219,6 +219,9 @@ A message for finding nodes with interest in a given key using double hashing to ``` The query is a derived hash of the multihash being requested. +It is constructed by taking the raw bytes of the multihash, prepending the ascii bytes "CR_DOUBLEHASH", and taking the SHA256 hash of that data. +The resulting digest is then packed itself into a multihash, using the multihash code identifier multihash.DBL_SHA2_256. + The full semantics of double hashing in the context of content routing are described at https://www.notion.so/protocollabs/IPFS-Double-Hashing-Repurpose-8fdaae8748414ae592a5d24d59c0d8ed ```ipldsch