fedux-org/proxy_rb

View on GitHub
lib/proxy_rb/api/passwords.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
require 'contracts'

# ProxyRb
module ProxyRb
  # Api
  module Api
    # Helpers to access passwords
    module Passwords
      include Contracts::Core
      include Contracts::Builtin

      Contract Or[String, Symbol] => Maybe[String]
      # Get password for user
      #
      # @param [String] user_name
      #   The user name
      #
      # @return [String]
      #   The password
      def password(user_name)
        ProxyRb.config.password_fetcher.call(user_name.to_s)
      end
    end
  end
end