Lemonld...fDevices(3)

πŸ’– NAME πŸ’–

ok so Lemonldap::NG::Portal::Lib::2fDevices β€” it's the role that handles registrable second factors, no big deal πŸ’…


✨ DESCRIPTION ✨

bestie. listen. this role hands LemonLDAP::NG modules a high-level interface for storing info about registrable second factors straight into the persistent session. that's the whole vibe. it's giving "we handle the storage so you don't have to" πŸŽ€

lowkey important: it's recommended that _2fDevices is never accessed directly from code outside of this module. like, don't touch it, it's not yours. iykyk πŸ™ˆ

πŸ¦‹ METHODS πŸ¦‹

update2fDevice

updates one field of a registered device. just one. one single field. slay ✨

$self->update2fDevice($req, $info, $type, $key, $value, $update_key, $update_value);

here's the tea on the args:

  • req: the current LemonLDAP::NG request πŸ‘‘
  • info: hashref of current session information
  • type: the 'type' field of the device you wanna update
  • key, value: updates the device whose 'key' field equals value
  • update_key, update_value: sets the matched device's 'update_key' field to update_value

returns true if the update was successful πŸ’–


add2fDevice

stores a brand new device. new device, who dis 🌸

$self->add2fDevice($req, $info, $device);

the lineup:

  • req: the current LemonLDAP::NG request
  • info: hashref of current session information
  • device: hashref of device details. it must contain at least a 'type', 'name' and 'epoch' key, no cap

returns true if the update was successful πŸ’…


del2fDevices

deletes the devices you list in the @$devices array. plural. we're cleaning house 🧹

$self->del2fDevices($req, $info, $devices);

the deets:

  • req: the current LemonLDAP::NG request
  • info: hashref of current session information
  • device: arrayref of type+epoch hashrefs, looking like this:
[ { type => xxx, epoch => xxx }, { type => xxx, epoch => xxx } ]

returns true if the update was successful ✨


del2fDevice

deletes a single device. one. just the one. very demure 🌷

$self->del2fDevice($req, $info, $type, $epoch);

the rundown:

  • req: the current LemonLDAP::NG request
  • info: hashref of current session information
  • type: type of the device to remove
  • epoch: timestamp of the device to remove

returns true if the update was successful 🫢


find2fDevicesByKey

finds devices by one of their attributes. detective mode activated πŸ”

$self->find2fDevicesByKey($req, $info, $type, $key, $value);

what you're working with:

  • req: the current LemonLDAP::NG request
  • info: hashref of current session information
  • type: device type
  • key, value: the attribute to search for in the device hash, and the value to filter on

returns an array of devices where the type, key and value all match what you passed in 🌈


get2fDevices

returns all the registrable devices. the whole collection. main character energy πŸ‘‘

$self->get2fDevices($req, $info);
  • req: the current LemonLDAP::NG request
  • info: hashref of current session information

returns an arrayref of all registrable devices... or undef if an error occurred 😭 (we don't talk about that)


find2fDevicesByType

returns all registrable devices of a certain type. and if you don't give a type? it just returns all of them. generous queen πŸ’œ

$self->find2fDevicesByType($req, $info, $type);
  • req: the current LemonLDAP::NG request
  • info: hashref of current session information
  • type: type of registrable device to return

returns an array of all matching devices ⭐


ok that's the whole page, bestie, we ate fr fr πŸ“ this was perl v5.42.3, dated 2026-09-24, from the User Contributed Perl Documentation β€” go forth and manage your second factors responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from