diff --git a/.sources/VERSIONS b/.sources/VERSIONS index b3754a04..64530b3d 100644 --- a/.sources/VERSIONS +++ b/.sources/VERSIONS @@ -39,4 +39,4 @@ # ------------------------------------------------------- motoko v1.16.1 01aee06 -internetidentity release-2026-11-06 6eda54fa +internetidentity release-2026-11-27 fbc0d62a diff --git a/.sources/internetidentity b/.sources/internetidentity index 6eda54fa..fbc0d62a 160000 --- a/.sources/internetidentity +++ b/.sources/internetidentity @@ -1 +1 @@ -Subproject commit 6eda54fadafa1d4c2e05522f84fed03705459e76 +Subproject commit fbc0d62a58d803ff1d5ff3c25dcbc501843a8cec diff --git a/public/references/internet-identity.did b/public/references/internet-identity.did index a0ecb3d0..3ed7c981 100644 --- a/public/references/internet-identity.did +++ b/public/references/internet-identity.did @@ -337,10 +337,10 @@ type InternetIdentityInit = record { // stored value across an upgrade, `opt null` clears it, `opt opt c` // sets it to `c`. dnssec_config : opt opt DnssecConfig; - // DoH (DNS-over-HTTPS) fallback configuration. Allowlists the - // domains for which the canister may fetch DKIM/DMARC TXT records - // via HTTP outcalls when no DNSSEC chain is available — see - // `docs/ongoing/email-recovery.md` §7.6. Same set/clear pattern. + // DoH (DNS-over-HTTPS) configuration. While set, the canister fetches + // DKIM/DMARC TXT records via HTTP outcalls for any email domain when no + // DNSSEC chain is available; while unset, it doesn't. Same set/clear + // pattern. doh_config : opt opt DohConfig; // URL of the official MCP connector the deployment ships, if any. Same // set/clear pattern as `dnssec_config`: null keeps the previously stored @@ -372,14 +372,15 @@ type DnssecRootAnchor = record { digest : blob; }; -// DoH (DNS-over-HTTPS) fallback configuration. +// DoH (DNS-over-HTTPS) configuration. // -// The canister will only fetch DKIM/DMARC TXT records via HTTP outcalls -// for an FQDN whose registered domain is in `allowed_domains`. Cache -// entries are populated on demand and re-used until `max_cache_age_secs` -// elapses (default 3600s when null, capped at 24h). +// Lookups for a registered domain in `reserved_domains` (matched +// case-insensitively) draw from an outcall budget of their own, so lookups +// for other domains can never use up the capacity these domains rely on. +// Null reserves no domain. Cache entries are populated on demand and re-used +// until `max_cache_age_secs` elapses (default 3600s when null). type DohConfig = record { - allowed_domains : vec text; + reserved_domains : opt vec text; max_cache_age_secs : opt nat64; }; @@ -459,7 +460,7 @@ type OpenIdEmailVerification = variant { Microsoft; // Trusts email_verified like Google. Apple's private relay addresses, // which only senders registered with II's Apple developer team can deliver - // mail to, are not kept on the credential at all. + // mail to, are listed by `list_available_attributes` only on request. Apple; }; @@ -644,6 +645,8 @@ type EmailRecoveryCredential = record { type VerifiedEmail = record { address : text; verified_at : Timestamp; + // `opt true` for an Apple private relay address; absent counts as not one. + is_private_relay : opt bool; }; type EmailChallenge = record { @@ -747,7 +750,6 @@ type EmailChallengeError = variant { Unauthorized : principal; NonceUnknown; NonceExpired; - DomainNotAllowlisted : text; DohFetchFailed : DohFailureReason; DomainNotSupported : text; EmailVerificationFailed : text; @@ -1764,7 +1766,10 @@ type PrepareIcrc3AttributeRequest = record { // II account for the relying party. account_number : opt AccountNumber; - // The attributes to be certified. + // The attributes to be certified. An `email` or `verified_email` value + // that is an Apple private relay address is certified together with the + // same key suffixed `_private_relay`, set to "true" (e.g. `email` and + // `email_private_relay`). Other values get no such key. attributes : vec AttributeSpec; // The nonce is a 32-byte value generated by the relying party. @@ -1830,6 +1835,11 @@ type ListAvailableAttributesRequest = record { // `"email"`) which matches all scopes. // If not provided, all available attributes are returned. attributes : opt vec text; + + // Whether Apple private relay addresses are listed, as `email` and + // `verified_email` rows. They only take mail from senders registered with + // II's Apple developer team. Absent or `false` leaves them out. + include_private_relay_emails : opt bool; }; type ListAvailableAttributesResponse = vec record { text; blob }; @@ -2081,12 +2091,174 @@ type GetWebPushSubscriptionStatusRequest = record { // still live from one another identity's re-subscribe left behind. type WebPushSubscriptionStatus = record { endpoint : text; // compared against the one the browser holds + // Null where the notification of every push posted through it has been removed since. + unanswered_pushes : opt UnansweredPushes; + // When the push service last accepted Internet Identity's own notification, sent + // through it to check it. Null once a notification pushed through it has been + // removed since: that is the answer. + probe_sent_at_ns : opt Timestamp; +}; + +// Pushes posted through one subscription whose notifications nothing has removed since. +type UnansweredPushes = record { + count : nat32; + first_sent_at_ns : Timestamp; + // At least 3 of them, the first sent at least an hour ago: worth a probe. + is_past_limit : bool; +}; + +// A way this identity's notifications reach the calling browser's device. +type NotificationPath = variant { + // Where this browser's wake-ups go: its own subscription, or the ICP Alerts app it + // routes through. + ThisBrowser; + // That app's installed web apps of one of its frontends that deliver for one account: + // on the entries linked to this browser entry as sharing its device, and on this + // browser entry itself where the app disabled them. One that shares this browser entry + // and is not disabled checks its own path, and is not on this one. + InstalledApps : InstalledAppsPath; +}; + +type InstalledAppsPath = record { + origin : FrontendHostname; + // The account at that app whose installed web apps these are. + account_principal : principal; + // The frontend of that app the installed web apps are served from, where it is not the + // app's own origin: one the app lists in its /.well-known/ii-alternative-origins. Null + // is the app's own origin. + frontend_origin : opt FrontendHostname; +}; + +type GetNotificationPathStatusRequest = record { + anchor_number : UserNumber; + path : NotificationPath; +}; + +type NotificationPathStatus = record { + // One per subscription on the path that can deliver now, and one per installed web + // app on it that its app disabled. Empty where there is none. + subscriptions : vec SubscriptionDeliveryStatus; +}; + +type SubscriptionDeliveryStatus = record { + // Null where the notification of every push posted through it has been removed since. + unanswered_pushes : opt UnansweredPushes; + // When the push service last accepted Internet Identity's own notification, sent + // through it to check it. Null once a notification pushed through it has been + // removed since: that is the answer. + probe_sent_at_ns : opt Timestamp; + // Whether that probe, unanswered, has been out 10 seconds by the canister's clock, the + // least time it is given to be answered before remove_unanswered_pwa_webpush_subscriptions + // removes its subscription. False where no probe is outstanding. + has_probe_had_its_answer_time : bool; + // Whether the app disabled this installed web app subscription on its device: nothing + // is sent to it, and the device is not notified another way. + is_disabled : opt bool; +}; + +type GetNotificationPathStatusError = variant { + // The caller signs with no key this identity is signed in from. + InvalidBrowserKey; + InternalCanisterError : text; +}; + +type ProbeNotificationPathRequest = record { + anchor_number : UserNumber; + path : NotificationPath; +}; + +type ProbeNotificationPathError = variant { + // The caller signs with no key this identity is signed in from. + InvalidBrowserKey; + // Nothing on the path can be woken now. + NotReachable; + InternalCanisterError : text; +}; + +type RemoveUnansweredPwaWebPushSubscriptionsRequest = record { + anchor_number : UserNumber; + origin : FrontendHostname; + // The account at that app whose installed web apps to remove. + account_principal : principal; + // The frontend of that app the installed web apps are served from, where it is not the + // app's own origin: one the app lists in its /.well-known/ii-alternative-origins. Null + // is the app's own origin. + frontend_origin : opt FrontendHostname; +}; + +type RemoveUnansweredPwaWebPushSubscriptionsError = variant { + // The caller signs with no key this identity is signed in from. + InvalidBrowserKey; + InternalCanisterError : text; +}; + +// Whether the calling installed web app's browser entry shares its device with another +// way this identity is notified. NoOtherPath wherever the identity has not allowed the +// app to notify it. +type SameDeviceLinkStatus = variant { + // This entry is already linked to another entry of the identity. + Linked; + // Another signed-in entry of the identity may deliver this app's notifications: + // through ICP Alerts it has switched on, or through its own subscription. + OtherPathMayDeliver; + NoOtherPath; +}; + +type AppGetSameDeviceLinkStatusError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + InternalCanisterError : text; +}; + +type AppPrepareSameDeviceLinkRequest = record { + // A one-shot P-256 public key, DER-encoded SPKI as WebCrypto exports it. Accepted by + // claim_same_device_link for 30 minutes. + link_public_key : blob; +}; + +type AppPrepareSameDeviceLinkError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + InternalCanisterError : text; +}; + +type ClaimSameDeviceLinkRequest = record { + anchor_number : UserNumber; + link_public_key : blob; + // By the one-shot key, over "ii-same-device-link", anchor_number as 8 big-endian + // bytes, the length of the caller's principal as one byte, and that principal. + signature : blob; +}; + +type ClaimSameDeviceLinkError = variant { + // The caller signs with no key this identity is signed in from. + InvalidBrowserKey; + // No other entry of this identity awaits that key, or its 30 minutes are up. + NoPendingLink; + // Also what the text names when an entry is already linked, the caller holds an + // installed web app of its own, or the signature is not that key's over this claim. + InternalCanisterError : text; +}; + +type AppProbePwaWebPushSubscriptionRequest = record { + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +type AppProbePwaWebPushSubscriptionError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + // The session's installed web app has no subscription that can be woken now. + NotReachable; + InternalCanisterError : text; }; // ===== Notifications sent by an app ===== -// Scoped to (origin, recipient), and shared across the canisters sending for -// one origin. +// Scoped to the recipient and the canister sending it: two canisters may each use +// one id for one recipient. type NotificationId = nat64; // Internet Identity's own id for one entry in one browser's inbox, assigned when the entry @@ -2108,8 +2280,15 @@ type Notification = record { // Applies in order: a later entry for a (recipient, id) replaces an earlier // one, as a re-send replaces a notification that is still pending. type SendNotificationArg = record { + // The frontend the notifications are sent for. Without derivation_origin, also + // the application whose users receive them. origin : FrontendHostname; notifications : vec Notification; + // The application whose users receive the notifications, where origin is one of + // its frontends: the derivation origin that frontend signs in with. The + // application must list origin in its /.well-known/ii-alternative-origins, and + // its sender list must name the caller. + derivation_origin : opt FrontendHostname; }; type NotAcceptedReason = variant { @@ -2130,9 +2309,12 @@ type SendNotificationResponse = record { }; type SendNotificationError = variant { - // The origin lists no such sender: no file, an empty or unusable one, or - // one that does not name the caller. + // The application lists no such sender: no file, an empty or unusable one, + // or one that does not name the caller. NoSuchSender; + // The application at derivation_origin lists no such frontend: no file, an + // unusable one, or one that does not name it. + NoSuchFrontend; TooManyNotifications : record { limit : nat32 }; InternalCanisterError : text; }; @@ -2276,6 +2458,148 @@ type RemoveNotificationError = variant { InternalCanisterError : text; }; +// ===== Notifications to an app's own installed web app ===== + +type AppPreparePwaWebPushSubscriptionRequest = record { + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +type AppPreparePwaWebPushSubscriptionError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + // The identity has not allowed this app to notify it. + NotificationsNotAllowed; + // The app lists no such frontend: no file, an unusable one, or one that does not + // name frontend_origin. + NoSuchFrontend; + InternalCanisterError : text; +}; + +// What an installed web app's page registers. Null removes the subscription held for the +// calling session's browser, account and frontend. +type AppSetPwaWebPushSubscriptionRequest = record { + subscription : opt PwaWebPushSubscription; + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +// The fields and encodings of SetWebPushSubscriptionRequest, with sealed_auth encrypted +// to the transport key app_prepare_pwa_webpush_subscription answered. +type PwaWebPushSubscription = record { + endpoint : text; + p256dh : blob; // 65 bytes + transport_key : blob; // 65 bytes + sealed_auth : blob; // 32 bytes +}; + +type AppSetPwaWebPushSubscriptionError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + // The identity has not allowed this app to notify it. + NotificationsNotAllowed; + // Nothing here can open sealed_auth: the transport key it was encrypted to has + // expired, a later prepare replaced it, or the app no longer lists this frontend. + // Prepare again and re-send. + TransportKeyExpired; + // Another subscription, of an account still signed in on its browser, holds this + // endpoint. Subscribe again for a fresh endpoint and re-send. + EndpointInUse; + InternalCanisterError : text; +}; + +type AppDisablePwaWebPushSubscriptionRequest = record { + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +type AppDisablePwaWebPushSubscriptionError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + // The app no longer lists frontend_origin in its /.well-known/ii-alternative-origins. + NoSuchFrontend; + InternalCanisterError : text; +}; + +type AppGetPwaWebPushSubscriptionStatusRequest = record { + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +// Whether the session's browser, account and frontend are subscribed, and at which +// endpoint. +type PwaWebPushSubscriptionStatus = variant { + // Nothing is subscribed for the session's account, the subscription awaits its + // app_set_pwa_webpush_subscription, or it delivers for another account. + NotSubscribed; + // The app disabled it for the session's account with + // app_disable_pwa_webpush_subscription. Nothing is sent to it until a subscription is + // prepared or set again, or the user allows notifications on the device again. + Disabled; + Subscribed : WebPushSubscriptionStatus; +}; + +type AppGetPwaWebPushSubscriptionStatusError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + InternalCanisterError : text; +}; + +type AppGetPwaNotificationRequest = record { + // As the wake-up that announced it named it. + inbox_notification_id : InboxNotificationId; +}; + +// Both null where the named entry is gone, or is not this app's for this session. +type AppGetPwaNotificationResponse = record { + notification : opt PwaNotification; + // Set where Internet Identity sent this itself, and what it has to say. + event : opt PwaNotificationEvent; +}; + +// Something Internet Identity tells an installed web app's user. +type PwaNotificationEvent = variant { + // This installed web app receives notifications. + NotificationsOn; +}; + +// Which notification to fetch the content of, and from which canister. +type PwaNotification = record { + canister_id : principal; + id : NotificationId; +}; + +type AppGetPwaNotificationError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + InternalCanisterError : text; +}; + +type AppRemovePwaNotificationRequest = record { + // As the wake-up that announced it named it. + inbox_notification_id : InboxNotificationId; + // Why the worker could not show it. Absent where it did. + not_shown : opt NotShownReason; + // The frontend of the session's app the installed web app is served from, where it is + // not the app's own origin: one the app lists in its /.well-known/ii-alternative-origins. + // Null is the app's own origin. Each frontend holds its own subscription per browser. + frontend_origin : opt FrontendHostname; +}; + +type AppRemovePwaNotificationError = variant { + // No live session behind this caller: expired, idle, revoked, or never one at all. + NoSuchSession; + InternalCanisterError : text; +}; + service : (opt InternetIdentityInit) -> { // Legacy identity management API // ============================== @@ -2791,8 +3115,9 @@ service : (opt InternetIdentityInit) -> { // An update call, because a query reply is signed by one replica. One that answered // with a VAPID key of its own choosing would bind the subscription to it permanently, // and the browser has nothing to check the answer against. - // A cold randomness pool yields the `Pending` result arm — a retry signal, not an - // error: asking put the draw in flight, so the caller re-calls the method. + // Pending: II is fetching its VAPID key, or has no fresh randomness to make the + // transport key. Asking puts what is missing in flight, so call again shortly. Once a + // fetch of the VAPID key has failed, this answers InternalCanisterError with the reason. prepare_webpush_subscription : (UserNumber) -> (variant { Ok : PrepareWebPushSubscriptionResponse; Pending; Err : PrepareWebPushSubscriptionError }); // Called by the browser, or by the Home Screen app it points at: what the app // registers belongs to its own record, which every identity pointing at it is @@ -2832,6 +3157,22 @@ service : (opt InternetIdentityInit) -> { enable_notification_app : (EnableNotificationAppRequest) -> (variant { Ok : NotificationId; Err : EnableNotificationAppError }); disable_notification_app : (DisableNotificationAppRequest) -> (variant { Ok; Err : DisableNotificationAppError }); + // Called by the browser that the installed web app's link names. Links the entry + // that registered the key to the caller's: an app's notification skips the caller's + // entry while that entry's installed web app can deliver it, or the app disabled it. + claim_same_device_link : (ClaimSameDeviceLinkRequest) -> (variant { Ok; Err : ClaimSameDeviceLinkError }); + + // Called by the browser. The path's subscriptions and their unanswered pushes. + get_notification_path_status : (GetNotificationPathStatusRequest) -> (variant { Ok : NotificationPathStatus; Err : GetNotificationPathStatusError }) query; + // Sends Internet Identity's own notification through every subscription on the path + // that can deliver now and was not disabled. Removing a notification pushed through + // one resets its unanswered pushes. + probe_notification_path : (ProbeNotificationPathRequest) -> (variant { Ok; Err : ProbeNotificationPathError }); + // Removes that app's installed web app subscriptions of the frontend on the path: + // those the app disabled, and those that can deliver now and have a probe nobody + // removed in the 10 seconds after the push service accepted it. + remove_unanswered_pwa_webpush_subscriptions : (RemoveUnansweredPwaWebPushSubscriptionsRequest) -> (variant { Ok; Err : RemoveUnansweredPwaWebPushSubscriptionsError }); + // Called by the browser, which watches for the answer leaving its own queue: that // is what says the app this browser points at is still installed. probe_notification_app : (ProbeNotificationAppRequest) -> (variant { Ok : NotificationId; Err : ProbeNotificationAppError }); @@ -2840,4 +3181,42 @@ service : (opt InternetIdentityInit) -> { // Called by an app's frontend, as its session. app_notification_consent_status : () -> (variant { Ok : AppNotificationConsentStatusResponse; Err : AppNotificationConsentStatusError }) query; app_revoke_notification_consent : () -> (variant { Ok; Err : AppRevokeNotificationConsentError }); + + // Called by an app's installed web app, signed by its session. The identity, browser + // and account are the session's; the frontend is the one the request names. An app's + // notification wakes only the installed web app of the frontend it was sent for. + // + // Returns II's VAPID public key, which the app passes to PushManager.subscribe, and a + // new one-time transport public key. The app encrypts the subscription's auth secret + // to that key and sends it with app_set_pwa_webpush_subscription within 5 minutes. + // It replaces this browser's existing subscription for that frontend, if any, so the + // installed web app gets no pushes until app_set_pwa_webpush_subscription succeeds. + // Pending: II is fetching its VAPID key or the app's alternative origins, or has no + // fresh randomness to make the transport key. Call again shortly. Once a fetch of the + // VAPID key has failed, this answers InternalCanisterError with the reason. + app_prepare_pwa_webpush_subscription : (AppPreparePwaWebPushSubscriptionRequest) -> (variant { Ok : PrepareWebPushSubscriptionResponse; Pending; Err : AppPreparePwaWebPushSubscriptionError }); + // Sets or, with null, removes the subscription of the session's browser, account and + // frontend. Null leaves one the app disabled as it is. + app_set_pwa_webpush_subscription : (AppSetPwaWebPushSubscriptionRequest) -> (variant { Ok; Err : AppSetPwaWebPushSubscriptionError }); + // Disables the subscription of the session's browser, account and frontend: nothing + // is sent to it, and the device it is on is not notified another way. Already + // disabled or nothing subscribed is Ok. It stays disabled until a subscription is + // prepared or set again, or the user allows notifications on the device again. + app_disable_pwa_webpush_subscription : (AppDisablePwaWebPushSubscriptionRequest) -> (variant { Ok; Err : AppDisablePwaWebPushSubscriptionError }); + // Whether the session's browser, account and frontend are subscribed, disabled by the + // app, or not subscribed. + app_get_pwa_webpush_subscription_status : (AppGetPwaWebPushSubscriptionStatusRequest) -> (variant { Ok : PwaWebPushSubscriptionStatus; Err : AppGetPwaWebPushSubscriptionStatusError }) query; + // Sends Internet Identity's own notification to the session's installed web app of the + // frontend. Removing it with app_remove_pwa_notification, naming that frontend, resets + // its unanswered pushes. + app_probe_pwa_webpush_subscription : (AppProbePwaWebPushSubscriptionRequest) -> (variant { Ok; Err : AppProbePwaWebPushSubscriptionError }); + app_get_same_device_link_status : () -> (variant { Ok : SameDeviceLinkStatus; Err : AppGetSameDeviceLinkStatusError }) query; + // Registers a one-shot key for this entry, replacing any earlier one. Another entry of + // the identity on the same device proves it with claim_same_device_link. + app_prepare_same_device_link : (AppPrepareSameDeviceLinkRequest) -> (variant { Ok; Err : AppPrepareSameDeviceLinkError }); + // The notification a wake-up named, where it is this app's for the session's browser + // and account. + app_get_pwa_notification : (AppGetPwaNotificationRequest) -> (variant { Ok : AppGetPwaNotificationResponse; Err : AppGetPwaNotificationError }) query; + // Removes the notification a wake-up named once the worker has handled it. + app_remove_pwa_notification : (AppRemovePwaNotificationRequest) -> (variant { Ok : RemoveNotificationResponse; Err : AppRemovePwaNotificationError }); };