Sha256: 179d677b15aa038a5af03197b33a784a08dd3fd4204412c3314f72a4c8bd0d17

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

new ({ particle: :password, category: :security, type: :string })
new ({ sanitizer: :password }) do |params|

  params = { read: params, write: params } unless params.instance_of? Hash

  # encoding below
  params[:global] = Black_matter.encode(params[:global])

  params[:read]&.each do |k, v|
    params[:read][k] = Black_matter.encode(v)
  end
  params[:write]&.each do |k, v|
    params[:write][k] = Black_matter.encode(v)
  end

  params[:read] = Black_matter.password unless params[:read]
  params[:write] = Black_matter.password unless params[:write]

  if type == :human
    # we store the hashed password into the Universe for easier access
    Black_matter.set_password(params)
  end
  params
end

new({ read: :password }) do |params|
  params = Black_matter.password if params.nil?
  params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
  params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
  params
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
atome-0.5.6.4.5 lib/atome/genesis/particles/security.rb
atome-0.5.6.4.2 lib/atome/genesis/particles/security.rb
atome-0.5.6.4.1 lib/atome/genesis/particles/security.rb
atome-0.5.6.4.0 lib/atome/genesis/particles/security.rb
atome-0.5.6.3.9 lib/atome/genesis/particles/security.rb
atome-0.5.6.3.6 lib/atome/genesis/particles/security.rb
atome-0.5.6.3.5 lib/atome/genesis/particles/security.rb
atome-0.5.6.3.1 lib/atome/genesis/particles/security.rb
atome-0.5.6.3.0 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.9 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.7 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.5 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.4 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.3 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.1 lib/atome/genesis/generators/security.rb
atome-0.5.6.2.0 lib/atome/genesis/generators/security.rb
atome-0.5.6.1.9 lib/atome/genesis/generators/security.rb