Routing V1 HTTP Delegated Routing Reader Privacy Upgrade

status: reliable
Editors
Andrew Gillis GitHub
Ivan Schasny GitHub
Masih Derkani GitHub
Will Scott GitHub
History
Commit History
Feedback
GitHub ipfs/specs (pull requests, new issue, open issues)

This specification details the implementation of a new HTTP API for Privacy Preserving Delegated Content Routing provider lookups. It represents an expansion of the HTTP Delegated Routing API, embracing its formats and design principles.

1. API Specification

1.1 Magic Values

All salts below are 64-bytes long and represent a string padded with \x00.

These magic values are utilized to compute distinct digests from identical values for varying purposes. For instance, a hash of a Multihash employed for lookups should differ from the one used for key derivation, despite originating from the same value. To achieve this, the Multihash is concatenated with different magic values before applying the hash function: SALT_DOUBLEHASH for lookups and SALT_ENCRYPTIONKEY for key derivation as elaborated in the Glossary.

1.2 Glossary

Maximum allowed lengths may change without incrementing the API version. Such fields as contextID or Metadata are free-form bytes and their maximum lengths can be altered in the underlying protocols.

1.3 API

1.3.1 GET /routing/v1/encrypted/providers/{HASH2}

1.3.1.1 Response codes
  • 200 (OK): the response body contains one or more records
  • 404 (Not Found): must be returned if no matching records are found
  • 422 (Unprocessable Entity): request does not conform to schema or semantic constraints
1.3.1.2 Response Body
{
    "EncProviderRecordKeys": [
        "EBxdYDhd.....",
        "IOknr9DK....."
    ]
}


Where:

  • EncProviderRecordKeys is a list of base64 encoded EncProviderRecordKey;

1.3.2 GET /routing/v1/encrypted/metadata/{HashProviderRecordKey}

1.3.2.1 Response codes
  • 200 (OK): the response body contains one record
  • 404 (Not Found): must be returned if no matching records are found
  • 422 (Unprocessable Entity): request does not conform to schema or semantic constraints
1.3.2.2 Response Body
{
    "EncMetadata": "EBxdYDhd....."
}

Where:

  • EncMetadata is a base64 encoded EncMetadata;

1.4 Notes

Assembling a full ProviderRecord from the encrypted data requires multiple server roundtrips. The first fetches a list of EncProviderRecordKeys, followed by one for each EncProviderRecordKey to retrieve EncMetadata. To minimize the number of roundtrips to one, the client implementation should use the local libp2p peerstore for multiaddress discovery and libp2p multistream select for protocol negotiation.