From f21205362058d65d1372c0357e8cf60bf2a07e27 Mon Sep 17 00:00:00 2001
From: Vika <vika@fireburn.ru>
Date: Wed, 16 Apr 2025 02:25:41 +0300
Subject: kittybox-indieauth: 0.3.0 → 0.3.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

`Scopes` now includes `len()` and `is_empty()` to check if an
application didn't request any scopes.

Change-Id: I7c9c0366131445b11374cf6e66ebbc3a9ba27e0b
---
 Cargo.lock              |  2 +-
 indieauth/Cargo.toml    |  2 +-
 indieauth/src/scopes.rs | 13 +++++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 28723c7..601bbf7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1931,7 +1931,7 @@ dependencies = [
 
 [[package]]
 name = "kittybox-indieauth"
-version = "0.3.0"
+version = "0.3.1"
 dependencies = [
  "axum-core",
  "data-encoding",
diff --git a/indieauth/Cargo.toml b/indieauth/Cargo.toml
index 563c847..d2819d7 100644
--- a/indieauth/Cargo.toml
+++ b/indieauth/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "kittybox-indieauth"
-version = "0.3.0"
+version = "0.3.1"
 edition = "2021"
 
 [features]
diff --git a/indieauth/src/scopes.rs b/indieauth/src/scopes.rs
index 295b0c8..7333b5b 100644
--- a/indieauth/src/scopes.rs
+++ b/indieauth/src/scopes.rs
@@ -111,6 +111,19 @@ impl Scopes {
     pub fn iter(&self) -> std::slice::Iter<'_, Scope> {
         self.0.iter()
     }
+
+    /// Count scopes requested by the application.
+    pub fn len(&self) -> usize {
+        self.0.len()
+    }
+
+    /// See if the application requested any scopes.
+    ///
+    /// Some older applications forget to request scopes. This may be used to force a default scope.
+    #[must_use]
+    pub fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
 }
 impl AsRef<[Scope]> for Scopes {
     fn as_ref(&self) -> &[Scope] {
-- 
cgit 1.4.1