Skip to content

Commit 4652cb4

Browse files
committed
fix: renames remaining docs string and error messages to use full name
1 parent c420bad commit 4652cb4

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

firebase_admin/phone_number_verification.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Firebase Phone Number Verification (FPNV) module.
15+
"""Firebase Phone Number Verification module.
1616
1717
This module contains functions for verifying JWTs related to the Firebase
18-
Phone Number Verification (FPNV) service.
18+
Phone Number Verification service.
1919
"""
2020
from __future__ import annotations
2121
from typing import Any, Dict, Optional
@@ -38,10 +38,10 @@ def _get_fpnv_service(app):
3838
return _utils.get_app_service(app, _FPNV_ATTRIBUTE, _FpnvService)
3939

4040
def verify_token(token: str, app: Optional[App] = None) -> PhoneNumberVerificationToken:
41-
"""Verifies a Firebase Phone Number Verification (FPNV) token.
41+
"""Verifies a Firebase Phone Number Verification token.
4242
4343
Args:
44-
token: A string containing the FPNV JWT.
44+
token: A string containing the Firebase Phone Number Verification JWT.
4545
app: An App instance (optional).
4646
4747
Returns:
@@ -56,7 +56,7 @@ def verify_token(token: str, app: Optional[App] = None) -> PhoneNumberVerificati
5656

5757

5858
class PhoneNumberVerificationToken(dict):
59-
"""Represents a verified FPNV token.
59+
"""Represents a verified Firebase Phone Number Verification token.
6060
6161
This class behaves like a dictionary, allowing access to the decoded claims.
6262
It also provides convenience properties for common claims.
@@ -112,8 +112,8 @@ def __init__(self, app):
112112
self._project_id = app.project_id
113113
if not self._project_id:
114114
raise ValueError(
115-
'Project ID is required for FPNV. Please ensure the app is '
116-
'initialized with a credential that contains a project ID.'
115+
'Project ID is required for Firebase Phone Number Verification. Please ensure the '
116+
'app is initialized with a credential that contains a project ID.'
117117
)
118118

119119
self._verifier = _FpnvTokenVerifier(self._project_id)
@@ -138,7 +138,7 @@ def verify_token(self, token) -> PhoneNumberVerificationToken:
138138

139139

140140
class _FpnvTokenVerifier:
141-
"""Internal class for verifying FPNV JWTs signed with ES256."""
141+
"""Internal class for verifying Firebase Phone Number Verification JWTs signed with ES256."""
142142
_jwks_client = None
143143
_project_id = None
144144

@@ -147,8 +147,8 @@ def __init__(self, project_id):
147147
self._jwks_client = PyJWKClient(_FPNV_JWKS_URL, lifespan=21600)
148148

149149
def verify(self, token) -> Dict[str, Any]:
150-
"""Verifies the given FPNV token."""
151-
_Validators.check_string("FPNV check token", token)
150+
"""Verifies the given Firebase Phone Number Verification token."""
151+
_Validators.check_string("Firebase Phone Number Verification check token", token)
152152
try:
153153
self._validate_headers(jwt.get_unverified_header(token))
154154
signing_key = self._jwks_client.get_signing_key_from_jwt(token)
@@ -236,7 +236,7 @@ def check_string(cls, label: str, value: Any):
236236
if not isinstance(value, str) or not value:
237237
raise ValueError(f'{label} must be a non-empty string.')
238238

239-
# Firebase Phone Number Verification (FPNV) Errors
239+
# Firebase Phone Number Verification Errors
240240
class InvalidTokenError(exceptions.InvalidArgumentError):
241241
"""Raised when a Firebase Phone Number Verification token is invalid."""
242242

tests/test_phone_number_verification.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ class TestVerifyToken(TestCommon):
7979
def test_no_project_id(self):
8080
app = firebase_admin.initialize_app(testutils.MockCredential(), name='no_project_id')
8181
app.credential.get_credential().project_id = None
82-
with pytest.raises(ValueError, match='Project ID is required for FPNV'):
82+
with pytest.raises(
83+
ValueError,
84+
match='Project ID is required for Firebase Phone Number Verification'
85+
):
8386
fpnv.verify_token('token', app=app)
8487

8588
def test_verify_token_with_real_crypto(self):

0 commit comments

Comments
 (0)