Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Firebase bolt rules for the Password Keeper App
path /users/$uid {
read() = isCurrentUser($uid);
write() = isCurrentUser($uid);
}
path /users/$uid/$password is Password;
type Password {
service: String,
password: String,
username: String | Null
}
isCurrentUser(userid) = auth != null && auth.uid == userid;
{
"rules": {
"users": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid",
"$password": {
".validate": "newData.hasChildren(['service', 'password'])",
"service": {
".validate": "newData.isString()"
},
"password": {
".validate": "newData.isString()"
},
"username": {
".validate": "newData.isString() || newData.val() == null"
},
"$other": {
".validate": "false"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment