Skip to main content

credential_provider

Function credential_provider 

Source
pub fn credential_provider<ClaimsFor, Decided>(
    signer: Signer,
    claims: ClaimsFor,
) -> CredentialProvider
where ClaimsFor: Fn(CredentialRequest) -> Decided + Send + Sync + 'static, Decided: Future<Output = Result<Claims, ProviderError>> + Send + 'static,
Expand description

Makes a CredentialProvider for a trusted server that connects to realtime itself.

For every connection attempt, the provider calls claims again and signs the result with a new timestamp. The claims are authoritative: nothing in the request, which the client makes, can make them wider. An error from claims is returned unchanged, and the client reports it as CelerisError::Transport. Invalid claims give the error of Signer::sign.

When the client drops the provider’s future, for example because the channel closed, nothing is signed.