Skip to content

Make Pii::Cacher#fetch_string a private method#9492

Merged
jmhooper merged 4 commits intomainfrom
jmhooper-move-fetch-string
Oct 31, 2023
Merged

Make Pii::Cacher#fetch_string a private method#9492
jmhooper merged 4 commits intomainfrom
jmhooper-move-fetch-string

Conversation

@jmhooper
Copy link
Contributor

The Pii::Cacher#fetch_string method gets the raw PII JSON blob and returns it. This is called by the #fetch in the Pii::Cacher and converted to Pii::Attributes.

Outside of the Pii::Cacher this method is called in one place by the IdP. This is in the completions controller to get the PII which is ultimately parsed into a hash. The same can be acheived by taking the result of Pii::Cacher#fetch and calling #to_h on it. This commit does that so the #fetch_string method can be made part of the private API.

Making this method part of the private API will make it easier to modify the way the cacher works to support encrypting and decrypting both active and pending profiles in the future.

The `Pii::Cacher#fetch_string` method gets the raw PII JSON blob and returns it. This is called by the `#fetch` in the `Pii::Cacher` and converted to `Pii::Attributes`.

Outside of the `Pii::Cacher` this method is called in one place by the IdP. This is in the completions controller to get the PII which is ultimately parsed into a hash. The same can be acheived by taking the result of `Pii::Cacher#fetch` and calling `#to_h` on it. This commit does that so the `#fetch_string` method can be made part of the private API.

Making this method part of the private API will make it easier to modify the way the cacher works to support encrypting and decrypting both active and pending profiles in the future.

[skip changelog]
Pii::Attributes.new_from_json(pii_string)
end

def exists_in_session?
Copy link
Contributor Author

@jmhooper jmhooper Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an annoying diff. The actual change was a copy and paste of the fetch_string method.

@jmhooper jmhooper requested review from a team and mitchellhenke October 31, 2023 18:35
@jmhooper jmhooper merged commit 8d57a93 into main Oct 31, 2023
@jmhooper jmhooper deleted the jmhooper-move-fetch-string branch October 31, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants