Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend spec #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Backend spec #2

wants to merge 4 commits into from

Conversation

npmaile
Copy link
Contributor

@npmaile npmaile commented Feb 7, 2023

No description provided.

@npmaile
Copy link
Contributor Author

npmaile commented Feb 7, 2023

I've been sitting on this for a few days, and it will likely need more specifics put in, but this is meant to be as general as possible to allow for alternate implementations

@npmaile npmaile assigned dviator and unassigned ahinchliff and dviator Feb 7, 2023
@npmaile npmaile requested review from ahinchliff, dviator and italianst4 and removed request for ahinchliff and dviator February 7, 2023 21:15
Copy link

@0xRake 0xRake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dude we gotta work on this together.
This is way too vague. There's critical, technical knowledge missing which should be objectively laid out.


**alice** A fictional phonon user generally wishing to receive phonons from bob

**phonon transfer packet** the encrypted data containing a number of phonons while in transit between phonon sce units

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently a phonon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that for purposes of this document I'd rather add a little extra to distinguish between a phonon in-transit and a phonon at rest. I think I'll leave it the way it is, and when we get more to polishing it, I'll add an (in transit) to the ones not currently held in a card.

all phonon interactions must adhere to the following Constraints
1. A phonon's private key may not be accessible by more than a single entity at one time
1. A phonon's private key MUST remain secret unless the phonon is destroyed at or before the time of the phonon being viewable by an outside system or entity
1. A phonon private key may not be transferred to a phonon sce that has not been verified by the sending phonon sce

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is arbitrary restriction that makes little sense. It is essentially equal to sending to a "verified" card and the receiver either redeeming the phonon (key will be known) or throwing the card away (key is lost). The recommendation here is that a client SHOULD verify the receiver (possibly against a blacklist/reputation list etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i disagree. phonons cant be sent to non-phonon hardware, and must be verifies prior to sending. that said, if we allow unverified sending, then redeeming a phonon is as simple as encrypting the private keys to an unverified key owned by the client computer, and removes a little complexity around redemption and deletion...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified by a client - yes. Verified by the card - not sure.

Redeeming via encryption against user-specified key would be very beneficial (if I kept my keys in some other system, capable of receiving them "securely")

Copy link

@dviator dviator Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I think I agree that this is not a card level restriction. I think the constraint is actually the other way around?

  1. A phonon sce must only receive phonons from valid phonon sce's.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree Dan's 3.

### Encoding
For the purposes of this document, any data being described will be in JSON format.
Data sent between the terminal and the phonon sce will be implementation dependent.
Phonon transfer packets must be encoded in [CBOR](https://www.rfc-editor.org/rfc/rfc8949.html) format
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're proposing to switch from APDU to CBOR?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP is messages, and it works over TCP, but also over HTTPS, which itself can be implemented over TCP or UDP. So the change is from "custom TCP" to "messages with HTTP semantics". The important change from client coding perspective is that there are layers and functions:

"sendMessage(message)" -> cborify() -> (optional secure_channel_wrap()) -> apduify() -> card with its archaic ISO 7816-4 APDU interfaces

card with its archaic ISO 7816-4 APDU interfaces -> parse_apdy() -> unwrap_secure_channel() -> decborify() -> "onRespons(response)"

The point here being that constructing APDU-s "by hand" in the form of CLA/INS/P1/P1 with TLV payloads is gone. Compare: https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#nfc-framing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're proposing to switch from APDU to CBOR?

we are switching from tlv to cbor (at least for transfer packets)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maevyn11 let me know if you need more explanation or if you have an issue with making this change so I can close this comment thread

```json
{"pubkey":"binary data"}
```
## SET_DESCRIPTOR

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## SET_DESCRIPTOR
## SET_METADATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants