pub struct GnapService { /* private fields */ }Implementations§
Source§impl GnapService
impl GnapService
pub fn new(config: GnapConfig) -> Self
Sourcepub fn verify_jwk_signature(
jwk: &GnapJwk,
message: &[u8],
signature: &[u8],
) -> Result<()>
pub fn verify_jwk_signature( jwk: &GnapJwk, message: &[u8], signature: &[u8], ) -> Result<()>
Reconstruct the raw public key bytes from a JWK and verify a
signature using ring. Supports ES256 (P-256) and RS256.
This is called by middleware or application code that extracts the HTTP message signature from the request before invoking the GNAP transaction endpoints.
Sourcepub fn validate_client_key_with_proof(
client: &Option<GnapClientInfo>,
proof_message: Option<&[u8]>,
proof_signature: Option<&[u8]>,
) -> Result<Option<String>>
pub fn validate_client_key_with_proof( client: &Option<GnapClientInfo>, proof_message: Option<&[u8]>, proof_signature: Option<&[u8]>, ) -> Result<Option<String>>
Validate the client key binding on a request. Returns the key thumbprint if a key is present and valid.
When proof_message and proof_signature are provided, the actual
cryptographic signature is verified against the client’s JWK. For
proof methods other than “test”, the caller (typically HTTP middleware)
must extract and supply the message and signature bytes from the
request (e.g. the HTTP Signature input string and its signature value).
Sourcepub async fn handle_transaction(
&self,
request: GnapTransactionRequest,
) -> Result<Value>
pub async fn handle_transaction( &self, request: GnapTransactionRequest, ) -> Result<Value>
Handle a new GNAP transaction request (draft-ietf-gnap-core-protocol §2)
Sourcepub async fn continue_transaction(
&self,
transaction_id: &str,
continue_token: &str,
interact_ref: Option<&str>,
interact_hash: Option<&str>,
) -> Result<Value>
pub async fn continue_transaction( &self, transaction_id: &str, continue_token: &str, interact_ref: Option<&str>, interact_hash: Option<&str>, ) -> Result<Value>
Continue a GNAP transaction (polling or post-interaction).
The continuation token is rotated on every successful call per draft §5.1, preventing replay of old continuation responses.
Sourcepub async fn approve_transaction(
&self,
transaction_id: &str,
subject_id: Option<&str>,
) -> Result<()>
pub async fn approve_transaction( &self, transaction_id: &str, subject_id: Option<&str>, ) -> Result<()>
Approve a pending transaction (called after user interaction). Optionally sets the subject identifier for subject-info responses.
Sourcepub async fn deny_transaction(&self, transaction_id: &str) -> Result<()>
pub async fn deny_transaction(&self, transaction_id: &str) -> Result<()>
Deny a pending transaction
Sourcepub async fn revoke_token(&self, token_value: &str) -> Result<()>
pub async fn revoke_token(&self, token_value: &str) -> Result<()>
Revoke an issued access token (draft §6.2 — DELETE on manage URI).
Sourcepub async fn rotate_token(&self, old_token_value: &str) -> Result<Value>
pub async fn rotate_token(&self, old_token_value: &str) -> Result<Value>
Rotate an issued access token (draft §6.1 — POST on manage URI). Returns a new token with the same access rights and key binding.
Sourcepub async fn introspect_token(&self, token_value: &str) -> Result<Option<Value>>
pub async fn introspect_token(&self, token_value: &str) -> Result<Option<Value>>
Introspect a token — check if it is valid and return its access rights.
Sourcepub async fn validate_token_key_binding(
&self,
token_value: &str,
presenting_jwk: &GnapJwk,
) -> Result<bool>
pub async fn validate_token_key_binding( &self, token_value: &str, presenting_jwk: &GnapJwk, ) -> Result<bool>
Validate that a key-bound token is being used with the correct key.
For tokens issued with a client key binding, verify that the
presenting client’s JWK thumbprint matches the stored binding.
Returns Ok(true) if the token is not key-bound (no restriction).
Sourcepub async fn cleanup_expired_transactions(&self)
pub async fn cleanup_expired_transactions(&self)
Remove expired transactions from the in-memory store.
Sourcepub async fn cleanup_expired_tokens(&self)
pub async fn cleanup_expired_tokens(&self)
Remove expired access tokens from the in-memory store.
Auto Trait Implementations§
impl Freeze for GnapService
impl !RefUnwindSafe for GnapService
impl Send for GnapService
impl Sync for GnapService
impl Unpin for GnapService
impl UnsafeUnpin for GnapService
impl !UnwindSafe for GnapService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more