This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I tried using the save_encrypted() instead of just save(), and I get the error: Cannot pass a value of type "String" as "PackedByteArray. Unfortunately, I have no idea how to fix this, so I would appreciate any help possible. Thank you!

Godot version 4
related to an answer for: How do I save a encrypted config file?
in Engine by (38 points)

2 Answers

+1 vote
Best answer

If you want to encrypt the file with a string-based password, use save_encrypted_pass() instead. So, something like...

save_encrypted_pass("user://gamedata.dat", "your_password")
by (22,704 points)
selected by
0 votes

arg1 = file you want to save. ie: "user://gamedata.dat"
arg2 = password. ie: "mypassword"

by (18 points)

I am still getting the same error, I think it is because arg2 is a string and not a packed byte array (because I think that is what the error is saying), and I don't know how to convert a string to a packed byte array.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.