Skip to content

Instantly share code, notes, and snippets.

@rockwotj
Last active January 9, 2016 22:19
Show Gist options
  • Save rockwotj/730502a30f9003c19a9f to your computer and use it in GitHub Desktop.
Save rockwotj/730502a30f9003c19a9f to your computer and use it in GitHub Desktop.
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