syntax = "proto3"; package cald.signin.v1; import "Core.proto"; option java_multiple_files = true; option java_package = "nexus.cald.api.signin"; // CaLD sign-in: signing in to a website as a number's holder. // // Three pieces travel three ways: // - The site's pointer, SignInPointer, is the `cald.sign-in` / `1` content schema: the messageBytes // of one MessageContent (schemaName "cald.sign-in", schemaVersion "1", messageTypeName // "SignInPointer") in an ordinary CaldMessage, sealed to the number like any other message. It is // unsigned: its Signature names the site's web origin (RelaySender.proto's WebOriginSigner) as a // hint only, and carries no signature bytes. // - The site's request, SignInRequest, travels inside a SignInDocument the app fetches from the // pointer's URL over HTTPS, as `application/vnd.cald.sign-in-document`. TLS proves the origin, so // the site signs nothing and publishes no key. // - The app's answer, SignInAnswerSubmission, is posted straight to the site's callback over // HTTPS (SignInSite.callbackPath, from the document), never through a relay. // // A signed structure is carried as its exact signed bytes and verified over those bytes, never a // re-serialization. Signing contexts (Core.proto): `cald/sign-in/computer/v1` for the // computer key over ComputerVouch.signedBinding, `cald/sign-in/answer/v1` for the number's and the // password key's signatures over SignInAnswerSubmission.signedAnswer. // // Not a CaLD server call: the site serves these, so this file has no `service` block. // The content of the site's relay message: where the app fetches the sign-in document. Unsigned; // the app fetches only a URL on the origin the message names as its sender. message SignInPointer { // An https URL on the site's origin, e.g. `https://bank.example/sign-in/cald/request/`. string url = 1; } // What the site serves at a pointer's URL, as binary protobuf with content type // `application/vnd.cald.sign-in-document`. Its facts are the site's own, over TLS from the origin. message SignInDocument { SignInRequest request = 1; // How the site takes sign-ins: its name and where the answer goes. SignInSite site = 2; } // The site's request to the number. It arrives inside a fetched SignInDocument, not signed by the // site: the TLS connection it was fetched over is what says which site made it. message SignInRequest { // The site's origin, canonical: scheme and host lower-cased, the scheme's default port left // out. It must equal the origin of the URL the document was fetched from, so a site can only // ask for sign-ins to itself. string audience = 1; // The site's: at least 16 random bytes, single-use, live about 5 minutes, tied on the site's // side to one browser session. bytes nonce = 2; // The number asked for (an app may hold several). cald.core.v1.PhoneNumber number = 3; // When the site made it. int64 issuedAtEpochMillis = 4; // The key the browser's page made, vouching for this request. ComputerVouch computer = 5; // The browser's addresses as the site saw them. BrowserAddresses browserAddresses = 6; } // What the computer key signs: the request it vouches for, so a vouch can't be moved to another // site, nonce or number. message ComputerBinding { string audience = 1; bytes nonce = 2; cald.core.v1.PhoneNumber number = 3; } // The browser's computer key and its signature binding it to one request. message ComputerVouch { // SubjectPublicKeyInfo DER (WebCrypto ECDSA P-256 in a browser). bytes publicKey = 1; // What the user is shown for this computer, e.g. "Chrome on Windows". Chosen by the page, so // never trusted as anything but a label. string label = 2; // A serialized ComputerBinding: the exact bytes the signature covers. bytes signedBinding = 3; // Over signedBinding, under context `cald/sign-in/computer/v1`. From WebCrypto, so ECDSA in // IEEE P1363 form (r || s), not DER. bytes signature = 4; } // The browser's addresses as the site saw them, for the app's same-network check: the // addresses its own sign-in requests to the site came from, one per family. A browser reaches // the site over whichever family it chooses, so usually only one is set. // // The app measures its own address the same way, in the family the browser used: it connects // to the site's origin over that family alone (resolving only its A, or only its AAAA, records) // and asks GET /sign-in/cald/echo, which answers the caller's address as plain text. A site // needs no other host name for this. message BrowserAddresses { // Either may be empty. string ipv4 = 1; string ipv6 = 2; // Optional: the network provider's name and a rough location, shown to the user. string provider = 3; string roughLocation = 4; } // The app's answer, signed. Carried as its exact bytes in // SignInAnswerSubmission.signedAnswer. message SignInAnswer { // As in the request. string audience = 1; bytes nonce = 2; // When the app signed it. int64 issuedAtEpochMillis = 3; // Who is signing in: the number (number mode), or the per-site pseudonym's public key (private // mode, not used yet). oneof identity { cald.core.v1.PhoneNumber number = 4; bytes pseudonymPublicKey = 5; } // SubjectPublicKeyInfo DER of a new password key; set only when enrolling or changing it. bytes passwordPublicKey = 6; Decision decision = 7; ComputerOutcome computer = 8; // Whether a person answered or the app answered by itself. A site wanting a person present // at every sign-in refuses AUTOMATIC. Approval approval = 9; enum Decision { // Never sent; a reader treats it, and a value it doesn't know, as a decline. DECISION_UNSPECIFIED = 0; APPROVED = 1; DECLINED = 2; } enum Approval { // Never sent; a reader refuses it, and a value it doesn't know. APPROVAL_UNSPECIFIED = 0; // The user answered on the phone. USER = 1; // The app answered by itself, for a known, confirmed computer on the same network. AUTOMATIC = 2; } } // The computer the app answered for, and how sure the app is that it is the user's. message ComputerOutcome { // SHA-256 of the computer key's SubjectPublicKeyInfo DER. cald.core.v1.Hash keyHash = 1; Assurance assurance = 2; enum Assurance { // Never sent; a reader treats it, and a value it doesn't know, as the weakest. ASSURANCE_UNSPECIFIED = 0; // A computer the user approved before. KNOWN = 1; // The browser's address matched the phone's network. SAME_NETWORK = 2; // A local proximity check passed. PROXIMITY = 3; // None of those: the user approved after a warning. WARNED = 4; } } // What the app posts to the site's callback. message SignInAnswerSubmission { // A serialized SignInAnswer: the exact bytes both signatures cover, behind their signing context. bytes signedAnswer = 1; // By the number's signing key, under context `cald/sign-in/answer/v1`. bytes numberSignature = 2; // By the password key, under the same context. Absent only on a decline. bytes passwordSignature = 3; // The signing certificate and its intermediates, DER, so the site can validate the chain. cald.core.v1.CertificateBundle numberCertificates = 4; } // The callback's answer to whoever posted. Only accepted or refused: the reason is shown on the // browser's page, not to the poster. message SignInAnswerResponse { Status status = 1; enum Status { // Never sent; a reader treats it, and a status it doesn't know, as refused. STATUS_UNSPECIFIED = 0; ACCEPTED = 1; REFUSED = 2; } } // How a site takes sign-ins, part of its SignInDocument. message SignInSite { // The site's name, shown to the user beside its origin. string displayName = 1; // The path, under the origin, the app posts a SignInAnswerSubmission to. string callbackPath = 2; repeated IdentityMode acceptedModes = 3; enum IdentityMode { // Never sent; a reader ignores it. IDENTITY_MODE_UNSPECIFIED = 0; // Signing in as the number. NUMBER = 1; // Signing in under a per-site pseudonym (not used yet). PRIVATE = 2; } }